Hi, hopefully this will be a simple question with a quick answer.
My logical data structure is a List (eg. List<TopList>) with each item in the first list also having it's own list (eg. TopList[0].MiddleList). Finally, each MiddleList has some other class (eg. TopList[0].MiddleList[0].BottomClass), and I want to display all three in the UI with a RadTreeView for expanding and drag and drop support.
My xaml is set up as:
With codebehind setting UiElement.DataContext = TopList.
The problem is that (from all the examples I've seen) the RadTree requires my BottomClass to be in a List. Changing my BottomClass into a List will render and databind correctly. Ideally though, I don't want to do this to my logic and create a List with only one item. My question is basically: Is there a way to DataBind and display my BottomClass without putting it into a List and without using a for loop in the code behind?
As a side note I've considered turning my UI structure into a RadTree with Expanders as the contents, but this ran into display and usability issues when collapsing the expander vs closing the tree nodes.
My logical data structure is a List (eg. List<TopList>) with each item in the first list also having it's own list (eg. TopList[0].MiddleList). Finally, each MiddleList has some other class (eg. TopList[0].MiddleList[0].BottomClass), and I want to display all three in the UI with a RadTreeView for expanding and drag and drop support.
My xaml is set up as:
<HierarchicalDataTemplate x:Key="GroupListNestedContentTemplate"> |
<bui:UserControlForBottomClass/> |
</HierarchicalDataTemplate> |
<HierarchicalDataTemplate x:Key="GroupListNestedTemplate" ItemsSource="{Binding BottomClass}" ItemTemplate="{StaticResource GroupListNestedContentTemplate}"> |
<bui:UserControlForMiddleLevel /> |
</HierarchicalDataTemplate> |
<HierarchicalDataTemplate x:Key="GroupListTemplate" ItemsSource="{Binding MiddleList}" ItemTemplate="{StaticResource GroupListNestedTemplate}"> |
<bui:UserControlForTopLevel/> |
</HierarchicalDataTemplate> |
<Controls:RadTreeView x:Name="UiElement" DataContext="{Binding}" ItemsSource="{Binding}" ItemTemplate="{StaticResource GroupListTemplate}" IsDragDropEnabled="True" IsSingleExpandPath="True" IsExpandOnSingleClickEnabled="True" /> |
With codebehind setting UiElement.DataContext = TopList.
The problem is that (from all the examples I've seen) the RadTree requires my BottomClass to be in a List. Changing my BottomClass into a List will render and databind correctly. Ideally though, I don't want to do this to my logic and create a List with only one item. My question is basically: Is there a way to DataBind and display my BottomClass without putting it into a List and without using a for loop in the code behind?
As a side note I've considered turning my UI structure into a RadTree with Expanders as the contents, but this ran into display and usability issues when collapsing the expander vs closing the tree nodes.