Expand Minimize

ListViewBase.Header property

Applies to Windows and Windows Phone

Gets or sets the content for the list header.

Syntax


public object Header { get; set; }


<listViewBase Header="headerString"/>



<listViewBase>
  <listViewBase.Header>
    headerObject
  </listViewBase.Header>
</listViewBase>


XAML Values

headerString

A text string that serves as header content.

headerObject

An single object element that serves as header content. Use discretion when using objects as header content; not all objects are suitable for use within the limited presentation surface that appears for headers.

Property value

Type: System.Object [.NET] | Platform::Object [C++]

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

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.

Examples

Here's a GridView header that contains a StackPanel with text and an image. This XAML is a simplified version of the GridView used in GroupDetail page of the 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>


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

ListViewBase
HeaderTemplate
HeaderTransitions
FlowDirection

 

 

Show:
© 2014 Microsoft