Can I use a Command with DataGridHyperlinkColumn?

Apr 16, 2010 at 4:30 PM

Hi:

Is there any way I can associate a Command with a DataGridHyperlinkColumn?  I've tried this:

   <DataGridHyperlinkColumn Header="Client Name" Binding="{Binding ShortName}">
     <DataGridHyperlinkColumn.ElementStyle>
      <Style TargetType="TextBlock">
       <Setter Property="Hyperlink.Command"
                                    Value="{Binding DataContext.NavigateToClientCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:ClientsSummaryView}}}"/>
                            <Setter Property="Hyperlink.CommandParameter" Value="{Binding}"/>
                        </Style>
                    </DataGridHyperlinkColumn.ElementStyle>
    </DataGridHyperlinkColumn>

At runtime, I can see that the binding is being correctly evaluated (the property getter for the Command is called), but the Command is not executed when I click the hyperlink.  Is there a better way to do this?

Thanks,

Daniel