我需要一种将“扩展器2”扩展到最大程度的功能,例如第二次捕获。当我尝试将选项卡组件放在扩展器中时,我无法将其完整显示。当我再次尝试从Visual Studio内部安排扩展器的高度时,它不允许我使用。我还共享了我的XAML
文件。你能告诉我一种方法吗?
编辑:我更改了Height =“ *”之后,仍然存在一个问题,这次我的选项卡组件与扩展器的高度不相关。
<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>
答案 0 :(得分:1)
为Expander2所在的第二行设置RowDefinition Height = *。
<sc:UItemEditScreen>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <----- This means rest of the space will be taken
</Grid.RowDefinitions>
</Grid>
更新:
与您要达到的目标相比,您的Xaml很奇怪。
请参阅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>
您有2列,每列310像素宽,一行具有“自动高度”。 您的标签没有分配Grid.Row或Grid.Column,因此默认情况下它将转到Row = 0,Column = 0。
在此处也将“网格行高”也更改为*,并找出具有两列的原因