如果ItemsPresenter是第一个项目,则触发

时间:2012-07-13 09:17:17

标签: wpf triggers styles presenter

我创建了一个新模板。我希望如果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 &#205;}" 
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="1,0,1,1"
                            Height="{StaticResource &#211;}"
                            SnapsToDevicePixels="True">
                    <Border BorderThickness="0,0,0,1" Margin="0,0,0,1" BorderBrush="{StaticResource &#204;}" 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>

            <!-- ... --> 

0 个答案:

没有答案