RadTileView databinding and TileViewItem state

4 posts, 0 answers
  1. Qaiser
    Qaiser avatar
    7 posts
    Member since:
    Jun 2010

    Posted 23 Jul 2010 Link to this post

    Hi, 

    I am using RadTileView with all the tiles generated using databinding with ViewModel. To make sure all the tiles are of a certain minimum size each time I add/remove Tiles in ViewModel I calculate the total minimum size based on number of items and update my viewmodel property which is bound to RadTileView MinHeight and MinWidth properties. 

    Everything is working fine but I am a little stuck in one area. As my RadTileView's MinWidth and MinHeight are bound to ViewModel when user Maximize one of the tiles if there are too many tiles the maximized Tile is way too large. What I want is a workaround so when a single Tile is maximized I reset my ViewModel's MinWidth and MinHeight to a reasonable size to make sure maximized tile look usable. 

    I've tried hooking into event TilesStateChanged or TileStateChanged but due to binding I can't enumerate the RadtileViewItems and take appropriate action. 

    Any suggestion will be welcome. 

    Qaiser.

  2. Qaiser
    Qaiser avatar
    7 posts
    Member since:
    Jun 2010

    Posted 23 Jul 2010 Link to this post

    I seem to find a workaround(a bad one I guess). I have hooked in to TilesStateChanged in view's code behind and check if maximizedItem is null or not. If null I assume no tile is maximized so I calculate my TileViews minWidht/minHeight and otherwise I set them to a reasonable hardcoded value.

    Also there seems to be a problem with TileView, if I change MinWidth/MinHeight on TileStateChanged event the TileView doesn't render tiles properly (they seem to overlap each other). To avoid that I start a timer and with half a second delay I run my code to set minwidth/minheight code.

    I appreciate if someone can suggest a better solution.

    Regards, 

    Qaiser.

     

  3. DevCraft banner
  4. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 28 Jul 2010 Link to this post

    Hi Qaiser,

    In your first post you said that you cannot enumerate through the TileViewItems since your TileView is data-bound. Actually, if you subscribe to the TilesStateChanged you can enumerate the TileViewItems in the following manner:

    for(int i = 0; i < this.tileView1.Items.Count; i++)
    {
        // get the TileViewItem container
        RadTileViewItem tileViewItem = this.tileView1.ItemContainerGenerator.ContainerFromIndex(i) as RadTileViewItem;
        // apply additional logic to the container
    }

    As for your other issue:

    if I change MinWidth/MinHeight on TileStateChanged event the TileView doesn't render tiles properly (they seem to overlap each other).

    Try calling RadTileView's public method UpdateItemsSizeAndPosition() after you have set the MinWidth and MinHeight properties. See if it will help.

    If nothing I've said does not help, could you please send us a project reproducing the issues. This way we will be better able to assist you.

    Sincerely yours,
    Kiril Stanoev
    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
  5. Qaiser
    Qaiser avatar
    7 posts
    Member since:
    Jun 2010

    Posted 29 Jul 2010 Link to this post

    Thanks Kiril,

    Both methods work. I've chosen first solution as it better suits my situation.

    Regards,

    Qaiser.
Back to Top