Cześć,
chciałbym uzyskać GridSplitter w taki sposób, że pierwsza kolumna ma jedną komórkę, a druga kolumna ma dwie komórki (przykład w załączonym pliku graficznym - zarówno pionowa, jak i pozioma linia z możliwością zmiany rozmiaru). Jak można coś takiego uzyskać?
Spróbowałem z:
<Window x:Class="MT4AnalyzeV2WPF.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">
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<GridSplitter Grid.Row="0">
</GridSplitter>
<GridSplitter Grid.Row="1">
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
</Grid>
</GridSplitter>
</Grid>
</Window>
ale uzyskuję błąd:
The type 'GridSplitter' does not support direct content
Pozdrawiam!
OK, poradziłem sobie z tym tak (bazując na http://wpf.2000things.com/tag/gridsplitter/):
<Window x:Class="MT4AnalyzeV2WPF.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">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!-- Sub-grid on left -->
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Label Content="Left, Row 0" Background="Azure" Grid.Row="0"/>
</Grid>
<!-- Sub-grid on right -->
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Label Content="Right, Row 0" Background="Moccasin" Grid.Row="0"/>
<Label Content="Right, Row 2" Background="Honeydew" Grid.Row="2"/>
<GridSplitter Grid.Row="1" Height="8" Background="DarkSlateBlue"
HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
</Grid>
<!-- Splitter between left/right sub-grids -->
<GridSplitter Grid.Column ="1" Width="8" Background="DarkSlateBlue"
VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
</Grid>
</Window>