我正在编写一个 WPF 应用程序,并且在一个用户控件中我正在使用 DataGrid 中的超链接,但它不起作用。我使用 bing.com 只是为了测试。
<DataGrid Grid.Row="1"
AutoGenerateColumns="False"
Height="Auto"
Name="dataGrid1"
Width="Auto"
CanUserAddRows="False"
CanUserResizeColumns="True"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Focusable="True"
IsHitTestVisible="False"
BorderThickness="0">
<DataGrid.Columns >
<DataGridTextColumn Header="Start Time" Width="*" Binding="{Binding Path=startTime}" CanUserSort="True"/>
<DataGridTextColumn Header="End Time" Width="*" Binding="{Binding Path=endTime}" CanUserSort="True"/>
<DataGridTextColumn Header="Resources" Width="*" Binding="{Binding Path=resources}" CanUserSort="True"/>
<DataGridTextColumn Header="Action" Width="*" Binding="{Binding Path=action}" CanUserSort="True"/>
<DataGridTextColumn Header="Result" Width="*" Binding="{Binding Path=result}" CanUserSort="True"/>
<DataGridTemplateColumn Header="Health" Width="*" CanUserSort="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock >
<Hyperlink NavigateUri="http://www.bing.com" RequestNavigate="Hyperlink_RequestNavigate"><!--"{Binding Path=healthUri}">-->
<TextBlock Text="{Binding Path=healthUri}" Focusable="True" />
</Hyperlink>
</TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>