<local:LayoutTemplateSelector Content="{Binding}">
<local:LayoutTemplateSelector.VerticalLeftRight>
<DataTemplate>
<Grid ShowGridLines="True" Background="Orange" Height="{Binding Height}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".25*"/>
<ColumnDefinition Width="10" />
<ColumnDefinition Width=".70*"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Content="Test" Width="{Binding ChartWidth}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
<sdk:GridSplitter Grid.Column="1" ShowsPreview="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
<Button Content="Testing" Width="{Binding SectionWidth}" Grid.Column="2"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
</Grid>
</DataTemplate>
</local:LayoutTemplateSelector.VerticalLeftRight>
</local:LayoutTemplateSelector>
答案 0 :(得分:1)
您需要为第一列使用固定宽度,为剩下的一列使用星号。
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" MinWidth="50" MaxWidth="250"/>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
为第一列设置最小值和最大值通常是一个好主意(但不是必需的),以使其看起来合理。