Hi, your XamDataTree does not work as expected. This code doesn't show group2 under group1 --- ObservableCollection<object> items = new ObservableCollection<object> (); var g1 = new AttributeGroupItem() {Name = "Level1"}; var g2 = new AttributeGroupItem() {Name = "Level2"}; g1.Items.Add (new AttributeItem () { Name = "L1 Child" }); g2.Items.Add (new AttributeItem () { Name = "L2 Child" }); g1.Items.Add (g2); items.Add (g1); this.xamDataTree1.ItemsSource = items; --- But that code does! --- ObservableCollection<object> items = new ObservableCollection<object> (); var g1 = new AttributeGroupItem() {Name = "Level1"}; var g2 = new AttributeGroupItem() {Name = "Level2"}; g1.Items.Add (g2); g1.Items.Add (new AttributeItem () { Name = "L1 Child" }); g2.Items.Add (new AttributeItem () { Name = "L2 Child" }); items.Add (g1); this.xamDataTree1.ItemsSource = items; --- My goal is to display Nodes recursively. Regards Benjamin
Hi, your XamDataTree does not work as expected.
This code doesn't show group2 under group1
--- ObservableCollection<object> items = new ObservableCollection<object> (); var g1 = new AttributeGroupItem() {Name = "Level1"}; var g2 = new AttributeGroupItem() {Name = "Level2"}; g1.Items.Add (new AttributeItem () { Name = "L1 Child" }); g2.Items.Add (new AttributeItem () { Name = "L2 Child" }); g1.Items.Add (g2); items.Add (g1); this.xamDataTree1.ItemsSource = items;
---
But that code does!
ObservableCollection<object> items = new ObservableCollection<object> (); var g1 = new AttributeGroupItem() {Name = "Level1"}; var g2 = new AttributeGroupItem() {Name = "Level2"};
g1.Items.Add (g2);
g1.Items.Add (new AttributeItem () { Name = "L1 Child" }); g2.Items.Add (new AttributeItem () { Name = "L2 Child" }); items.Add (g1); this.xamDataTree1.ItemsSource = items;
My goal is to display Nodes recursively.
Regards
Benjamin
Hi,
It’s hard for me to determine why your code isn’t working. I created a sample and created my own class definitions for AttributeGroupItem and AttributeItem and added NodeLayouts to the xaml.
Run my sample and then select which of your code snippets you want to use to load the xamDataTree. I see the same items with either code. If you can give me more detail about specifically what you are seeing and your layout design xaml that would be very helpful.
Thank you for your efforts! I didn't expect that you write a sample soloution for my problem.
In my code AttributeGroupItem derives from AttributeItem and has only one common collection of type ObservableCollection<AttributeItem> "Items". It seems that the given node layout dosn't work in that case.
If AttributeGroupItem and AttributeItem have one base class called AttributeItemBase, only one single node is shown!
I dont' know how my node layout should look like to meet my expectations.