2012-10-05 31 views
0

我有這樣的控制:WPF電網分流問題

圖片:http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/999d1290-2d69-4cd0-9396-072e765e8364

enter image description here

我將如何添加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> 

+0

您在XAML中沒有GridSplitter – Paparazzi

回答

0

如果你想這樣做不動杆的頂部位置,這是一個壞主意。即使您可以使其工作,拖動也是基於三角洲。只是一點點拖拽就會導致酒吧突然變得比屏幕大。

如果要調整大小並同時以相同的數量移動其位置,請考慮將小節上方的單元格和小節高度綁定在一起。

考慮將分離器移動到杆下方。然後每當條的高度發生變化時,將條上的最小高度設置爲高度。

0

使它從底部變大會出現什麼問題?

<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="40" />    
     <RowDefinition Height="*" /> 
     <RowDefinition Height="Auto" /> 
     <RowDefinition Height="*" /> 
    </Grid.RowDefinitions> 
    <StackPanel Grid.Row="0" Background="White"/>  
    <StackPanel Grid.Row="1" Grid.Column="0" Background="Orange"/> 
    <GridSplitter Grid.Row="2" 
     HorizontalAlignment="Stretch" 
     VerticalAlignment="Center" 
     Background="White" 
     ShowsPreview="True" 
     Height="5"/> 
    <StackPanel Grid.Row="3" Grid.Column="1" Background="White"/> 
</Grid>