WPF在ListView中创建可编辑单元格

问题描述 投票:-1回答:1

[我一直在寻找一种在<GridViewColumn>中创建可编辑单元格的方法,并且找到的参考文献为<GridViewColumn.CellTemplate>,但是当我尝试使用此方法时,却出现了错误Error XLS0415 The attachable property 'CellTemplate' was not found in type 'GridViewColumn'. Test MainWindow.xaml 26,并且我已经找到了没有其他潜在的解决方案。我需要一个可编辑的TextBox以及一个可编辑的DatePicker。

wpf datagrid wpf-controls
1个回答
0
投票

CellTemplate没有可附加的属性,但通过使用找到了解决方案

<DataTemplate x:Key="TextCell">
 <TextBox Text={Binding [DataName]}"/>
</DataTemplate>
<DataTemplate x:Key="DateCell">
 <DatePicker Text{Binding [OtherDataName]}"/>
</DataTemplate>
© www.soinside.com 2019 - 2024. All rights reserved.