How to get the Rad Tile View Item Positions at run time

2 posts, 0 answers
  1. Gopi
    Gopi avatar
    8 posts
    Member since:
    Apr 2012

    Posted 02 Aug 2012 Link to this post

    Hi Support Team,

    I am using RadTileView control & MVVM to setup the Rad Tiles via binding. 

    I have these issues 

    1. I am trying to store the each tile view item position before closing my application, so that on next load i can use the same position for the tiles via binding.

    2. Is there any way to iterate the RadTileViewItems inside a RadTile View ?? [when i try to use the following code am getting unable to cast databound object to RadTileView Item], the item is pointing to the data item i have assigned the source.

    foreach(RadTileViewItem item in radTileView.Items)
         currentposition = item.Position;

    any quick help would be greatly appreciated. Since this is straight forward question i haven;t attached any application. 

    Thanks in advance.

    Gopi V
  2. Zarko
    Zarko avatar
    755 posts

    Posted 06 Aug 2012 Link to this post

    Hello Gopi,
    The problem is that you've bound the ItemsSource of the RadTileView to a collection of business items and this means that in the Items collection of the TileView you'll have those business items not their containers.
    To get the containers you'll have to do something like this:
    foreach (var item in this.radTileView.Items)
        var container = this.radTileView.ItemContainerGenerator.ContainerFromItem(item) as RadTileViewItem;
        if (container != null)
            int currentposition = container.Position;
    And if you've bound the position of the containers to a property in your business items why don't you go through the business items and save their property?
    If you have further questions please feel free to ask.

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top