RadTreeListView in RadTileView?

2 posts, 0 answers
  1. Nicole
    Nicole avatar
    30 posts
    Member since:
    Mar 2011

    Posted 16 Mar 2011 Link to this post

    Similar to the post here, I am looking to next a control instead a RadTileView content template.  I can get the RadTreeListView grid headers to appear, but I can't get the grid to databind to a collections object.  Eventually, I will need this to bind to dynamic data, but for now I am just working on a proof on concept.  (I'll actually want to display in the large content template, but that's another issue.)  My xaml is:

    <UserControl x:Class="TileView.MainPage"
            mc:Ignorable="d"     d:DesignHeight="500" d:DesignWidth="800" >
            <DataTemplate x:Key="MDSHeaderTemplate">
                <TextBlock Text="{Binding ModelCode}"></TextBlock>
            <DataTemplate x:Key="MDSTemplate">
                <telerik:RadFluidContentControl ContentChangeMode="Manual" State="{Binding ModelCode}">
                            <telerik:RadTreeListView x:Name="RadTreeListView" HierarchyColumnIndex="1" ItemsSource="{Binding}">
                                    <telerik:TreeListViewTableDefinition ItemsSource="{Binding ModelCode}">
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding ModelName}" Header="Model Name" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding TailNumber}" Header="Tail Number" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Mods}" Header="Mods" />
                        <TextBlock Text="This is the content"></TextBlock>
                            <TextBlock Text="This is the large content"></TextBlock>
            <Style TargetType="telerik:RadTileView">
                <Setter Property="ContentTemplate" Value="{StaticResource MDSTemplate}"></Setter>
                <Setter Property="ItemTemplate" Value="{StaticResource MDSHeaderTemplate}"></Setter>
        <Grid x:Name="LayoutRoot" Background="White">
            <telerik:RadTileView HorizontalAlignment="Left" x:Name="RadTileView" VerticalAlignment="Top" Height="500" Width="800"
                                 MinimizedItemsPosition="Right" ItemsSource="{Binding}" MaximizeMode="One">

    In my code behind, I am trying to bind the data as follows:

    Public Sub New()
        Me.RadTileView.ItemsSource = MDS_Service.GetMDS()
        Me.RadTreeListView.ItemsSource = MDS_Service.GetMDS()
    End Sub

    I get the error that "RadTreeListView is not a member of 'TileView.MainPage'."  (Where TileVIew is the name of my project and MainPage the name of my file.)  If you could point me in the right direction, I would appreciate it.
  2. Zarko
    Zarko avatar
    755 posts

    Posted 22 Mar 2011 Link to this post

    Hi Nicole,

     You get an exception because you can't access (by name or key) FrameworkElements that are defined in a DataTemplate. Instead you should bind your RadTileView to a collection of items and each item should have a subcollection of other items for its RadTreeListView. Also could you tell me what's the type of ModelCode variable, because I noticed that you use it as a string(Text="{Binding ModelCode}"), as a collection(ItemsSource={Binding ModelCode}) and as a FluidContentControlState(State="{Binding ModelCode}")? 
    I've created a sample project for you so could you please examine it and if you have further questions feel free to ask?

    All the best,
    the Telerik team
  3. DevCraft R3 2016 release webinar banner
Back to Top