Dela via


ListViewBase.Header Property

Definition

Gets or sets the content for the list header.

public:
 property Platform::Object ^ Header { Platform::Object ^ get(); void set(Platform::Object ^ value); };
IInspectable Header();

void Header(IInspectable value);
public object Header { get; set; }
var object = listViewBase.header;
listViewBase.header = object;
Public Property Header As Object
<listViewBase Header="headerString"/>
- or -
<listViewBase>
  <listViewBase.Header>
    headerObject
  </listViewBase.Header>
</listViewBase>

Property Value

Object

Platform::Object

IInspectable

The content of the list header. The default value is null.

Examples

Here's a GridView header that contains a StackPanel with text and an image. This Extensible Application Markup Language (XAML) is a simplified version of the GridView used in GroupDetail page of the Microsoft Visual Studio Grid App template.

<GridView x:Name="itemGridView"
          Margin="0,-14,0,0"
          Padding="120,0,120,50"
          ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
          ItemTemplate="{StaticResource Standard500x130ItemTemplate}">

    <GridView.Header>
        <StackPanel Width="480" Margin="0,4,14,0">
            <TextBlock Text="{Binding Subtitle}" Margin="0,0,18,20" 
                       Style="{StaticResource SubheaderTextStyle}" MaxHeight="60"/>
            <Image Source="{Binding Image}" Height="400" Margin="0,0,18,20" 
                   Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
            <TextBlock Text="{Binding Description}" Margin="0,0,18,0" 
                       Style="{StaticResource BodyTextStyle}"/>
        </StackPanel>
    </GridView.Header>
</GridView>

Remarks

By default, the header is shown at the top for a ListView, and on the left for a GridView. If the FlowDirection property is set to RightToLeft, the header is shown on the right for a GridView.

You can use a data template for the Header by setting the HeaderTemplate property.

Applies to

See also