Principles of using GridSplitter in WPF

Principles of using GridSplitter in WPF

  1. GridSplitterObjects must be placed in Grid cells. A row or column can be reserved Heightor Widthset to auto.
  2. GridSplitterObjects always change the size of the entire row or column. To make the object look and behave consistent, you need to stretch the GridSplitterobject across the entire row or column instead of confining it to the cell. You can set RowSpanor ColumnSpanproperties.
  3. Initially, GridSplitterthe object is small and hard to see. To make it more usable, you need to set a minimum size for it. For the vertical splitter, you need to set the VerticalAlignmentproperty to Stretch(make the splitter fill the entire height of the area), and Widthset it to a fixed value ( Such as 10 device-independent units), set HorizontalAlignmentthe property for the horizontal splitter to stretch.
  4. When declaring GridSplitterthe object, ShowsPreviewset the property to false, so when the splitter is dragged from side to side, it immediately changes the size of the column, but if set tureto , when dragging the splitter, you will see a gray The shadow of follows the mouse pointer to show where the split will occur.
<GridSplitter Grid.Column="1" Grid.RowSpan="2" Width="3"  
	HorizontalAlignment="Center" VerticalAlignment="Stretch" ShowsPreview="False"/>

Guess you like

Origin blog.csdn.net/weixin_47410172/article/details/132323560