Binding 2 controls to 1 source

2 posts, 0 answers
  1. Scott Michetti
    Scott Michetti avatar
    92 posts
    Member since:
    Feb 2010

    Posted 20 Mar 2014 Link to this post

    Hello, I'm binding 2 TreeView controls to one source, and only 1 TreeView has data, the other is empty.
    Here's my code.

    radTreeview1.ItemsSource = MyClass.Children;
    radTreeview2.ItemsSource = MyClass.Children;

    radTreeview1 is blank. If I comment out radTreeview2, radTreeview1 displays with data, so it looks like the last item to bind will work.

    Can I not use the same class to bind to 2 different controls?


  2. Boris
    Boris avatar
    276 posts

    Posted 25 Mar 2014 Link to this post

    Hello Scott,

    Yes you can use a single collection to populate two RadTreeViews. I attached a sample project that demonstrates a possible approach in which the code is much similar to yours:
              List<DataItem> children = MyClass.GetData();
           this.xTree1.ItemsSource = children;
           this.xTree2.ItemsSource = children;

    Please let us know if this helps or if we have missed something.

    Boris Penev

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

  3. DevCraft R3 2016 release webinar banner
Back to Top