Parentrow problem

8 posts, 0 answers
  1. allyk
    allyk avatar
    13 posts
    Member since:
    Feb 2007

    Posted 21 Jun 2011 Link to this post

    Hi,
     I generate my row like this:

    Telerik.Windows.Controls.TreeListView.

     

    TreeListViewRow row = (Telerik.Windows.Controls.TreeListView.TreeListViewRow)radTreeListView1.ItemContainerGenerator.ContainerFromItem(radTreeListView1.SelectedItem);

    If I see parent row on the screen, I can reach row.ParentRow but if I don't see parent row on the screen
    row.ParentRow is null.

    How can I handle this?
    Thanks.

     

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 21 Jun 2011 Link to this post

    Hi allyk,

    That would be the expected behavior due to the fact that the virtualization of the RadTreeListView is turned on by default. This means that only the visible visual elements are created and on scrolling they are recycled and reused. Generally, the recommended way is to work directly with the underlying data item (by Items collection for example). 
    May you share what is the scenario that you want to accomplish ? Why do you need to work with the rows, instead of the items ? 
     

    Kind regards,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. allyk
    allyk avatar
    13 posts
    Member since:
    Feb 2007

    Posted 21 Jun 2011 Link to this post

    Hi,
    Thank you for your reply.
    I am not sure how I can take the parent item from underlying data.
    I can reach child items  like this (MyClass)treelistView1.SelectedItem).Items, But how can I reach parent Item? Should I  have a reference back to its parent class?

    Thanks.
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 22 Jun 2011 Link to this post

    Hi allyk,

    Basically, you may use the connection between the parent item and its children. May you provide a bit more details what is the implementation of the two business objects ? Do you have an exposed property connecting them ? 
     

    Greetings,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. allyk
    allyk avatar
    13 posts
    Member since:
    Feb 2007

    Posted 22 Jun 2011 Link to this post

    Hi,
    My implementation is similar sample classes below.

    public class Level0_0
    {
            public string Level0{ get; set; }
            public ObservableCollection<Level1> Items { get; set; }
     }

    public class Level0_1
    {
            public string Level1{ get; set; }
            public ObservableCollection<Level2> Items { get; set; }
            public Level0 ParentItem { get; set; }
         
    }

    public class Level0_2
    {
            public string Level2{ get; set; }
            public ObservableCollection<Level3> Items { get; set; }
            public Level1 ParentItem { get; set; }
         
    }

     

    My problem is Level0_2 is shared object. For example Level1_1 object also have Level0_2 object. So I overrite ParentItem. 

    I have to take the root element of the selected item. Is there any way to turn off virtualization?

    Thanks

  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 27 Jun 2011 Link to this post

    Hi allyk,

    Based on the code-snippet provided, I get the impression that you may use the ParentItem property of the business object. Am I right or am I missing something ?
    Considering turning off the virtualization, you may set the EnableColumnVirtualization/ EnableRowVirtualization properties of the RadGridView to false. However, if you handle a lot of data, this might lead to some performance issues.
     

    Greetings,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. allyk
    allyk avatar
    13 posts
    Member since:
    Feb 2007

    Posted 28 Jun 2011 Link to this post

    Hi,
    Yes, I can use ParentItem. But my problem occurs when I used shared objects as I mentioned. For example I have shared static object Level0_2 then it has two parents:Level0_0 and Level1_0. When I select the Level0_2 item I can't use ParentItem property. Because of this I want to use ParentRow.
    Level0_0
         Level0_1
         Level0_2
    Level1_0
         Level1_1
         Level0_2
  9. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 30 Jun 2011 Link to this post

    Hello Allyk,

    The only way for getting the parent item to handle it at data level. As the structure of the TreeListView is a flat one, no actual hierarchy at UI level is created. Thus, if you want to find the parent item from a child one, you need to have a single parent and find it through the corresponding property. 

    All the best,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready