Create TreeListView programatically

2 posts, 0 answers
  1. ss
    ss avatar
    50 posts
    Member since:
    Jun 2010

    Posted 09 Jul 2010 Link to this post


    I have TreeListView that contains 4 columns (Title, Name, Age, Street)

    I have also class User 

    public class User


    public String Title;

    public String Name;

    public int Age;

    public String Street;


    Now I would like to create TreeListView programatically but I dont know how to bind User properties to columns. Can you please help me how to do this?

    Thank you very much.

  2. Rossen Hristov
    Rossen Hristov avatar
    2477 posts

    Posted 12 Jul 2010 Link to this post

    Hello ss,

    Here is an example of a TreeListView:

    <UserControl x:Class="Telerik.Windows.Examples.TreeListView.FirstLook.Example"
            <local:RadTreeListXmlDataSource x:Key="TreeListSource"
                    Source="RadRibbonBarCodeCoverage.xml" />
            <local:RelativeBlocksValueConverter x:Key="RelativeBlocksValueConverter1" />
            <local:ItemImageSourceValueConverter x:Key="ItemImageSourceValueConverter1" />
        <Grid x:Name="LayoutRoot">
            <Border telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True" Grid.RowSpan="3" />
            <telerik:RadTreeListView x:Name="RadTreeListView1"
                                     ItemsSource="{StaticResource TreeListSource}">
                    <telerik:TreeListViewTableDefinition ItemsSource="{Binding Items}" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding BlocksNotCovered}" Header="Not Covered (Blocks)" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Converter={StaticResource RelativeBlocksValueConverter1}, ConverterParameter=0}"
                                                Header="Not Covered (%)" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding BlocksCovered}" Header="Covered (Blocks)" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Converter={StaticResource RelativeBlocksValueConverter1}, ConverterParameter=1}"
                                                Header="Covered (%)" />

    We will release our Q2 version very soon and you will be able to see the complete example.

    Sincerely yours,
    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
Back to Top