列内容和GridSplitter的问题

时间:2016-04-19 01:22:01

标签: wpf

如何设置第1列或第5列的内容宽度,仍然可以让分割器正常工作?

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:Infinity.Shell.Controls.Text;assembly=Infinity.Shell"
    xmlns:dock="clr-namespace:Infinity.Shell.Controls.Docking;assembly=Infinity.Shell"
    xmlns:syncfusion="http://schemas.syncfusion.com/wpf" x:Class="Infinity.MainWindow"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="499.573" Background="#FF1E1E1E">
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>

    <Button Content="First" Grid.Column="0"/>
    <GridSplitter Grid.Column="1" Width="5" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
    <Button Content="Second" Grid.Column="2"/>
    <GridSplitter Grid.Column="3" Width="5" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
    <Button Grid.Column="4" Content="Third"/>
</Grid>

0 个答案:

没有答案