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

Determine row an column of an item

6 Answers 55 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 25 Nov 2009, 11:24 AM

Is there a way to determine the actual position of a RadTileViewItem in a RadTileView? Something like
RadTileView.GetPosition(RadTileViewItem item, out int row, out int column)?

Thanks,
Michael

6 Answers, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 25 Nov 2009, 12:44 PM
Hi Michael,

You can get a TileViewItem's position with the following methods:
Grid.GetColumn()
Grid.GetRow()


Let me know if this helps.

All the best,
Tihomir Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Michael
Top achievements
Rank 1
answered on 26 Nov 2009, 08:31 AM
Hi Tihomir,

sorry, I've just realized that I don't even have a TileViewItem.

In xaml my TileView is defined as

 

 

<telerikNavigation:RadTileView x:Name="RadTileView1" Width="600" Height="300"
MinimizedColumnWidth="150" MinimizedRowHeight="50" MaxColumns="2">

 

 

 

 

   <telerikNavigation:RadTileView.ItemTemplate>

 

      <DataTemplate>

 

         <TextBlock Text="{Binding Path=Description}"/>

 

      </DataTemplate>

 

   </telerikNavigation:RadTileView.ItemTemplate 

 


   <
telerikNavigation:RadTileView.ContentTemplate>  

 

      <DataTemplate>

 

         <Grid>

 

         .........

 

         </Grid>

 

      </DataTemplate>

 

 

 

   </telerikNavigation:RadTileView.ContentTemplate>

 

 

 

 

 

   ......
In the code I do something like

 

   public class Test

 

   { 

      public String Description { get; set; }

 

   }

 


   public
Window1()

   {

      InitializeComponent();

      RadTileView1.ItemsSource =

new ObservableCollection<Test> { new Test() { Description = "111" },

 

                                                                                                           new Test() { Description = "222" } ,

 

                                                                                                          new Test() { Description = "333" } ,

 

 

 

                                                                                                          new Test() { Description = "444" }};

 

 

 

 

 



As a result RadTileView1.Items[0] is not a RadTileViewItem, it is an instance of "Test". How can I tell where a certain "Test"-instance is located in the TileView?

Thanks, Michael
0
Tihomir Petkov
Telerik team
answered on 26 Nov 2009, 11:12 AM
Hello Michael,

In a data-bound ItemsControls you can use the ItemContainerGenerator to get a reference to the dynamically created wrapper (RadTileViewItem in your case). Here is an example:

RadTileViewItem item = myTileView.ItemContainerGenerator.ContainerFromItem(businessObject) as RadTileViewItem;

Please note that the above code will work only after the TileView has been actually rendered on the screen because the RadTileViewItems that wrap your business objects are created only when the control needs to be rendered.

Best wishes,
Tihomir Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Michael
Top achievements
Rank 1
answered on 26 Nov 2009, 11:38 AM
Perfect! Thanks,
Michael
0
Kenneth
Top achievements
Rank 1
answered on 09 Jan 2010, 07:27 PM
I can't find these methods in the radtileviewItem. Is there something missing from this explanation?
0
Tihomir Petkov
Telerik team
answered on 10 Jan 2010, 09:32 PM
Hello Kenneth,

RadTileViewItems do not have an ItemContainerGenerator because they are not ItemsControls, i.e. they are not hierarchical and don't have a collection of items. The code snippet from my last post calls the ItemContainerGenerator of an instance of the RadTileView control, which is an ItemsControl.

Let me know if my explanation doesn't help and you need further details.

Greetings,
Tihomir Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TileView
Asked by
Michael
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
Michael
Top achievements
Rank 1
Kenneth
Top achievements
Rank 1
Share this question
or