This question is locked. New answers and comments are not allowed.
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:
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
>