<LabelGrid.Row="0"Grid.Column="0"Width="60"Height="60"HorizontalAlignment="Center"VerticalAlignment="Center"HorizontalContentAlignment="Center"VerticalContentAlignment="Center"Background="HotPink">Row1</Label> <GridSplitterHeight="5"HorizontalAlignment="Stretch"VerticalAlignment="Bottom"></GridSplitter> ...
例如下面的写法是无效的: <StackPanelOrientation="Horizontal"><TextBlockText="LLLLLLLLLLLLLL"/><GridSplitterWidth="10"HorizontalAlignment="Center"VerticalAlignment="Stretch"Background="Wheat"/><TextBlockText="RRRRRRRRRRRRRR"/></StackPanel> 对于左右分割列,必须指定分隔栏GridSplitter的宽度Width,以及设置Ver...
GridSplitter 控件就是用来分割Grid控件的,必须放在Grid里面 示例代码<GridSplitter Grid.Column="1" VerticalAlignment="Stretch" Grid.RowSpan="3" HorizontalAlignment ="Left" Width="5"/>,如下图 <Window x:Class="WPF_Code.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xm...
<GridSplitter Grid.Column="1" Grid.Row="1" Height="3" VerticalAlignment="Center" HorizontalAlignment="Stretch" ResizeDirection="Rows" Opacity="0" /> <Border Grid.Column="1" Grid.Row="2" Margin="0,0,0,3" BorderBrush="#FFACACAC" BorderThickness="1" > <ScrollViewer HorizontalScrollBarVi...
Orientation="Horizontal"时各控件从左至右罗列,当面板长度不够时,子控件就会自动换行,继续按照从左至右的顺序排列。 Orientation=" Vertical"时各控件从上至下罗列,当面板高度不够时,子控件就会自动换列,继续按照从上至下的顺序排列。 示例: <WrapPanel Orientation="Horizontal"> ...
<GridSplitter Height="6" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Row="2" Grid.Column="2"></GridSplitter> 1. 使用GridSplit控件结合Grid控件实现类似于WinForm中SplitContainer的功能,这个大家在WinForm当中经常用到,我们也不多做介绍。
常用面板里只记录一下GridSplitter(实际不是Panel类),Grid中可以通过GridSplitter交互改变行列尺寸,哪个单元格尺寸会被影响取决于GridSplitter的对齐值HorizontalAlignment(默认是Right)和VerticalAlignment(默认是Stretch),《WPF揭秘》里有张图,贴在这里,另外ResizeDirection和ResizeBehavior属性也会影响GridSplitter改变单元格尺寸的...
<GridSplitter Width="5" Loaded="TreeViewItem_Loaded"></GridSplitter> <TreeView FontSize="14" Grid.Row="0" Grid.Column="0" Margin="0,0,5,0" Name="trvList" Loaded="TreeViewItem_Loaded"> </TreeView> <Label Background="LightGreen" VerticalContentAlignment="Center" HorizontalContentAlignment...
布局: Border、 BulletDecorator、 Canvas、 DockPanel、 Expander、 Grid、 GridView、 GridSplitter、 GroupBox、 Panel、 ResizeGrip、 Separator、 ScrollBar、 ScrollViewer、 StackPanel、 Thumb、 Viewbox、 VirtualizingStackPanel、 Window和WrapPanel。 媒体: Image、 MediaElement和SoundPlayerAction。 菜单: ContextMen...
Column="1" Fill="Red"/> <GridSplitter Grid.Column="1" Width="5"/> <Rectangle MinWidth="20" Height="100" Grid.Column="2" Fill="Yellow"/> <Rectangle MinWidth="20" Height="100" Grid.Column="3" Fill="Green"/> </Grid> 2.5 统一面板 (UniformGrid) UniformGrid 将其内部所有元素按当前...