DataGrid TextColumn
DataGridTextColumn将每个关联单元格的内容转换为一个系统。字符串对象。
DataGridTextColumn比DataGridTemplateColumn具有更好的性能。
重要的特性
以下是TextColumns的特定属性:
- PropertyName:指定对象类型的属性的名称,该对象类型表示网格中的每一行。
- HeaderText:定义要在表示列的Header UI中显示的内容。
- CellContentFormat:为每个单元格值定义自定义格式。的字符串。格式routine is used and the format passed should be in the form required by this method.
- CellContentStyle:定义Style对象,该对象定义与此列关联的每个单元格的外观。
- CellContentStyleSelector:定义StyleSelector实例,允许在每个单元格的基础上动态显示。
- CellContentTemplate(DataTemplate):定义与具体列关联的每个单元格的外观。CellContenTemplate让您有机会在每个数据网格列中包装文本。您可以添加一个标签作为文本,模板列的内容,并使用标签的包装其文本LineBreakMode财产。
- CellEditTemplate(DataTemplate):定义与具体列关联的编辑器。当单元格处于编辑模式时,将显示CellEditTemplate。
- FilterControlTemplate(DataTemplate):用于过滤UI的用户定义模板。模板必须包含Telerik.XamarinForms.DataGrid.DataGridFilterControlBase类的实例
更多关于CellDecorationStyle而且CellDecorationStyleSelector可在列的样式的话题。
CellContentTemplate,CellEditTemplate而且FilterControlTemplate属性是R2 2020官方发布的DataGrid特性的一部分。有关cellledit和单元格内容模板特性的详细信息,请查看细胞模板篇文章。有关过滤器控制模板的更多详细信息,请参阅FilterControl模板部分。
CellContentFormat使用框架提供的格式字符串。有关详细信息,请查看字符串。格式篇文章。
的
CellContentStyle
属性未应用时CellContentTemplate
使用。
例子
下面是一个如何使用文本列属性的示例: