简体   繁体   English

如何使扩展器的高度变满

[英]How to make expander's height full

I need a way to expand "Expander 2" to its fullest like second capture.我需要一种方法来像第二次捕获一样将“Expander 2”扩展到最大程度。 When i am trying to put tab component in an expander i can not make it full view.当我试图将选项卡组件放在扩展器中时,我无法使其全视图。 When i am trying to arrange expander's height from inside of Visual Studio again it does not allow me.当我再次尝试从 Visual Studio 内部安排扩展器的高度时,它不允许我。 I also shared my XAML file.我还分享了我的XAML文件。 Could you show me a way for it ?你能告诉我一个方法吗?

Edit: After i changed Height="*" there is still a problem which this time my tab component not correlate with expander's height.编辑:在我更改 Height="*" 后,仍然存在一个问题,这次我的选项卡组件与扩展器的高度不相关。

捕获

捕获

捕获 3


<sc:UItemEditScreen> 
<Grid> 
  <Grid.RowDefinitions> 
    <RowDefinition Height="Auto" /> 
    <RowDefinition Height="*" /> 
  </Grid.RowDefinitions> 
  <ucs:UExpander IsAddButtonVisible="False" IsRemoveButtonVisible="False" AddCommand="{x:Null}" RemoveCommand="{x:Null}" AddCommandParameter="{x:Null}" RemoveCommandParameter="{x:Null}" Caption="Expander 1" IsCaptionVisible="True" CaptionTextVerticalAlignment="Top" AccessMode="Editable" BehaviourType="None" IsRequiredForSave="False" IsRequiredForRead="False" Visibility="Visible" ManageChildren="False" Foreground="#FF565151" FontFamily="Segoe UI" FontSize="11"> 
    <Grid> 
      <Grid.ColumnDefinitions> 
        <ColumnDefinition Width="310" /> 
        <ColumnDefinition Width="310" /> 
      </Grid.ColumnDefinitions> 
      <Grid.RowDefinitions> 
        <RowDefinition Height="Auto" /> 
      </Grid.RowDefinitions> 
      <ucs:UTextBox IsDialogEnabled="True" IsRequiredForSave="True" BehaviourType="Entry" /> 
    </Grid> 
  </ucs:UExpander> 
  <ucs:UExpander IsAddButtonVisible="False" IsRemoveButtonVisible="False" AddCommand="{x:Null}" RemoveCommand="{x:Null}" AddCommandParameter="{x:Null}" RemoveCommandParameter="{x:Null}" Caption="Expander 2" IsCaptionVisible="True" CaptionTextVerticalAlignment="Top" AccessMode="Editable" BehaviourType="None" IsRequiredForSave="False" IsRequiredForRead="False" Visibility="Visible" ManageChildren="False" Foreground="#FF565151" FontFamily="Segoe UI" FontSize="11" Grid.Row="1"> 
    <Grid> 
      <Grid.ColumnDefinitions> 
        <ColumnDefinition Width="310" /> 
        <ColumnDefinition Width="310" /> 
      </Grid.ColumnDefinitions> 
      <Grid.RowDefinitions> 
        <RowDefinition Height="Auto" /> 
      </Grid.RowDefinitions> 
      <ucs:UTab> 
        <ucs:UTab.Items> 
          <ucs:UTabItemsCollection> 
            <ucs:UTabItem Header="Tab 1" ToolTipService.ShowOnDisabled="True"> 
              <ucs:UTabItem.HeaderForeground> 
                <Binding Path="IsSelected"> 
                  <Binding.Converter> 
                    <dx:BoolToObjectConverter> 
                      <dx:BoolToObjectConverter.TrueValue> 
                        <SolidColorBrush Color="{Binding Path=RibbonSelectedTitleForeground.Color, Mode=OneWay}" /> 
                      </dx:BoolToObjectConverter.TrueValue> 
                      <dx:BoolToObjectConverter.FalseValue> 
                        <SolidColorBrush Color="{Binding Path=RibbonUnselectedTitleForeground.Color, Mode=OneWay}" /> 
                      </dx:BoolToObjectConverter.FalseValue> 
                    </dx:BoolToObjectConverter> 
                  </Binding.Converter> 
                </Binding> 
              </ucs:UTabItem.HeaderForeground> 
              <Grid /> 
            </ucs:UTabItem> 
            <ucs:UTabItem Header="Tab 2" ToolTipService.ShowOnDisabled="True"> 
              <ucs:UTabItem.HeaderForeground> 
                <Binding Path="IsSelected"> 
                  <Binding.Converter> 
                    <dx:BoolToObjectConverter> 
                      <dx:BoolToObjectConverter.TrueValue> 
                        <SolidColorBrush Color="{Binding Path=RibbonSelectedTitleForeground.Color, Mode=OneWay}" /> 
                      </dx:BoolToObjectConverter.TrueValue> 
                      <dx:BoolToObjectConverter.FalseValue> 
                        <SolidColorBrush Color="{Binding Path=RibbonUnselectedTitleForeground.Color, Mode=OneWay}" /> 
                      </dx:BoolToObjectConverter.FalseValue> 
                    </dx:BoolToObjectConverter> 
                  </Binding.Converter> 
                </Binding> 
              </ucs:UTabItem.HeaderForeground> 
              <Grid /> 
            </ucs:UTabItem> 
          </ucs:UTabItemsCollection> 
        </ucs:UTab.Items> 
      </ucs:UTab> 
    </Grid> 
  </ucs:UExpander> 
</Grid> 
</sc:UItemEditScreen> 



Set RowDefinition Height = * for Second Row where Expander2 will sit.将 RowDefinition Height = * 设置为 Expander2 所在的第二行。

<sc:UItemEditScreen> 
  <Grid> 
    <Grid.RowDefinitions> 
      <RowDefinition Height="Auto" /> 
      <RowDefinition Height="*" /> <----- This means rest of the space will be taken
    </Grid.RowDefinitions> 

</Grid> 

Update:更新:

Your Xaml is weird compared to what you are trying to achive.与您要实现的目标相比,您的 Xaml 很奇怪。

See in the Expander2's section:请参阅 Expander2 的部分:

<ucs:UExpander Grid.Row="1"> 
    <Grid> 
      <Grid.ColumnDefinitions> 
        <ColumnDefinition Width="310" /> 
        <ColumnDefinition Width="310" />  <---- Why fixed width columns an also why 2 of them
      </Grid.ColumnDefinitions> 
      <Grid.RowDefinitions> 
        <RowDefinition Height="Auto" />  <--- This should be *
      </Grid.RowDefinitions> 

You have 2 Columns each 310 pixel wide and one row with Auto Height.您有 2 列,每列 310 像素宽,一行具有自动高度。 Your tab has no Grid.Row or Grid.Column assigned so by default it will go to Row=0, Column=0.您的选项卡没有分配 Grid.Row 或 Grid.Column,因此默认情况下它将转到 Row=0, Column=0。

Change that Grid Row Height to * in here too and Find a reason why you have 2 columns在此处也将该网格行高更改为 * 并找出您有 2 列的原因

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM