mirror of
https://gitee.com/handyorg/HandyControl.git
synced 2024-11-30 19:08:08 +08:00
ggcy-add warning info of DataGrid
This commit is contained in:
parent
fff43a84ac
commit
95a8241bb0
@ -2,6 +2,19 @@
|
||||
title: DataGrid 数据表格
|
||||
---
|
||||
|
||||
**HandyControl中自带DataGrid相关样式**
|
||||
|
||||
| style名称 | 所属类型 | 用途描述 |
|
||||
| :------------------------ | :------------------------------------------ | :----------------------------------------------------- |
|
||||
| RowHeaderGripperStyle | Thumb | RowHeader的可拖拽样式 |
|
||||
| ColumnHeaderGripperStyle | Thumb | ColumnHeader可拖拽样式 |
|
||||
| DataGridCellStyle | DataGridCell | DataGrid数据列样式 |
|
||||
| DataGridRowStyle | DataGridRow | DataGrid数据行样式 |
|
||||
| DataGridColumnHeaderStyle | DataGridColumnHeader | DataGrid列头样式 |
|
||||
| DataGridRowHeaderStyle | DataGridRowHeader | DataGrid行头样式 |
|
||||
| TextBlockComboBoxStyle | controls:DataGridAttach.ComboBoxColumnStyle | DataGrid附加属性文本框下拉列的非编辑模式下文本显示样式 |
|
||||
| DataGridTextColumnStyle | TextBlock | DataGrid文本列样式 |
|
||||
|
||||
{% note info no-icon %}
|
||||
用例:
|
||||
|
||||
@ -29,4 +42,34 @@ title: DataGrid 数据表格
|
||||
</DataGrid>
|
||||
{% endcode %}
|
||||
![ContextMenu](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/DataGrid.png)
|
||||
{% endnote %}
|
||||
{% endnote %}
|
||||
|
||||
**常见问题:**
|
||||
{% note warning no-icon%}
|
||||
对于文本显示列`DataGridTextColumn`需要设定文本内容`水平居中`或者`水平居右`,而不是HandyControl中设定的样式默认显示为`居左`时,需要继承`DataGridCellStyle`重写`HorizontalContentAlignment` 属性为`Center` 或`Right` 需要注意的是,此方式仅仅使用与引入了HandControl资源样式的项目,普通原生DataGrid使用该方式无效。
|
||||
|
||||
用例如下:
|
||||
|
||||
{% code %}
|
||||
|
||||
样式:
|
||||
<Style x:Key="DataGridTextCenterColumnStyle" TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
</Style>
|
||||
|
||||
xaml中的使用:
|
||||
|
||||
<DataGrid ItemsSource="{Binding Datas}" AutoGenerateColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="居左" Binding="{Binding Name}" Width="*"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="居中" CellStyle="{StaticResource DataGridTextCenterColumnStyle}" Width="*" Binding="{Binding Name}"></DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
{% endcode %}
|
||||
|
||||
效果如下:
|
||||
|
||||
![DataGridWarning01](../images/DataGrid-Warning01.png)
|
||||
|
||||
{% endnote %}
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
Loading…
Reference in New Issue
Block a user