Articles in this section
Category / Section

How to set the width and the height in WPF TileViewControl?

1 min read

This article describes how to set height and width for all items while loading more items in TileViewControl.

RowHeight and ColumnWidth

Set the height and width for items using "RowHeight" and "ColumnWidth" properties of TileViewControl.

In the following code example 200 items are added to TileViewControl. All the items are created in equal size.

XAML

<Window x:Class="TileViewControl_Sizing.MainWindow"        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:TileViewControl_Sizing"
        mc:Ignorable="d" xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
        Title="TileViewControl Equal Size" Height="350" Width="525">
    <Grid>
        <syncfusion:TileViewControl RowHeight="100" ColumnWidth="150" 
                                    HorizontalScrollBarVisibility="Auto"                                    VerticalScrollBarVisibility="Auto"                                    ItemsSource="{Binding Collection}">
            <syncfusion:TileViewControl.ItemContainerStyle>
                <Style TargetType="{x:Type syncfusion:TileViewItem}">
                    <Setter Property="Header" Value="{Binding Header}" />
                    <Setter Property="Content" Value="{Binding Content}"/>
                </Style>
            </syncfusion:TileViewControl.ItemContainerStyle>
        </syncfusion:TileViewControl>
    </Grid>
</Window>

 

C#

public partial class MainWindow : Window
    {
        public ObservableCollection<Model> Collection
        {
            get;
            set;
        }
 
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;
            PopulateCollection();
        }
        private void PopulateCollection()
        {
            Collection = new ObservableCollection<Model>();
            for (int i = 1; i <= 200; i++)
                Collection.Add(new Model() { Header = "TilViewItem " + i, Content = "Content" });
        }       
    }
    public class Model
    {
        public string Header { get; set; }
        public string Content { get; set; }
    }

 

The following screenshot illustrates the output of the above code example

Output of code example in WPF TileViewControl


Conclusion

I hope you enjoyed learning about how to to maintain group expanded states in WPF DataGrid.

You can refer to our WPF TileView feature tour  page to know about its other groundbreaking feature representations. You can also explore our WPF TileView documentation 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