我创建了一个新模板。我希望如果ItemsPresenter是第一个元素,则不会显示它。我会用触发器解决这个问题。但我不知道我指定的条件是什么?
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ribbon:Ribbon}">
<!-- ... -->
<ContentControl x:Name="mainItemsPresenterHost" Grid.ColumnSpan="3" Grid.Row="2" Focusable="False">
<Border x:Name="groupsBorder"
Background="{StaticResource Í}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1,0,1,1"
Height="{StaticResource Ó}"
SnapsToDevicePixels="True">
<Border BorderThickness="0,0,0,1" Margin="0,0,0,1" BorderBrush="{StaticResource Ì}" SnapsToDevicePixels="True">
<ItemsPresenter Name="ItemsPresenter">
<ItemsPresenter.Style>
<Style TargetType="ItemsPresenter">
<Style.Triggers>
<DataTrigger ...><!-- trigger -->
<Setter Property="Visibility" Value="Collapsed"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ItemsPresenter.Style>
</ItemsPresenter>
</Border>
</Border>
</ContentControl>
<!-- ... -->