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

时间:2013-08-03 11:14:36

标签: c# .net wpf xaml

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

It says I must have 10 Reputations to post an image so here is [link][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>

2 个答案:

答案 0 :(得分: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>

答案 1 :(得分:0)

您应该从Panel1中删除ItemHeight="0.39*"。你正在约束面板高度。