赛派号

最有性价比的苹果电脑 DataGrid Styles and Templates

DataGrid Styles and Templates Article 02/06/2023

This topic describes the styles and templates for the DataGrid control. You can modify the default ControlTemplate to give the control a unique appearance. For more information, see Create a template for a control.

DataGrid Parts

The following table lists the named parts for the DataGrid control.

Part Type Description PART_ColumnHeadersPresenter DataGridColumnHeadersPresenter The row that contains the column headers.

When you create a ControlTemplate for a DataGrid, your template might contain an ItemsPresenter within a ScrollViewer. (The ItemsPresenter displays each item in the DataGrid; the ScrollViewer enables scrolling within the control). If the ItemsPresenter is not the direct child of the ScrollViewer, you must give the ItemsPresenter the name, ItemsPresenter.

The default template for the DataGrid contains a ScrollViewer control. For more information about the parts defined by the ScrollViewer, see ScrollViewer Styles and Templates.

DataGrid States

The following table lists the visual states for the DataGrid control.

VisualState Name VisualStateGroup Name Description Normal CommonStates The default state. Disabled CommonStates The control is disabled. InvalidFocused ValidationStates The control is not valid and has focus. InvalidUnfocused ValidationStates The control is not valid and does not he focus. Valid ValidationStates The control is valid. DataGridCell Parts

The DataGridCell element does not he any named parts.

DataGridCell States

The following table lists the visual states for the DataGridCell element.

VisualState Name VisualStateGroup Name Description Normal CommonStates The default state. MouseOver CommonStates The mouse pointer is positioned over the cell. Focused FocusStates The cell has focus. Unfocused FocusStates The cell does not he focus Current CurrentStates The cell is the current cell. Regular CurrentStates The cell is not the current cell. Display InteractionStates The cell is in display mode. Editing InteractionStates The cell is in edit mode. Selected SelectionStates The cell is selected. Unselected SelectionStates The cell is not selected. InvalidFocused ValidationStates The cell is not valid and has focus. InvalidUnfocused ValidationStates The cell is not valid and does not he focus. Valid ValidationStates The cell is valid. DataGridRow Parts

The DataGridRow element does not he any named parts.

DataGridRow States

The following table lists the visual states for the DataGridRow element.

VisualState Name VisualStateGroup Name Description Normal CommonStates The default state. MouseOver CommonStates The mouse pointer is positioned over the row. MouseOver_Editing CommonStates The mouse pointer is positioned over the row and the row is in edit mode. MouseOver_Selected CommonStates The mouse pointer is positioned over the row and the row is selected. MouseOver_Unfocused_Editing CommonStates The mouse pointer is positioned over the row, the row is in edit mode, and does not he focus. MouseOver_Unfocused_Selected CommonStates The mouse pointer is positioned over the row, the row is selected, and does not he focus. Normal_AlternatingRow CommonStates The row is an alternating row. Normal_Editing CommonStates The row is in edit mode. Normal_Selected CommonStates The row is selected. Unfocused_Editing CommonStates The row is in edit mode and does not he focus. Unfocused_Selected CommonStates The row is selected and does not he focus. InvalidFocused ValidationStates The control is not valid and has focus. InvalidUnfocused ValidationStates The control is not valid and does not he focus. Valid ValidationStates The control is valid. DataGridRowHeader Parts

The following table lists the named parts for the DataGridRowHeader element.

Part Type Description PART_TopHeaderGripper Thumb The element that is used to resize the row header from the top. PART_BottomHeaderGripper Thumb The element that is used to resize the row header from the bottom. DataGridRowHeader States

The following table lists the visual states for the DataGridRowHeader element.

VisualState Name VisualStateGroup Name Description Normal CommonStates The default state. MouseOver CommonStates The mouse pointer is positioned over the row. MouseOver_CurrentRow CommonStates The mouse pointer is positioned over the row and the row is the current row. MouseOver_CurrentRow_Selected CommonStates The mouse pointer is positioned over the row, and the row is current and selected. MouseOver_EditingRow CommonStates The mouse pointer is positioned over the row and the row is in edit mode. MouseOver_Selected CommonStates The mouse pointer is positioned over the row and the row is selected. MouseOver_Unfocused_CurrentRow_Selected CommonStates The mouse pointer is positioned over the row, the row is current and selected, and does not he focus. MouseOver_Unfocused_EditingRow CommonStates The mouse pointer is positioned over the row, the row is in edit mode, and does not he focus. MouseOver_Unfocused_Selected CommonStates The mouse pointer is positioned over the row, the row is selected, and does not he focus. Normal_CurrentRow CommonStates The row is the current row. Normal_CurrentRow_Selected CommonStates The row is the current row and is selected. Normal_EditingRow CommonStates The row is in edit mode. Normal_Selected CommonStates The row is selected. Unfocused_CurrentRow_Selected CommonStates The row is the current row, is selected, and does not he focus. Unfocused_EditingRow CommonStates The row is in edit mode and does not he focus. Unfocused_Selected CommonStates The row is selected and does not he focus. InvalidFocused ValidationStates The control is not valid and has focus. InvalidUnfocused ValidationStates The control is not valid and does not he focus. Valid ValidationStates The control is valid. DataGridColumnHeadersPresenter Parts

The following table lists the named parts for the DataGridColumnHeadersPresenter element.

Part Type Description PART_FillerColumnHeader DataGridColumnHeader The placeholder for column headers. DataGridColumnHeadersPresenter States

The following table lists the visual states for the DataGridColumnHeadersPresenter element.

VisualState Name VisualStateGroup Name Description InvalidFocused ValidationStates The cell is not valid and has focus. InvalidUnfocused ValidationStates The cell is not valid and does not he focus. Valid ValidationStates The cell is valid. DataGridColumnHeader Parts

The following table lists the named parts for the DataGridColumnHeader element.

Part Type Description PART_LeftHeaderGripper Thumb The element that is used to resize the column header from the left. PART_RightHeaderGripper Thumb The element that is used to resize the column header from the right. DataGridColumnHeader States

The following table lists the visual states for the DataGridColumnHeader element.

VisualState Name VisualStateGroup Name Description Normal CommonStates The default state. MouseOver CommonStates The mouse pointer is positioned over the control. Pressed CommonStates The control is pressed. SortAscending SortStates The column is sorted in ascending order. SortDescending SortStates The column is sorted in descending order. Unsorted SortStates The column is not sorted. InvalidFocused ValidationStates The control is not valid and has focus. InvalidUnfocused ValidationStates The control is not valid and does not he focus. Valid ValidationStates The control is valid. DataGrid ControlTemplate Example

The following example shows how to define a ControlTemplate for the DataGrid control and its associated types.

The preceding example uses one or more of the following resources.

#FFE8EDF9 #FFC5CBF9 #FF7381F9 #FFE8EDF9 #FFC5CBF9 #FF888888 #FFC5CBF9 #FFDDDDDD White #FF7381F9 #FF211AA9 #FF3843C4 #FF211AA9 #FF444444 sc#1, 0.004391443, 0.002428215, 0.242281124 #FFCCCCCC #FF888888 #FF444444 #FF888888 #FF444444 #FFAAAAAA #FF888888 Black #FFC5CBF9 Black #FFC5CBF9 #FF3843C4

For the complete sample, see Styling with ControlTemplates Sample.

See also Style ControlTemplate Control Styles and Templates Control Customization Styling and Templating Create a template for a control

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至lsinopec@gmail.com举报,一经查实,本站将立刻删除。

上一篇 没有了

下一篇没有了