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

RadTreeListView in RadTileView?

1 Answer 104 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Nicole
Top achievements
Rank 1
Nicole asked on 16 Mar 2011, 08:11 PM
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"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
        mc:Ignorable="d"     d:DesignHeight="500" d:DesignWidth="800" >
  
<UserControl.Resources>
        <DataTemplate x:Key="MDSHeaderTemplate">
            <TextBlock Text="{Binding ModelCode}"></TextBlock>
        </DataTemplate>
                        
        <DataTemplate x:Key="MDSTemplate">
            <telerik:RadFluidContentControl ContentChangeMode="Manual" State="{Binding ModelCode}">
                <telerik:RadFluidContentControl.SmallContent>
                   <Grid>
                        <telerik:RadTreeListView x:Name="RadTreeListView" HierarchyColumnIndex="1" ItemsSource="{Binding}">
                            <telerik:RadTreeListView.ChildTableDefinitions>
                                <telerik:TreeListViewTableDefinition ItemsSource="{Binding ModelCode}">
                                </telerik:TreeListViewTableDefinition>
                            </telerik:RadTreeListView.ChildTableDefinitions>
                            <telerik:RadTreeListView.Columns>
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding ModelName}" Header="Model Name" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding TailNumber}" Header="Tail Number" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Mods}" Header="Mods" />
                            </telerik:RadTreeListView.Columns>
                        </telerik:RadTreeListView>
                    </Grid>
                </telerik:RadFluidContentControl.SmallContent>
                <telerik:RadFluidContentControl.Content>
                    <Grid>
                    <TextBlock Text="This is the content"></TextBlock>
                    </Grid>
                </telerik:RadFluidContentControl.Content>
                <telerik:RadFluidContentControl.LargeContent>
                    <Grid>
                        <TextBlock Text="This is the large content"></TextBlock>
                    </Grid>
                </telerik:RadFluidContentControl.LargeContent>
            </telerik:RadFluidContentControl>
        </DataTemplate>
          
        <Style TargetType="telerik:RadTileView">
            <Setter Property="ContentTemplate" Value="{StaticResource MDSTemplate}"></Setter>
            <Setter Property="ItemTemplate" Value="{StaticResource MDSHeaderTemplate}"></Setter>
        </Style>
          
    </UserControl.Resources>
      
    <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">
        </telerik:RadTileView>
    </Grid>
      
</UserControl>


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

Public Sub New()
    InitializeComponent()
    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.

1 Answer, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 22 Mar 2011, 10:45 AM
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,
Zarko
the Telerik team
Tags
TileView
Asked by
Nicole
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Share this question
or