我需要在使用gridsplitter调整网格列的大小时放置一个事件.
我尝试在受影响的列上使用’sizeChanged’事件.但它不起作用
请告诉我该怎么做
谢谢 最佳答案 我对列中的内容使用SizeChanged事件.
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="leftColumn" MinWidth="268" Width="268*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition x:Name="centerColumn" MinWidth="327" Width="327*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition x:Name="rightColumn" MinWidth="393" Width="393*"/>
</Grid.ColumnDefinitions>
<custom:Control x:Name="panel1" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,0,0,5" SizeChanged="PanelSizeChanged"/>
<GridSplitter Grid.Column="1" Background="#00000000" HorizontalAlignment="Center" VerticalAlignment="Stretch" ResizeBehavior="PreviousAndNext" Width="5" ResizeDirection="Columns"/>
<custom:Control x:Name="panel2" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,0,0,5" SizeChanged="PanelSizeChanged"/>
<GridSplitter Grid.Column="3" Background="#00000000" HorizontalAlignment="Center" VerticalAlignment="Stretch" ResizeBehavior="PreviousAndNext" Width="5" ResizeDirection="Columns"/>
<custom:Control x:Name="panel2" Grid.Column="4" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,0,0,5" SizeChanged="PanelSizeChanged"/>
</Grid>
我在一个回调PanelSizeChanged中管理我需要的所有大小更改内容.您当然可以为每列使用不同的处理程序.