RadTreeListViewItem Datacontext is being set but DataTemplate for Rad Column can't bind to that datacontext being set in xaml

3 posts, 0 answers
  1. Matt
    Matt avatar
    3 posts
    Member since:
    May 2010

    Posted 20 Jun 2010 Link to this post

    Setting a RadTreeListViewItem's DataContext in xaml I can't then get access to that datacontext through <ContentPresenter Content="{Binding Content}" /> or this doesn't work too <ContentPresenter Content="{Binding Path=Content}" />

    Example code below:

    <

     

     

    telerik:RadTreeListView x:Name="TreeListViewResults">  

    <telerik:RadTreeListView.Columns>

     

    <telerik:RadColumn Header="Name" Width="150" >

     

     

     

    <telerik:RadColumn.CellTemplate>

     

     

     

    <DataTemplate>

     

     

     

    <ContentPresenter Content="{Binding Path=Content}"></ContentPresenter>

     

     

     

    </DataTemplate>

     

     

     

    </telerik:RadColumn.CellTemplate>

     

     

     

    </telerik:RadColumn>

     

     

     

    </telerik:RadTreeListView.Columns>

     

     

     

    <telerik:RadTreeListViewItem x:Name="Testing" IsExpanded="true">

     

     

     

    <telerik:RadTreeListViewItem.DataContext>

     

     

     

    <l:CompareTreeListViewItem Content="Test" LeftElementName="Test1" RightElementName="Test2"></l:CompareTreeListViewItem>

     

     

     

    </telerik:RadTreeListViewItem.DataContext>

     

     

     

    </telerik:RadTreeListViewItem>

     

     

    </telerik:RadTreeListView>

    CompareTreeListViewItem is just a class with an object Content in it and 2 string properties named LeftElementName and RightElementName.     The result is that the Name columns shows up but the Content "Test" is not showing up under that column. I think this should work. Am I doing anything wrong?

     

     

     

     

     

  2. Matt
    Matt avatar
    3 posts
    Member since:
    May 2010

    Posted 23 Jun 2010 Link to this post

    After downloading the silverlight Q2 2010 beta, this question seems to no longer matter. TreeListView has changed quite a bit. I now have a different question in the RadTreeListView.Items   I can't set items in the xaml. Is this on purpose. I don't want to use databinding to set my items, I want to do that through the xaml. There is no RadTreeListViewItem class anymore for the xaml.

    Thanks
    Matt
  3. DevCraft banner
  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 24 Jun 2010 Link to this post

    Hi Matt,

     Indeed RadTreeListView now is more like RadGridView. Can you post more info about what benefits you expect from declaring items in XAML instead setting ItemsSource?

    Greetings,
    Vlad
    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