Bug with EmptyContent and a NullReferenceException

6 posts, 0 answers
  1. Andrew
    Andrew avatar
    26 posts
    Member since:
    Sep 2011

    Posted 17 Nov 2011 Link to this post

    1) Right now I have EmptyContent bound to a string on my model. It doesn't show up if I have a ListHeaderContent binding with or without a ListHeaderTemplate defined. Is this a bug or correct behavior?

    2) While using ListHeaderContent/Template I had this thrown: 

    A first chance exception of type 'System.NullReferenceException' occurred in Telerik.Windows.Controls.Primitives.dll
    System.NullReferenceException: NullReferenceException
       at Telerik.Windows.Controls.RadVirtualizingDataControl.CheckResetBottomScrollableContentPosition()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.ManageViewport()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.BalanceVisualSpace()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.a3()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.a4()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.OnItemsChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.RadDataBoundListBox.OnItemsChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.RadVirtualizingDataControl.c

    I've attached a screenshot of when it happened. Above the red line is the header, below are the items.

    Here's the xaml:
    <UserControl x:Class="MaroonedSoftware.Redditor.Views.CommentView"
            xmlns:local="clr-namespace:MaroonedSoftware.Redditor.Controls"
            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" mc:Ignorable="d"
            xmlns:telerikPrimitives="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
            FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}"
            Foreground="{StaticResource PhoneForegroundBrush}" d:DesignHeight="480" d:DesignWidth="480">
     
        <UserControl.Resources>
            <local:CommentDataTemplateSelector x:Key="CommentDataTemplateSelector" />
            <local:MarkdownConverter x:Key="MarkdownConverter" />
     
            <DataTemplate x:Key="CommentTemplate">
                <StackPanel>
                    <Border Margin="{Binding Margin}" BorderThickness="2,0,0,0" Background="Transparent"
                            BorderBrush="{StaticResource PhoneAccentBrush}" Padding="3" Tap="ListBox_Tap">
                        <StackPanel>
                            <TextBlock Text="{Binding Body}" Style="{StaticResource PhoneTextTitle3Style}"
                                    TextWrapping="Wrap" />
                            <!--<RichTextBox
                                    local:RedditComment.Comment="{Binding Body, Converter={StaticResource MarkdownConverter}}" />-->
     
                            <Grid HorizontalAlignment="Right">
                                <Path Data="M0,1 L1,1 L0,0 z" Fill="{StaticResource PhoneAccentBrush}"
                                        HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="Fill"
                                        UseLayoutRounding="False" Width="15" Height="15" Margin="9,0,0,-1" />
                                <Border Margin="0,15,0,0" Background="{StaticResource PhoneAccentBrush}"
                                        BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="2"
                                        VerticalAlignment="Stretch" Padding="5">
                                    <TextBlock Style="{StaticResource PhoneTextTitle3Style}">
                                            <Run Text="{Binding Author}" /><Run Text=" " />
                                            <!--<Run Text="{Binding Score}"/><Run Text=" "/>-->
                                            <Run Text="{Binding Score}" /><Run Text=" votes" /></TextBlock>
                                </Border>
                            </Grid>
     
                        </StackPanel>
                    </Border>
     
                    <StackPanel Visibility="{Binding Selected, Converter={StaticResource BoolToVisibilityConverter}}">
                        <TextBox Margin="0" AcceptsReturn="True" Height="160" TextWrapping="Wrap" />
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <local:RoundToggleButton Grid.Column="0" ImageSource="/Images/uparrow.png"
                                    VerticalAlignment="Center" />
                            <local:RoundToggleButton Grid.Column="1" ImageSource="/Images/downarrow.png"
                                    VerticalAlignment="Center" />
                            <Button Grid.Column="2">Submit</Button>
                        </Grid>
                    </StackPanel>
                </StackPanel>
            </DataTemplate>
     
            <DataTemplate x:Key="OriginalAuthorCommentTemplate">
                <StackPanel>
                    <Border Margin="{Binding Margin}" BorderThickness="2,0,0,0"
                            BorderBrush="{StaticResource PhoneAccentBrush}" Padding="3">
                        <StackPanel>
                            <TextBlock Text="{Binding Body}" Style="{StaticResource PhoneTextTitle3Style}"
                                    TextWrapping="Wrap" />
                            <Grid HorizontalAlignment="Right">
                                <Path Data="M0,1 L1,1 L0,0 z" Fill="{StaticResource PhoneAccentBrush}"
                                        HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="Fill"
                                        UseLayoutRounding="False" Width="15" Height="15" Margin="9,0,0,-1" />
                                <Border Margin="0,15,0,0" BorderBrush="{StaticResource PhoneAccentBrush}"
                                        BorderThickness="2" VerticalAlignment="Stretch" Padding="5">
                                    <TextBlock Style="{StaticResource PhoneTextTitle3Style}">
                                            <Run Text="{Binding Author}" /><Run Text=" " />
                                            <!--<Run Text="{Binding Score}"/><Run Text=" "/>-->
                                            <Run Text="{Binding Score}" /><Run Text=" votes" /></TextBlock>
                                </Border>
                            </Grid>
                        </StackPanel>
                    </Border>
                    <TextBox AcceptsReturn="True" Height="160" TextWrapping="Wrap"
                            Visibility="{Binding Selected, Converter={StaticResource BoolToVisibilityConverter}}" />
                </StackPanel>
            </DataTemplate>
        </UserControl.Resources>
     
        <Grid x:Name="LayoutRoot">
     
            <!--<Border Margin="0,15,0,0" BorderBrush="{StaticResource PhoneAccentBrush}" VerticalAlignment="Stretch" Padding="5">
                <TextBlock>Hello</TextBlock>
            </Border>-->
     
            <!--<ListBox ItemsSource="{Binding Comments}" ItemTemplate="{StaticResource CommentTemplate}">
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    </Style>
                </ListBox.ItemContainerStyle>
             
            </ListBox>-->
     
            <telerikPrimitives:RadDataBoundListBox ItemsSource="{Binding Comments}"
                    ItemTemplate="{StaticResource CommentTemplate}" EmptyContent="{Binding EmptyContent}"
                    ItemTemplateSelector="{StaticResource CommentDataTemplateSelector}"
                    ListHeaderContent="{Binding}">
                                                    
                <telerikPrimitives:RadDataBoundListBox.ItemContainerStyle>
                    <Style TargetType="telerikPrimitives:RadDataBoundListBoxItem">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    </Style>
                </telerikPrimitives:RadDataBoundListBox.ItemContainerStyle>
                <telerikPrimitives:RadDataBoundListBox.ListHeaderTemplate>
                    <DataTemplate>
                        <Border Margin="0,0,0,0" BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="0,0,0,2"
                                VerticalAlignment="Stretch" Padding="5">
                            <RichTextBox FontSize="{StaticResource PhoneFontSizeMedium}"
                                    local:RedditComment.Comment="{Binding SelfText, Converter={StaticResource MarkdownConverter}}" />
                            <!--<TextBlock Text="{Binding}" Style="{StaticResource PhoneTextTitle3Style}"/>-->
                        </Border>
                    </DataTemplate>
                </telerikPrimitives:RadDataBoundListBox.ListHeaderTemplate>
            </telerikPrimitives:RadDataBoundListBox>
     
        </Grid>
    </UserControl>
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 18 Nov 2011 Link to this post

    Hello Robert,

    Thanks for contacting us and for reporting these issues.

    1. This behavior is by design. Since the header and the footer are part of the scrollable list, the empty content is not shown when header and footer are present. If you, however, have any feedback on the behavior of the control in this scenario, we will be happy to listen to you and possiblity improve it for our next release.

    2. The second issue seems to be a bug. In order for us to be able to take a look at it, it will be of a great help if you manage to find the exact way of reproducing it and share it with us. It will be very helpful if you manage to create a sample app that we can use to reproduce it and send it to us.

    Please note that you will need to open a new support ticket in order to be able to attach your application.

    Thanks for your time.

    Regards,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Dave Baumann
    Dave Baumann avatar
    6 posts
    Member since:
    Mar 2010

    Posted 15 Nov 2012 Link to this post

    "1. This behavior is by design. Since the header and the footer are part of the scrollable list, the empty content is not shown when header and footer are present. If you, however, have any feedback on the behavior of the control in this scenario, we will be happy to listen to you and possiblity improve it for our next release."

    I am using the 2012 Q3 release and the DataboundList still behaves as described above.

    I would like to see the behavior above to be configurable as follows:

    • I would like to be able to set the header but only display it when I have data (and show the EmptyContent Message when I don't).
    • I would like to set the header but still show the EmptyContent message (with the header) when there is no data (like header columns in excel or a SQL Query). 

    Otherwise I end up needing to hide the DataboundList and display an empty content message on my own for these scenarios. This defeats the purpose (in my humble opinion) of having an EmptyContent property on the DataboundList.

    Thanks.

     
  5. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 19 Nov 2012 Link to this post

    Hi Dave,

    Thanks for writing.

    We will log these suggestions in our TODO list and will implement it in an upcoming release.

    All the best,
    Deyan
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  6. Wayde
    Wayde avatar
    17 posts
    Member since:
    Jun 2012

    Posted 25 Mar 2013 Link to this post

    Hi, do you know if this feature is going to be added? I would also like to display the header, footer and the empty content.
  7. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 28 Mar 2013 Link to this post

    Hello Robert,

    With new releases features that have been introduced are normally described in the Release Notes files. You can make sure that you read these documents to be aware of what's new, what's fixed or if there are breaking changes.

    We will make sure to revisit the requests for this feature and will put it in the priority queue for the upcoming major release.

    All the best,
    Deyan
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Back to Top
DevCraft banner