Simple databound treeview doesnt work, why?

3 posts, 1 answers
  1. Frank -
    Frank - avatar
    8 posts
    Member since:
    Apr 2010

    Posted 10 Jun 2011 Link to this post

    I have a treeview in its simples form possible, can anyone explain why this little piece of code doesnt show my tree?

    <UserControl x:Class="treeview.MainPage"
        d:DesignHeight="300" d:DesignWidth="400">
        <Grid x:Name="LayoutRoot" Background="White">
            <telerikNav:RadTreeView Background="HotPink" ItemsSource="{Binding ParentList}"/>    

    Imports System.ComponentModel
    Imports System.Collections
    Imports System.Collections.ObjectModel
    Partial Public Class MainPage
        Inherits UserControl
        Public ParentList As New ObservableCollection(Of String)
        Public Sub New()
        End Sub
        Public Sub PopulateList()
        End Sub
    End Class

    The background - hotpink displays but not test and test1 strings as expected.. Any ideas?
  2. Answer
    Petar Mladenov
    Petar Mladenov avatar
    3162 posts

    Posted 15 Jun 2011 Link to this post

    Hello Frank -,

    You haven't specified DataContext for the RadTreeView. I can suggest you to set the ItemsSource directly from code behind like so:
    <telerikNav:RadTreeView Background="HotPink" x:name="tree">
    Public Sub PopulateList() 
            this.tree.ItemsSource = ParentList;
        End Sub
    Let us know if you need further assistance on this.

    Best wishes,
    Petar Mladenov
    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
  3. Frank -
    Frank - avatar
    8 posts
    Member since:
    Apr 2010

    Posted 15 Jun 2011 Link to this post

Back to Top