Articles in this section
Category / Section

How to customize header in the WPF TileViewControl?

1 min read

You can customize header of the TileViewItem by using the Header Template. In the following example, the header is customized by setting the image at the left corner and changing the FontWeight of the Header Text. Different colors are set for the HeaderBackground.

MainWindow.xaml

<Window.Resources>
    <Style x:Key="Tileviewstyle"  TargetType="{x:Type syncfusion:TileViewItem}">
      <Setter Property="HeaderBackground" Value="{Binding Color}"></Setter>
    </Style>
  </Window.Resources>
  <Grid>
    <syncfusion:TileViewControl  x:Name="Tiles"   AllowItemRepositioning="False" ItemContainerStyle="{StaticResource Tileviewstyle}"  ItemsSource="{Binding TileItems}"  >
      <syncfusion:TileViewControl.HeaderTemplate>
        <DataTemplate>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Image Source="book.png" Stretch="Fill" Width="15" Height="15" Margin="0,0,5,0"/>
            <TextBlock FontWeight="Bold" Grid.Column="1" Text="{Binding Header}"  Height="30"></TextBlock>
          </Grid>
        </DataTemplate>
      </syncfusion:TileViewControl.HeaderTemplate>
      <syncfusion:TileViewControl.ItemTemplate>
        <DataTemplate>
          <StackPanel Orientation="Vertical">
            <TextBlock Text="{Binding Description}" Height="30"></TextBlock>
          </StackPanel>
        </DataTemplate>
      </syncfusion:TileViewControl.ItemTemplate>
    </syncfusion:TileViewControl>
  </Grid>

 

MainWindow.xaml.cs

public MainWindow()
            {
                InitializeComponent();
                this.DataContext = new ViewModel();
                           }

 

Model

public class Model
       {
           public string Color { get; set; }
           public string Header { get; set; }
           public string Description { get; set; }
       }

 

ViewModel

public class ViewModel
        {
         public ObservableCollection<Model> TileItems { get; set; }
                    public ViewModel()
            {
                TileItems = new ObservableCollection<Model>();
                TileItems.Add(new Model() { Header = "Item5", Color = "#FF4DAEB5", Description = "TileViewContent1" });
                TileItems.Add(new Model() { Header = "Item2", Color = "#FF36377C", Description = "TileViewContent2" });
                TileItems.Add(new Model() { Header = "Item1", Color = "#FF4DEAB4", Description = "TileViewContent3" });
                TileItems.Add(new Model() { Header = "Item4", Color = "#F4FADEB5", Description = "TileViewContent4" });
            }
        }

 

The following screenshot displays the customized TileViewHeader.

 


customized TileViewHeader in WPF

Conclusion

I hope you enjoyed learning about how to customize header of the TileViewItem in the WPF TileViewControl.

You can refer to our WPF TileViewControl feature tour page to know about its other groundbreaking feature representations documentation and how to quickly get started for configuration specifications.  You can also explore our  WPF TileViewControl example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!



Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied