我有這樣的控制:WPF電網分流問題
圖片:http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/999d1290-2d69-4cd0-9396-072e765e8364
我將如何添加GridSplitter接近上箭頭,所以當我拖分流下來,橙色管的高度將增加。您只能拖累(最多是不允許的)
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="900">
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="auto" />
<RowDefinition Height="40" />
<RowDefinition Height="auto"/>
<RowDefinition Height="20" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Grid x:Name="arrowLine" Grid.Row="0" Grid.Column="0" Height="20" Width="1" Background="Black"/>
<Polygon Grid.Column="0" Grid.Row="1" Fill="Black" Points="0,-6 10,-6 5,0" FillRule="Nonzero" HorizontalAlignment="Center" />
<!-- The gripper on the Top -->
<StackPanel Grid.Row="2">
<Grid Grid.Column="1" Margin="0,0,0,0" VerticalAlignment="Top" Width="100" Height="40">
<Rectangle x:Name="OrangeBar" Fill="#FFD61D2B">
</Rectangle>
<Rectangle x:Name="OrangeBarShine">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#00000000" Offset="1"/>
<GradientStop Color="#FFFFB141" Offset="0.172"/>
<GradientStop/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
</Grid>
</StackPanel>
<Polygon Grid.Column="0" Grid.Row="3" Fill="Black" Points="0,6 10,6 5,0" FillRule="Nonzero" HorizontalAlignment="Center" />
<Grid Grid.Row="4" Grid.Column="0" Height="20" VerticalAlignment="Center" Width="1" Background="Black"/>
<Line Grid.Row="5" X1="25" Y1="0" X2="50" HorizontalAlignment="Center" Y2="20" StrokeThickness="1" Stroke="Black"></Line>
<Line Grid.Row="5" Grid.Column="1" X1="-25" Y1="20" X2="130" Y2="20" Fill="Black" HorizontalAlignment="Left" StrokeThickness="1" Stroke="Black"></Line>
</Grid>
您在XAML中沒有GridSplitter – Paparazzi