GridViewHeaderRowPresenter Class
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
[StyleTypedPropertyAttribute(Property="ColumnHeaderContainerStyle", StyleTargetType=typeof(GridViewColumnHeader))] public class GridViewHeaderRowPresenter : GridViewRowPresenterBase
/** @attribute StyleTypedPropertyAttribute(Property="ColumnHeaderContainerStyle", StyleTargetType=System.Windows.Controls.GridViewColumnHeader) */ public class GridViewHeaderRowPresenter extends GridViewRowPresenterBase
StyleTypedPropertyAttribute(Property="ColumnHeaderContainerStyle", StyleTargetType=System.Windows.Controls.GridViewColumnHeader) public class GridViewHeaderRowPresenter extends GridViewRowPresenterBase
<GridViewHeaderRowPresenter .../>
This GridViewRowPresenter object and GridViewHeaderRowPresenter objects are support objects for the GridView View mode that displays data in columns for a ListView. For more information about how to define a GridView view, see the GridView Overview.
You can determine when a column is moving to a new location by monitoring the CollectionChanged event that is defined for the GridViewColumnCollection.
You can customize column headers in a GridView view mode by using a variety of properties that are found in this class and in related classes. For more information about these properties, and about the precedence between them, see GridView Column Header Styles and Templates Overview.
This example shows how to use the GridViewRowPresenter and GridViewHeaderRowPresenter objects to display data in columns.
The following example shows how to specify a GridViewColumnCollection that displays the DayOfWeek and Year of a DateTime object by using GridViewRowPresenter and GridViewHeaderRowPresenter objects. The example also defines a Style for the Header of a GridViewColumn.
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:sys="clr-namespace:System;assembly=mscorlib"> <Window.Resources> <Style x:Key="MyHeaderStyle" TargetType="{x:Type GridViewColumnHeader}"> <Setter Property="Background" Value="BurlyWood"/> </Style> <GridViewColumnCollection x:Key="gvcc"> <GridViewColumn Header="Year" DisplayMemberBinding="{Binding Year}" Width="80"/> <GridViewColumn Header="Day" DisplayMemberBinding="{Binding DayOfWeek}" Width="80" /> </GridViewColumnCollection> </Window.Resources> <StackPanel> <GridViewHeaderRowPresenter Name="hrp" Columns="{StaticResource gvcc}" ColumnHeaderContainerStyle= "{StaticResource MyHeaderStyle}" /> <GridViewRowPresenter Columns="{StaticResource gvcc}" > <GridViewRowPresenter.Content> <sys:DateTime>2005/2/1</sys:DateTime> </GridViewRowPresenter.Content> </GridViewRowPresenter> <GridViewRowPresenter Columns="{StaticResource gvcc}" > <GridViewRowPresenter.Content> <sys:DateTime>2006/10/12</sys:DateTime> </GridViewRowPresenter.Content> </GridViewRowPresenter> </StackPanel> </Window>
More Code
| How to: Create a Style for a Dragged GridView Column Header | This example shows how to change the appearance of a dragged GridViewColumnHeader when the user changes the position of a column. |
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Media.Visual
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Primitives.GridViewRowPresenterBase
System.Windows.Controls.GridViewHeaderRowPresenter
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.