Determine row an column of an item

7 posts, 0 answers
  1. Michael
    Michael avatar
    34 posts
    Member since:
    Oct 2009

    Posted 25 Nov 2009 Link to this post

    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

  2. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 25 Nov 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Michael
    Michael avatar
    34 posts
    Member since:
    Oct 2009

    Posted 26 Nov 2009 Link to this post

    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
  5. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 26 Nov 2009 Link to this post

    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.
  6. Michael
    Michael avatar
    34 posts
    Member since:
    Oct 2009

    Posted 26 Nov 2009 Link to this post

    Perfect! Thanks,
    Michael
  7. Kenneth
    Kenneth avatar
    70 posts
    Member since:
    Feb 2008

    Posted 09 Jan 2010 Link to this post

    I can't find these methods in the radtileviewItem. Is there something missing from this explanation?
  8. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 10 Jan 2010 Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready