微软的WPF DataGrid中有很多的属性和样式,你可以调整,以寻找合适的(如果你是一名设计师)。
下面,找到我的小抄造型的网格。它不是100%全面,但它可以让你走得很远,有一些非常有用的技巧和陷阱。
在DataGrid中的最高水平,你可以改变的外观和感觉,通过设置一些:
Property
Type
Values
Default
AlternatingRowBackground
Brush
Any Brush
Null
Background
Brush
Any Brush
Theme default
ColumnHeaderHeight
Double
0 to any positive double
NaN
ColumnHeaderStyle
Style
Any Style
Null
ColumnWidth
DataGridLength
0 to any positive double, Auto, *, SizeToCells, SizeToHeader
SizeToHeader
HeadersVisibility
DataGridHeadersVisibility
All, Row, Column, None
All
MaxColumnWidth
Double
0 to any positive double
Positive Infinity
MaxRowHeight
Double
0 to any positive double
Positive Infinity
MinColumnWidth
Double
0 to any positive double
20
MinRowHeight
Double
0 to any positive double
0
RowBackground
Brush
Any Brush
Theme default
RowDetailsVisibilityMode
DataGridRowDetailsVisibilityMode
Visible, VisibleWhenSelected, Collapsed
VisibleWhenSelected
RowHeadersWidth
Double
0 to any positive double
NaN
RowHeight
Double
0 to any positive double
NaN
AlternationCount
int
2+
coerced to 2
GridLinesVisibility
DataGridGridLinesVisibility
All, Horizontal, Vertical, None
All
HorizontalGridLinesBrush
Brush
Any Brush
Black(via metadata)
VerticalGridLinesBrush
Brush
Any Brush
Black(via metadata)
ItemTemplate
DataTemplate
Any DataTemplate
Null
RowDetailsTemplate
DataTemplate
Any DataTemplate
Null
CellStyle
Style
Any Style
Null
ItemContainerStyle
Style
Any Style
Null
RowHeaderStyle
Style
Any Style
Null
RowStyle
Style
Any Style
Null
Style
Style
Any Style
Null
Template
ControlTemplate
ControlTemplate TargetType=Datagrid
Null
在这里,你可以看到的一些属性(在视觉上是不是全部)的可视化表示,这将让你知道这是什么文章将涵盖。