I have a datagrid and want to show hyperlink and normal text in cell at a time .I have defined celltemplate and celleditingtemplate for cells in the datagrid. I have set the selection mode to be a full row.
When i click on hyperlink after that cell editing is not enable unless i change focus from it. I want to edit cell after click on hyperlink. When i double click on cell then it should be edit.
Any suggestions ? Please see my code below
<my:DataGrid Name="Grid" HeadersVisibility="Column" SelectionUnit="FullRow"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
ItemsSource="{Binding Notes,UpdateSourceTrigger=PropertyChanged}" Background="White" AutoGenerateColumns="False"
BorderBrush="#FFB1B1B1" VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
HorizontalGridLinesBrush="LightGray" ScrollViewer.CanContentScroll="False"
VerticalGridLinesBrush="LightGray" CanUserDeleteRows="False" CanUserResizeRows="True" CanUserAddRows="False">
<my:DataGrid.Columns>
<my:DataGridTextColumn Binding="{Binding Path=TimestampString}" Header="Timestamp" IsReadOnly="True"/>
<my:DataGridTemplateColumn Header="Notes" Width="*">
<my:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Width="Auto" Background="White" >
<TextBlock Name="tb" Style="{DynamicResource TextBlockStyle}" TextWrapping="Wrap" Helpers:NavigationService.Text="{Binding
Notes}" ContextMenu="{StaticResource TextBoxContextMenu}"></TextBlock>
</StackPanel>
</DataTemplate>
</my:DataGridTemplateColumn.CellTemplate>
<my:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<TextBox AllowDrop="False" AcceptsReturn="True" TextWrapping="Wrap" Name="Note" Text="{Binding Notes}">
</TextBox>
<DataTemplate.Triggers>
<Trigger SourceName="Note" Property="IsVisible" Value="True">
<Setter TargetName="Note" Property="FocusManager.FocusedElement" Value="{Binding ElementName=Note}"/>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</my:DataGridTemplateColumn.CellEditingTemplate>
</my:DataGridTemplateColumn>
</my:DataGrid.Columns>
</my:DataGrid>