List of Lists

2 posts, 0 answers
  1. d
    d avatar
    4 posts
    Member since:
    Oct 2008

    Posted 10 Jan 2014 Link to this post

    I would like to add 5 lists to a databoundlistbox. I can do this fine with a normal Listbox, but I cannot do this with a databoundlistbox. I am creating a "First look" of some datasets and will use the Parent Databoundlistbox to perform pull to refresh. When the lists are added to a databoundlistbox, no content is displayed only the viewmodel name is displayed. Im sure this is because the databoundlistbox does not know how to render the view; but I'm not sure how to proceed. This is the list    

     Thinking about this, its just really a set of user controls nested in a list - should be straight forward!!

    Individual List Item

     <usercontrol..

    <Grid x:Name="LayoutRoot" Background="Transparent">

     

              <Grid.RowDefinitions>

                        <RowDefinition Height="30"></RowDefinition>

     

                <RowDefinition Height="130"></RowDefinition>

                     </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>

                        <ColumnDefinition Width="10"/>

                        <ColumnDefinition Width="*"/>

                    </Grid.ColumnDefinitions>

                    <Border   Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" Background="{Binding Colour}" Margin="0,7,2,10"/>

                    <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" >

                            <Run Text="{Binding Displayname}" />

                            <Run Text="{Binding tn}" />

                    </TextBlock>

           

                <telerikPrimitives:RadDataBoundListBox x:Name="Scores" Grid.Row="1" Grid.Column="1" ItemTemplate="{StaticResource SPScores4RDataTemplate}" Height="300"> </telerikPrimitives:RadDataBoundListBox>

            </Grid>

     </usercontrol>

    Parent List item

    <!--LayoutRoot is the root grid where all page content is placed-->

        <Grid x:Name="LayoutRoot" Background="Transparent">

            <Grid.RowDefinitions>

                <RowDefinition Height="Auto"/>

                <RowDefinition Height="*"/>

            </Grid.RowDefinitions>

         <!--   <ListBox x:Name="GroupScores"/> -->

         

            <telerikPrimitives:RadDataBoundListBox Grid.Row="0" ItemsSource="{Binding GroupScores}"/>

           

        </Grid>

  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 13 Jan 2014 Link to this post

    Hello,

    The RadDataBoundListBox uses a slightly different UI Virtualization approach which is more optimized compared to the standard list box control. This UI virtualization mechanism does not allow you to directly embed visual elements in the source and expect them visualized in the control.

    In your scenario you will simply need to create the proper business models (containing the sources for each separate list), bind these models as a source to the listbox and define a DataTemplate for the items which contains the nested DataBoundListBox instance bound to its specific source. In this case you will not need to use UserControl instance as they are slow in terms of XAML parsing and visualisation when used in a list.

    This is actually a standard Silverlight approach as well.

    I hope this helps.

    Regards,
    Deyan
    Telerik
    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
Back to Top