binding to FullPath or Header with LOD

3 posts, 1 answers
  1. StrandedPirate
    StrandedPirate avatar
    32 posts
    Member since:
    Nov 2007

    Posted 05 Jun 2010 Link to this post

    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. StrandedPirate
    StrandedPirate avatar
    32 posts
    Member since:
    Nov 2007

    Posted 06 Jun 2010 Link to this post

    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" />

     

  3. DevCraft banner
  4. Answer
    Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 07 Jun 2010 Link to this post

    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.
Back to Top