RadDataBoundListBox containing RadExpander in DataTemplate

3 posts, 1 answers
  1. Justin
    Justin avatar
    7 posts
    Member since:
    Feb 2013

    Posted 01 Jul 2013 Link to this post

    Hello. I am trying to build a DataBoundListBox of RadExpanders (i.e. a list box where you can click each item and they will expand).

    The code below works until I change ItemsSource of the ListBox to something else and back. Then I get an error:

    Element is already the child of another element

    I have even tried putting the whole Expander into it's own UserControl inside my <Person> object and return a new instance every time but still get this error and I don't like that solution since it breaks MVVM.

    Can someone please point me to the correct way of having a DataBound ListBox containing Expanders.


                    x:Name="ListBoxMain" ItemsSource="{Binding People, Mode=TwoWay}" Height="700" Margin="3,0,3,3"
                                        <RowDefinition Height="3"></RowDefinition>
                                                <Grid Margin="0,30" VerticalAlignment="Center">
                                                    <TextBlock Grid.Column="4" Text="{Binding Name}"/>
  2. Answer
    Deyan avatar
    2026 posts

    Posted 02 Jul 2013 Link to this post

    Hi Justin,

    Thanks for writing.

    We would like to investigate the case and therefore sending us a sample project that reproduces the issue will be extremely helpful. Is it possible for you to isolate the case in a sample project or simply send us the source of your app so that we can attach our source code and see what exactly happens?

    You will have to open a new support ticket in  order to be able to attach files.

    Thanks for your time.

    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. Justin
    Justin avatar
    7 posts
    Member since:
    Feb 2013

    Posted 03 Jul 2013 Link to this post

    Hi thanks! But I figured it out. Now my datamodel holds an instance to the whole listbox instead of just the expander in the data template.
Back to Top