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

How to conditional style a row of TreeViewList

3 Answers 52 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Johnny
Top achievements
Rank 2
Johnny asked on 14 May 2013, 09:14 PM
Hello,

I have created a RadTreeViewList using mvvm pattern with a simple class named TreeItem:

public class TreeItem
{
    private string title;
    private ObservableCollection<TreeItem> items;
 
    public string Title
    {
        get { return title; }
        set { title = value; }
    }
 
    public ObservableCollection<TreeItem> Items
    {
        get { return items; }
        set { items = value; }
    }
 
    public TreeItem()
    {
 
    }
 
    public TreeItem(string ptitle)
    {
        this.Title = ptitle;
        this.Items = new ObservableCollection<TreeItem>();
    }
}

I manually create the object hierarchy and binded the control in code. I wanted to style the control as in the provided image, desired.png. However, what I was able to attained is shown in the image, result.png.

I have studied the Style & Templates sections of both RadTreeViewList and RadGridView, but none of those guides "show" what part of the control they affect. If it is possible, please provide an example of how to style each row based on either indent position, or how to augment the data class to accomplish my goal.

Thanks in advance.

Johnny Moreno

3 Answers, 1 is accepted

Sort by
0
Accepted
Yoan
Telerik team
answered on 15 May 2013, 02:14 PM
Hi Johnny,

In order to achieve your goal, you can use RowStyleSelector. You can check this help article for a reference. For your convenience, I have prepared a sample project, illustrating the suggested approach. Please find it attached.


All the best,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Johnny
Top achievements
Rank 2
answered on 15 May 2013, 05:46 PM
Yoan, 

Thanks for the rapid response. The example provided looks promising. I will try it and let you know.

Thanks again,

Johnny
0
Yoan
Telerik team
answered on 18 May 2013, 08:44 AM
Hello Johnny,

I am glad to see that you have Marked this as answer.

Please if you face any further difficulties do not hesitate to contact us.

Regards,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TreeListView
Asked by
Johnny
Top achievements
Rank 2
Answers by
Yoan
Telerik team
Johnny
Top achievements
Rank 2
Share this question
or