The requested page is not available for the requested platform. You are viewing the content for Default platform.

ColumnBase.HeaderTemplate Property

Gets or sets the template that defines the column header's presentation. This is a dependency property.

Namespace: DevExpress.UI.Xaml.Grid

Assembly: DevExpress.UI.Xaml.Grid.v19.1.dll

Declaration

public DataTemplate HeaderTemplate { get; set; }
Public Property HeaderTemplate As DataTemplate

Property Value

Type Description
DataTemplate

A DataTemplate object that defines the column header's presentation.

Remarks

The data context for the HeaderTemplate template is the ColumnBase.HeaderCaption property's value.

Examples

This example demonstrates how to display an image within the 'Product Name' column's header.

using System.Collections.ObjectModel;
using Windows.UI.Xaml.Controls;

namespace HeaderImage {
    public sealed partial class MainPage : Page {
        public MainPage() {
            this.InitializeComponent();
            grid.ItemsSource = new ProductList();
        }
        public class Product {
            public string ProductName { get; set; }
            public string Country { get; set; }
            public string City { get; set; }
            public double UnitPrice { get; set; }
            public int Quantity { get; set; }
        }


        public class ProductList : ObservableCollection<Product> {
            public ProductList()
                : base() {
                Add(new Product() { ProductName = "Chang", Country = "UK", City = "Cowes", UnitPrice = 19, Quantity = 10 });
                Add(new Product() { ProductName = "Gravad lax", Country = "Italy", City = "Reggio Emilia", UnitPrice = 12.5, Quantity = 16 });
                Add(new Product() { ProductName = "Ravioli Angelo", Country = "Brazil", City = "Rio de Janeiro", UnitPrice = 19, Quantity = 12 });
                Add(new Product() { ProductName = "Tarte au sucre", Country = "Germany", City = "QUICK-Stop", UnitPrice = 22, Quantity = 50 });
                Add(new Product() { ProductName = "Steeleye Stout", Country = "USA", City = "Reggio Emilia", UnitPrice = 18, Quantity = 20 });
                Add(new Product() { ProductName = "Pavlova", Country = "Austria", City = "Graz", UnitPrice = 21, Quantity = 52 });
                Add(new Product() { ProductName = "Longlife Tofu", Country = "USA", City = "Boise", UnitPrice = 7.75, Quantity = 120 });
                Add(new Product() { ProductName = "Alice Mutton", Country = "Mexico", City = "México D.F.", UnitPrice = 21, Quantity = 15 });
                Add(new Product() { ProductName = "Alice Mutton", Country = "Canada", City = "Tsawwassen", UnitPrice = 44, Quantity = 16 });
            }
        }
    }
}
See Also