6 Answers, 1 is accepted
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.
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
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.
Michael
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.