Note that there are some explanatory texts on larger screens.

plurals
  1. POCell Template with Hyperlink usage in MVVM pattern
    primarykey
    data
    text
    <p>I'm tring to insert an hyperlink within a <code>DataGrid</code> and find a method in order to implement the <code>RequestNavigate</code> behaviour using the MVVM pattern.</p> <p>I've tried a lot of solutions up until now, but none of them works. Could you help me, please?</p> <p>This is my xaml code:</p> <pre><code>&lt;dgWPFCtrl:ExtDataGridTemplateColumn Header="Link to XXX" Width="*"&gt; &lt;dgWPFCtrl:ExtDataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;TextBlock &gt; &lt;Hyperlink NavigateUri="{Binding Path=ID_HTTP_LINK}" &gt; &lt;TextBlock Text="{Binding Path=ID_HTTP_LINK}"/&gt; &lt;i:Interaction.Triggers&gt; &lt;i:EventTrigger EventName="RequestNavigate"&gt; &lt;WPFCtrl:EventToCommand PassEventArgsToCommand="True" Command="{Binding Path=OpenLinkCommand}" /&gt; &lt;/i:EventTrigger&gt; &lt;/i:Interaction.Triggers&gt; &lt;/Hyperlink&gt; &lt;/TextBlock&gt; &lt;/DataTemplate&gt; &lt;/dgWPFCtrl:ExtDataGridTemplateColumn.CellTemplate&gt; &lt;/dgWPFCtrl:ExtDataGridTemplateColumn&gt; </code></pre> <p>and following the relative <code>ICommand</code> development:</p> <pre class="lang-cs prettyprint-override"><code>//Command for open link RelayCommand _openLinkCommand; public ICommand OpenLinkCommand { get { if (_openLinkCommand == null) _openLinkCommand = new RelayCommand(param =&gt; { //Command Body ... }); return _openLinkCommand; } } </code></pre> <p>Where I'm wrong? Unexpectedly, the <code>ICommand</code> is never even called!</p> <p>I've tried to use also other kind of event ( such as <code>MouseEnter</code>), but nothing changed!</p> <p>Thanks in advance for your contributions,</p> <p>Deby</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload