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

Hierarchical Objects from Serialized XMLC:\Users\rblack\Documents\visual studio 2010\Projects\MultipleLevelObject

3 Answers 50 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mark Peterson
Top achievements
Rank 1
Mark Peterson asked on 03 Jun 2010, 04:14 PM
*Edit* Please fix title to say "Hierarchical Objects from Serialized XML"

I have decided to go away from xml databinding and instead use object databinding because of the advantages you get using OnPropertyChanged.  The easiest way to get this done is to create a xsd of your xml and then use a program called Xsd2Code to have all your properties contain OnPropertyChanged.

I have created the xsd and generated file with no problems, but I can not get the treeview to display the serialized data.

I am having problems going more than 1 layer deep.  I am including my sample program to keep this post shorter and easier for everyone.  It can be found here

Thanks in advance
Mark




3 Answers, 1 is accepted

Sort by
0
Mark Peterson
Top achievements
Rank 1
answered on 04 Jun 2010, 02:49 PM
For anyone looking at this, I have made some small fixes to get the first set of XML nodes.

There was a bug in my test.xsd that was generated that had the numbers xml node be optional.  
A new version of the code can be found here.

Thanks
Mark


0
Mark Peterson
Top achievements
Rank 1
answered on 11 Jun 2010, 04:57 PM
Have there been any updates to this question?

Thanks
Mark
0
Miro Miroslavov
Telerik team
answered on 16 Jun 2010, 08:03 AM
Hello Mark Peterson,

I've modified your example a little and now is OK. Since you are having one type of items for the whole hierarchy, you shouldn't have different HierarchicalTemplates, but only one for the whole tree:
<Grid>
    <Grid.Resources>
 
        <HierarchicalDataTemplate x:Key="Test"
                                    ItemsSource="{Binding Number1}">
            <Border>
                <Label VerticalContentAlignment="Center">
                    <TextBlock Text="{Binding val}"
                                VerticalAlignment="Center"
                                TextWrapping="Wrap" />
                </Label>
            </Border>
        </HierarchicalDataTemplate>
 
    </Grid.Resources>
 
    <telerik:RadTreeView ItemsSource="{Binding Source={StaticResource TestXML}, Path=TestingDataSource}"
                            ItemTemplate="{StaticResource Test}" />
</Grid>

Hope this works for you.

Greetings,
Miro Miroslavov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
Mark Peterson
Top achievements
Rank 1
Answers by
Mark Peterson
Top achievements
Rank 1
Miro Miroslavov
Telerik team
Share this question
or