Background Problem in DataBoundListBox

5 posts, 1 answers
  1. Anagh
    Anagh avatar
    7 posts
    Member since:
    Jul 2013

    Posted 01 Jul 2014 Link to this post

    I have got a DataBoundListBox. And the DataBoundListBoxitems can be images, text, audio,video etc. The Items are fetched using an API and most of the times the list becomes too long. I have to set the background of the DataBoundListBox depending on the data arriving. Let say, I set the background of DataBoundListBox as White. The problem is that in the long list I only see the background only to a certain extent after which the background becomes transparent. If I set the background of Grid in which DataBoundListBox is put, it doesn't work either.

    I do not if it is a bug or am I doing it completely wrong?

    Please look at the image attached.
  2. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 04 Jul 2014 Link to this post

    Hi Anagh,

    Can you elaborate a little more on the scenario - is the DataBoundListBox has custom template, what container is it added in, what is the ItemTemplate defined. Generally the control fills the entire rendered area with the background applied.

    Regards,
    Tsvyatko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. Anagh
    Anagh avatar
    7 posts
    Member since:
    Jul 2013

    Posted 04 Jul 2014 in reply to Tsvyatko Link to this post

    This is my code which is inside a PivotItem

    <ScrollViewer Margin="0,50,0,0" ManipulationCompleted="ProjectScroll_ManipulationCompleted" ManipulationStarted="ProjectScroll_ManipulationStarted" MouseMove="ScrollViewer_MouseMove">
                        <Grid>
                            <telerikPrimitives:RadDataBoundListBox ScrollViewer.VerticalScrollBarVisibility="Disabled"  EmptyContentDisplayMode="DataSourceNull" >
                                <telerikPrimitives:RadDataBoundListBox.EmptyContentTemplate>
                                    <DataTemplate>
                                        <customcontrols:ProgressRing  Width="80" Height="80" IsActive="True" HorizontalAlignment="Center" />
                                    </DataTemplate>
                                </telerikPrimitives:RadDataBoundListBox.EmptyContentTemplate>
                                <telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                                    <DataTemplate>
                                        <local:ModuleTemplateSelector Content="{Binding}" >
                                            <local:ModuleTemplateSelector.Image>
                                                <DataTemplate>
                                                    <StackPanel Margin="20,10">
                                                        <Image Source="{Binding src}"></Image>
                                                    </StackPanel>
                                                </DataTemplate>
                                            </local:ModuleTemplateSelector.Image>
                                            <local:ModuleTemplateSelector.Text>
                                                <DataTemplate>
                                                    <TextBlock Text="{Binding text_plain}" Margin="10" TextWrapping="Wrap" Foreground="Black" ></TextBlock>
                                                </DataTemplate>
                                            </local:ModuleTemplateSelector.Text>
                                        </local:ModuleTemplateSelector>
                                    </DataTemplate>
                                </telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                            </telerikPrimitives:RadDataBoundListBox>
                        </Grid>
                    </ScrollViewer>

    I got the problem solved. The main problem is I am using an external ScrollViewer (which I need for a "Go To Top" feature). If I remove this scrollviewer, I get the background as needed. But with ScrollViewer present there, the problem persists.

    Thanks.


  5. Answer
    Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 09 Jul 2014 Link to this post

    Hello Anagh,

    Thank you for sharing this additional information. Generally, RadDataBoundListBox does not perform well when nested in ScrollViewer, due to its virtualizing mechanism and optimization techniques.
    In this particular scenario it seems that the issue comes from the framework itself - when nesting two ScrollViewers (as it happens with DataBoundListBox), the inner content panel cannot display its background correctly.

    Regards,
    Tsvyatko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Anagh
    Anagh avatar
    7 posts
    Member since:
    Jul 2013

    Posted 22 Jul 2014 in reply to Tsvyatko Link to this post

    Thanks for the answer.
    I found that the same problem appears with the Silverlight ListBox too.
Back to Top
DevCraft banner