文笔不好,将就看代码吧,非常简单的一个实现,左右两个Grid加了颜色为了更方便看到效果。
<Window x:Class="exSplitter.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <!--GridSplitter样式--> <Style x:Key="GridSplitterPreviewStyle"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <Rectangle Fill="#80000000"/> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="GridSplitterSt