次の方法で共有


GroupItem styles and templates

[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]

This topic describes the styles and templates for the GroupItem control. You can modify these resources and the default ControlTemplate to give the control a unique appearance.

Visual states

The GroupItem default style doesn't define any visual states.

Theme resources

The GroupItem default style doesn't use any theme resources.

For more info on theme resources, including the values that are used for the HighContrast theme, see XAML theme resources reference.

Default style

<!-- Default style for Windows.UI.Xaml.Controls.GroupItem -->
<Style TargetType="GroupItem">
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="GroupItem">
                <Border Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <ContentControl x:Name="HeaderContent"
                                        Content="{TemplateBinding Content}"
                                        ContentTransitions="{TemplateBinding ContentTransitions}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                        ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                        Margin="{TemplateBinding Padding}"
                                        TabIndex="0"
                                        IsTabStop="False" />
                        <ItemsControl x:Name="ItemsControl"
                                      Grid.Row="1"
                                      ItemsSource="{Binding GroupItems}"
                                      IsTabStop="False"
                                      TabNavigation="Once"
                                      TabIndex="1" >
                            <ItemsControl.ItemContainerTransitions>
                                <TransitionCollection>
                                    <AddDeleteThemeTransition />
                                    <ContentThemeTransition />
                                    <ReorderThemeTransition />
                                    <EntranceThemeTransition IsStaggeringEnabled="False" />
                                </TransitionCollection>
                            </ItemsControl.ItemContainerTransitions>
                        </ItemsControl>
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>