0

Can someone help me understand way fo creating xaml code for TreeView component and model like this one:

class Task: ObservableObject
{
    private string _title;

    public string Title {
        get { return _title; }
        set { 
            if (value != _title) {
                _title = value;
                OnPropertyChanged("Title");
            } 
        }
    }

    public override string ToString() {
        return Title;
    }
}

class Tasks:ObservableCollection<Task>
{

}

class Group:ObservableObject
{
    private Tasks _tasksList;

    public Group() {
        _tasksList = new Tasks();
    }

    public Tasks TasksList {
        get{
            return _tasksList;
        }

        set {
            if (value != _tasksList) {
                _tasksList = value;
                OnPropertyChanged("TasksList");
            }
        }
    }
}

class Groups:ObservableCollection<Group>
{

}

All I want to have is View with TreeView component and data like

Group1
   Task 1
   Task 2
Group2
   Task 3
   Task 4

using a InputSource and DataContext...

1 Answer 1

2

You have to use hierarhical data templates.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.