我需要创建一个通用的DataGridTemplateColumn,以便我可以在整个应用程序中使用它来处理不同的对象和属性。
以下是我在项目中使用的一些示例代码。
以下是我在项目中使用的一些示例代码。
<DataGridTemplateColumn Width="100*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Age}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=Age}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
我需要一个通用版本的代码,这样我就可以将 DataTemplate
放在 app.xaml
中,并在我的代码中引用它。