【问题标题】:How to show complete Expander Grid in wpf?如何在 wpf 中显示完整的扩展器网格?
【发布时间】:2013-08-04 03:12:32
【问题描述】:

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

<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>

【问题讨论】:

标签: c# .net wpf xaml


【解决方案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 个声誉。 :)
【解决方案2】:

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

【讨论】:

  • 不,我希望它的高度是固定的。
  • @ZoyaSheikh 如果 Panel2 具有固定的高度,您如何期望它移动
猜你喜欢
  • 1970-01-01
  • 2013-11-12
  • 2016-05-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-06-20
相关资源
最近更新 更多