简体   繁体   中英

How to make expander's height full

I need a way to expand "Expander 2" to its fullest like second capture. 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. I also shared my XAML file. 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.

捕获

捕获

捕获 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.

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

See in the Expander2's section:

<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. Your tab has no Grid.Row or Grid.Column assigned so by default it will go to Row=0, Column=0.

Change that Grid Row Height to * in here too and Find a reason why you have 2 columns

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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