This is a migrated thread and some comments may be shown as answers.

DataBinding in Multicolumn treeview

0 Answers 119 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Raghuraj
Top achievements
Rank 1
Raghuraj asked on 04 Oct 2008, 10:07 AM
Hello,

I have problem with binding of multi column tree view with DataSet.
Actually the problem is - when i bind the multi-column treeview in XAML with ObjectDataProvider, treeview shows the data for the 1st treeview item, however, for the rest of all child item it does not show the data.
 
<ObjectDataProvider x:Key="objectData" MethodName="CreateDataSet"
                                ObjectType="{x:Type local:DataModel}"/>

<HierarchicalDataTemplate x:Key="DetailTemplate"
                                      ItemsSource="{Binding Detail-to-Info}"
                                      ItemTemplate="{StaticResource CellTemplate_Name}">               
                    <TextBlock Text="{Binding Detail}"/>
            </HierarchicalDataTemplate>

<HierarchicalDataTemplate x:Key="MasterTemplate"
                                      ItemsSource="{Binding Master-to-Detail}"
                                      ItemTemplate="{StaticResource DetailTemplate}">
                <DockPanel>
                    <ToggleButton x:Name="Expander"
                      Style="{StaticResource ExpandCollapseToggleStyle}"
                      Margin="{Binding Level,Converter={StaticResource LevelToIndentConverter},RelativeSource={RelativeSource AncestorType={x:Type telerik:RadTreeViewItem}}}"
                      IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadTreeViewItem}}}"
                      ClickMode="Press"/>
                    <TextBlock Text="{Binding Name}" FontWeight="Bold"/>
                </DockPanel>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding Path=HasItems,RelativeSource={RelativeSource AncestorType={x:Type telerik:RadTreeViewItem}}}"
                     Value="False">
                        <Setter TargetName="Expander" Property="Visibility"    Value="Hidden"/>
                    </DataTrigger>
                </DataTemplate.Triggers>
            </HierarchicalDataTemplate>


<local:RadTreeListView x:Name="treeTest" DataContext="{StaticResource objectData}"
                               ItemsSource="{Binding MasterTable}"
                               ItemTemplate="{StaticResource MasterTemplate}">
            <local:RadTreeListView.Columns>
                <GridViewColumn Header="
Component" CellTemplate="{StaticResource MasterTemplate}" />
                <GridViewColumn Header="State on Master" />
                <GridViewColumn Header="State on Backup" />
            </local:RadTreeListView.Columns>
        </local:RadTreeListView>




Please look into it and let me know, where i lacking to achieve the goal.

Regards

Raghuraj

No answers yet. Maybe you can help?

Tags
TreeView
Asked by
Raghuraj
Top achievements
Rank 1
Share this question
or