我在应用程序 Windows 8.1 上使用 RadDataGrid。网格有 3 列:名称、描述和带有“选择”按钮的模板列。当用户按下选择按钮时,我希望该程序显示一条带有所选项目 id 的消息
这是我的代码。
<Grid:RadDataGrid x:Name="MyGrid" AutoGenerateColumns="False" VerticalAlignment="Center">
<Grid:RadDataGrid.Columns>
<Grid:DataGridTextColumn CanUserFilter="False" CanUserEdit="False" PropertyName="Name" Header="Name">
</Grid:DataGridTextColumn>
<Grid:DataGridTextColumn CanUserFilter="False" CanUserEdit="False" PropertyName="Description" Header="Description">
</Grid:DataGridTextColumn>
<Grid:DataGridTemplateColumn CanUserFilter="False" CanUserEdit="False">
<Grid:DataGridTemplateColumn.CellContentTemplate>
<DataTemplate>
<StackPanel>
<Button x:Name="BtnSelect" Content="Select" HorizontalAlignment="Center" Click="BtnSelect_OnClick"></Button>
</StackPanel>
</DataTemplate>
</Grid:DataGridTemplateColumn.CellContentTemplate>
</Grid:DataGridTemplateColumn>
</Grid:RadDataGrid.Columns>
</Grid:RadDataGrid>
代码隐藏
private void BtnSelect_OnClick(object sender, RoutedEventArgs e)
{
?
}