Transform a RadTreeView into a RadTreeListView or RadGridView

0 Answers 30 Views
GridView TreeListView TreeView
Andreea
Top achievements
Rank 1
Iron
Andreea asked on 07 Feb 2024, 03:48 PM | edited on 08 Feb 2024, 08:14 AM

Hello, 

I am using a RadTreeView component in a WPF application that looks like in the following photo. The hierarchy is: a Category can contain a list of SubCategories and a SubCategory contains a List of Activities that have some properties. I would like to transform my RadTreeView into a RadTreeListView or RadGridVew in order to beneficiate from SelectionUnit property and the navigation between cells from the keyboard but I could not find anything that meets by needs:

a component with cells only on the last level of the hierarchy, to be able to select a cell and edit it  and, if possible, to have a tabular header with details from the last level of the hirarchy.

 

Thank you!

Dimitar
Telerik team
commented on 08 Feb 2024, 10:44 AM

Hi Andreea. 

You can examine the examples for the GridVIew in our demo application. The Custom Grouping example looks quite similar. 

In addition, our SDK repository contains many examples as well:  telerik/xaml-sdk: The XAML SDK is an easy-to-use infrastructure with 1000+ developer focused examples for most of the Telerik WPF and Silverlight controls.

I wanted to ask you to share an example of how your data hierarchy is organized. This is important since it will give us direction about the most suitable approach. 

I am looking forward to your reply.

 

Andreea
Top achievements
Rank 1
Iron
commented on 08 Feb 2024, 11:08 AM

Thank you very much for your quick response!

This is my hierarchy. "Value1", "Value2".. from the photo are actually Activity's property (Name, NoPerYear,StandardService,Unit, StandardWorkload, CalculatedRequirement)

public partial class Staff : ObservableObject
{
    public int Id { get; set; }
    public string Name { get; set; };
    public int Type { get; set; }

    [ObservableProperty]
    private List<StaffCategory> staffCategories = new List<StaffCategory>();
}

public partial class StaffCategory : ObservableObject
{
    public int Id { get; set; }
    public string Name { get; set; };
    public bool IsSelected { get; set; }


    [ObservableProperty]
    private List<Activity> children = new List<Activity>();

}

 public partial class Activity : ObservableObject
 {
     public int Id { get; set; }
     public string Name { get; set; };

     [ObservableProperty]
     private double? noPerYear;
     [ObservableProperty]
     private double? standardService;
     [ObservableProperty]
     private Unit unit = new Unit();
     [ObservableProperty]
     private double standardWorkload = 0;
     [ObservableProperty]
     private double calculatedRequirement = 0;
 
}

public class Unit
{
    public int Id { get; set; }
    public string Name { get; set; };
}

 

I really appreciate you effort and I am looking forword to your responde. Please let me know if is something I can provide more.

Dimitar
Telerik team
commented on 13 Feb 2024, 09:02 AM

Hi Andreea, 

A possible solution is to use the RowDetails template which will contain another grid view with another row details template.

I have attached a sample project that shows this.

Let me know if you have additional questions.

Andreea
Top achievements
Rank 1
Iron
commented on 13 Feb 2024, 09:17 AM

Hi Dimitar,

Thank you for you help. This solution is not exactly suitable for me because I want to have only one grid header that will be matched with children values, not a nested grid view with individual headers for every child. I think what works for me is, like you said above, the Custom Grouping solution.

 Thanks a lot for effort and interest!

No answers yet. Maybe you can help?

Tags
GridView TreeListView TreeView
Asked by
Andreea
Top achievements
Rank 1
Iron
Share this question
or