This is a migrated thread and some comments may be shown as answers.

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

1 Answer 162 Views
TileView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gopi
Top achievements
Rank 1
Gopi asked on 02 Aug 2012, 01:03 PM
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

1 Answer, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 06 Aug 2012, 11:47 AM
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,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TileView
Asked by
Gopi
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Share this question
or