如何在WPF中显示完整的Expander Grid?

3
我使用Expander在Devexpress DockPanel中显示了几个项目,但当我点击它时,它只显示了网格的一半。如何在将panle2移至下方以显示完整的Expander-Grid时显示完整的网格?以下是代码和屏幕截图:

因为我的声望必须达到10才能发布图片,所以这里是[链结][1]

<Grid>
    <dxdo:DockLayoutManager>
        <dxdo:LayoutGroup Caption="LayoutRoot" Orientation="Vertical">
            <dxdo:LayoutPanel Caption="Panel1" ItemWidth="0.96*" ItemHeight="0.39*">
                <Grid>
                    <Label Content="Label" HorizontalAlignment="Left" Height="0" Margin="286,28,0,0" VerticalAlignment="Top" Width="15"/>
                    <Expander Header="Expander" HorizontalAlignment="Left" Margin="2,0,0,0" VerticalAlignment="Top">
                        <Grid Background="#FFE5E5E5" Width="756" Height="59">
                            <Label Content="Label" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="55"/>
                            <ComboBox HorizontalAlignment="Left" Height="13" Margin="99,23,0,0" VerticalAlignment="Top" Width="586"/>    
                        </Grid>
                    </Expander>
                </Grid>
            </dxdo:LayoutPanel>
            <dxdo:LayoutPanel Caption="Panel2" ItemWidth="1.04*" ItemHeight="1.61*"/>
    </dxdo:LayoutGroup>
</dxdo:DockLayoutManager>

它说我必须拥有10个声望才能发布图片,所以这里是图片的链接http://i.stack.imgur.com/lqW4U.png。 - Zoya Sheikh
2个回答

1
从基础开始
<Window x:Class="ExpanderSimple.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.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Expander Grid.Row="0" Name="myExpander" Background="Tan" BorderBrush="Red" BorderThickness="2"
          HorizontalAlignment="Left" VerticalAlignment="Bottom" Header="My Expander" 
          ExpandDirection="Up" IsExpanded="False" Width="auto" >
            <TextBlock TextWrapping="Wrap">
    Lorem ipsum dolor sit amet, consectetur
    adipisicing elit, sed do eiusmod tempor incididunt ut
    labore et dolore magna aliqua
            </TextBlock>
        </Expander>
        <Border Grid.Row="2" BorderBrush="Blue" BorderThickness="5" Margin="2"/>
    </Grid>
</Window>

非常感谢Blam! :) 我想为这个答案投票,但它说投票需要至少10个声望。 :) - Zoya Sheikh

0

你应该从Panel1中删除ItemHeight="0.39*"。这会限制面板的高度。


不,我希望它的高度固定。 - Zoya Sheikh
@ZoyaSheikh 如果Panel2的高度固定,你希望它如何移动呢? - paparazzo

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接