I am trying to insert a hyperlink in DataGridand find a method to implement the behavior RequestNavigateusing the MVVM pattern.
I have tried many solutions so far, but none of them work. could you help me?
This is my xaml code:
<dgWPFCtrl:ExtDataGridTemplateColumn Header="Link to XXX" Width="*">
<dgWPFCtrl:ExtDataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock >
<Hyperlink NavigateUri="{Binding Path=ID_HTTP_LINK}"
>
<TextBlock Text="{Binding Path=ID_HTTP_LINK}"/>
<i:Interaction.Triggers>
<i:EventTrigger EventName="RequestNavigate">
<WPFCtrl:EventToCommand
PassEventArgsToCommand="True"
Command="{Binding Path=OpenLinkCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Hyperlink>
</TextBlock>
</DataTemplate>
</dgWPFCtrl:ExtDataGridTemplateColumn.CellTemplate>
</dgWPFCtrl:ExtDataGridTemplateColumn>
and after relative development ICommand:
RelayCommand _openLinkCommand;
public ICommand OpenLinkCommand
{
get
{
if (_openLinkCommand == null)
_openLinkCommand = new RelayCommand(param =>
{
});
return _openLinkCommand;
}
}
Where am I mistaken? Suddenly, ICommandnever called!
I tried to use another event (for example MouseEnter), but nothing has changed!
Thanks in advance for your contributions,
Deby
source
share