Hi,
I have got model:
And in MVVM:
I found an example, but I don't want to create a new model, and even more so to edit an existing one.
Could you explain to me step-by-step, how I can bind the data to treeview (with parents and their childs')?
I have got model:
public
class
Category
{
public
int
Id {
get
;
set
; }
public
string
Name {
get
;
set
; }
public
int
? ParentCategoryId {
get
;
set
; }
public
virtual
Category ParentCategory {
get
;
set
; }
public
virtual
ICollection<Category> SubCategories {
get
;
set
; }
}
And in MVVM:
private
ObservableCollection<Category> _categories;
public
ObservableCollection<Category> Categories
{
get
{
return
_categories; }
set
{
if
(_categories == value)
return
;
_categories = value;
OnPropertyChanged(
"Categories"
);
}
}
I found an example, but I don't want to create a new model, and even more so to edit an existing one.
Could you explain to me step-by-step, how I can bind the data to treeview (with parents and their childs')?