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

Can't bind to hierarchical object data

3 Answers 70 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 06 Jul 2009, 04:56 PM
Hi

I've been following this example for binding to object data.

However I can't specify the <DataTemplate>.

Instead I get the message "Property 'VisualTree' does not support values of type 'DataTemplate'".

What am I doing wrong?
<UserControl x:Class="ReportDistribution.Client.ReportMgr.WpfApp.UserControls.ReportMenuPanel" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
    Height="300" Width="270"
    <UserControl.Resources>         
        <ItemsControl> 
            <ItemsControl.ItemTemplate> 
                <HierarchicalDataTemplate x:Key="Entity" ItemsSource="{Binding ClientReport}">                    
                    <DataTemplate> 
                        <TextBlock Text="{Binding Name}"></TextBlock> 
                    </DataTemplate> 
                </HierarchicalDataTemplate> 
            </ItemsControl.ItemTemplate> 
        </ItemsControl>    
    </UserControl.Resources> 
    <Grid>         
        <Grid.RowDefinitions> 
            <RowDefinition Height="35"></RowDefinition> 
            <RowDefinition></RowDefinition
        </Grid.RowDefinitions> 
        <Grid.ColumnDefinitions> 
            <ColumnDefinition></ColumnDefinition
        </Grid.ColumnDefinitions> 
        <Border Grid.Row="0" BorderBrush="Black" BorderThickness="1"
            <Border.Background> 
                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"
                    <GradientStop Color="#ADCFFF" /> 
                    <GradientStop Color="#599BFF" Offset="1"></GradientStop> 
                </LinearGradientBrush> 
            </Border.Background> 
        </Border> 
        <TextBlock Grid.Row="0" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" Margin="5">Reports</TextBlock> 
        <Border Grid.Row="1" BorderBrush="Black" BorderThickness="1,0,1,1"
            <Border.Background> 
                <SolidColorBrush Color="White" /> 
            </Border.Background> 
        </Border> 
        <telerik:RadPanelBar x:Name="reportMenuPanelBar" Grid.Row="1" Margin="1,0,1,1" ItemTemplate="{StaticResource Entity}" ItemsSource="{Binding}"
             
        </telerik:RadPanelBar> 
                 
    </Grid> 
</UserControl> 



3 Answers, 1 is accepted

Sort by
0
Accepted
Tihomir Petkov
Telerik team
answered on 07 Jul 2009, 03:37 PM
Hello Ryan,

Please take a look at the attached project. I prepared it for you as a simple demonstration of how to bind a RadPanelBar control to a collection of objects. Please let me know if it helps.

Greetings,
Tihomir Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ryan
Top achievements
Rank 1
answered on 08 Jul 2009, 02:43 PM
Thank you Tihomir.

You should update the help because the xaml is wrong.


0
Tihomir Petkov
Telerik team
answered on 09 Jul 2009, 07:11 AM
Hello Ryan,

We will update the help article ASAP. Thank you for reporting this issue. I updated your Telerik points.

Best wishes,
Tihomir Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
PanelBar
Asked by
Ryan
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or