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

binding to FullPath or Header with LOD

2 Answers 76 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
StrandedPirate
Top achievements
Rank 1
StrandedPirate asked on 05 Jun 2010, 06:57 AM
I've got a tree view on my page that i'm binding to by setting the ItemsSource property. How do I fine tune the binding so that I bind specific properties from my source dataset objects to the FullPath or the Header properties of the RadTreeViewItem node that is eventually created?

<

 

 

telerik:RadTreeView Grid.Column="0" Grid.Row="1" PathSeparator="\" ItemTemplate="{StaticResource DirectReportsTemplate}"

 

 

 

ItemsSource="{Binding ElementName=tbl_PathDomainDataSource, Path=Data}"

 

 

 

SelectedValuePath="PathID" x:Name="FolderTreeView"

 

 

 

IsLoadOnDemandEnabled="True" LoadOnDemand="tbl_PathRadTreeView_LoadOnDemand"

 

 

 

IsLineEnabled="False" HorizontalAlignment="Stretch"

 

 

 

IsEditable="True" ExpanderStyle="{StaticResource ExpanderStyle}" Selected="FolderTreeView_Selected">

 

2 Answers, 1 is accepted

Sort by
0
StrandedPirate
Top achievements
Rank 1
answered on 06 Jun 2010, 11:15 PM
I think I found how to do this but its not working for the FullPath property. This does work for the Tag property. Why would this work for some properties and not others. Is there a list of properties on your site that this will work with?

<

 

 

sdk:Page.Resources>

 

 

 

 

<telerik:ContainerBindingCollection x:Name="ItemBindings">

 

 

 

 

 

 

 

 

<telerik:ContainerBinding PropertyName="Tag" Binding="{Binding FullPath, Mode=TwoWay}"/>

 

 

 

 

 

 

 

 

</telerik:ContainerBindingCollection>

 

 

 

 

 

 

 

 

<telerik:HierarchicalDataTemplate x:Key="TreeviewTemplate" telerik:ContainerBinding.ContainerBindings="{StaticResource ItemBindings}">

 

 

 

 

 

 

 

 

<StackPanel Orientation="Horizontal">

 

 

 

 

 

 

 

 

<TextBlock Text="{Binding Converter={StaticResource NameConverter}}" />

 

 

 

 

 

 

 

 

</StackPanel>

 

 

 

 

 

 

 

 

</telerik:HierarchicalDataTemplate>

 

 

 

 

</sdk:Page.Resources>
...

 

 

 

 

<telerik:RadTreeView Grid.Column="0" Grid.Row="1" PathSeparator="\"

 

ItemTemplate

 

 

="{StaticResource TreeviewTemplate}"

 

 

 

 

 

 

 

ItemsSource="{Binding ElementName=tbl_PathDomainDataSource, Path=Data}"

 

 

 

 

 

 

 

SelectedValuePath="PathID" x:Name="FolderTreeView"

 

 

 

 

 

 

 

IsLoadOnDemandEnabled="True" LoadOnDemand="tbl_PathRadTreeView_LoadOnDemand"

 

 

 

 

 

 

 

IsLineEnabled="False" HorizontalAlignment="Stretch"

 

 

 

 

 

 

 

IsEditable="True" ExpanderStyle="{StaticResource ExpanderStyle}" Selected="FolderTreeView_Selected" />

 

0
Accepted
Valentin.Stoychev
Telerik team
answered on 07 Jun 2010, 07:18 AM
Hello Joey,

FullPath property is a read-only property and is not a DependencyProperty. In order to use a property in a Binding Expression it should be a DependencyProperty and should not be read-only. This is the reason that the binding is not working.

Why you need to set the FullPath property? What is your scenario?

Sincerely yours,
Valentin.Stoychev
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
StrandedPirate
Top achievements
Rank 1
Answers by
StrandedPirate
Top achievements
Rank 1
Valentin.Stoychev
Telerik team
Share this question
or