Fixed maxheight and maxwidth of tileviewitem

4 posts, 0 answers
  1. Nabil Shuhaiber
    Nabil Shuhaiber avatar
    14 posts
    Member since:
    Sep 2009

    Posted 19 Aug 2010 Link to this post

    Is there anyway way to fix the maxheight and maxwidth of a tileviewitem? I don't wan't the tileviewitem to exceed a certain size when resizing.

    Regards,
    Nabil
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 19 Aug 2010 Link to this post

    Hello Nabil Shuhaiber,

    If the RadTileView is data bound you can use an ItemContainerStyle to set the MaxWidth and MaxHeight properties of the RadTileViewItems, like so:
    <Style x:Key="ItemContainerStyle" TargetType="telerik:RadTileViewItem">
        <Setter Property="MaxHeight" Value="200"/>
        <Setter Property="MaxWidth" Value="200"/>
    </Style>

    In any other case you can set those properties to each RadTileViewItem when it's defined.

    I prepared a sample project illustrating the first approach. give it a try and let me know if it works for you or if you need more info.

    Kind regards,
    Tina Stancheva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Nabil Shuhaiber
    Nabil Shuhaiber avatar
    14 posts
    Member since:
    Sep 2009

    Posted 19 Aug 2010 Link to this post

    The problem with this method as you can see in the sample you sent me is the whitespace around the item. Is there any way I can reduce that to the standard tileview defaults?
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 19 Aug 2010 Link to this post

    Hi Nabil Shuhaiber,

    By design the restored RadTileViewItems are evenly displayed in the available space - the space that is set through the Width and Height properties of the RadTileView. Also, the space between the items is set through the Padding property of the RadTileViewItem and in the default RadTileView style its value is 7. Therefore, if you need to modify it, you will need to implicitly define a new value for it.
    <Style x:Key="ItemContainerStyle" TargetType="telerik:RadTileViewItem">
        <Setter Property="MaxHeight" Value="200"/>
        <Setter Property="MaxWidth" Value="200"/>
        <Setter Property="Padding" Value="1"/>
    </Style>

    Also, you can take a look at this blog post that might be helpful as well.

    Sincerely yours,
    Tina Stancheva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top