This question is locked. New answers and comments are not allowed.
Hello,
I have a RadGridView in my application that is behaving strangely. My belief is that the problem is performance related as it only seems to happen using a combination of lots of data and applying more and more custom styles and templates. I have been able to reproduce the issue pretty consistently using the following scenario...
My data object looks like this:
And I populate my RadGridView like this:
In my xaml page I create a simple RadGridView and apply a "Style" and "HeaderRowStyle" like this:
And my App.xaml file has the following resources:
If I run this application, and group on column "prop4", you should see 8 collapsed groups. I then expand groups "7" and "8" and scroll the grid such that the header for group "8" is just visible at the top of the datagrid... At that point if you collapse group "8", you should see that the grid loses some rows... (You can see the attached picture for a visual of what I mean)... As I have been tryign to replicate this, I have managed to see several similar situations caused by expand/collapse...
I have a RadGridView in my application that is behaving strangely. My belief is that the problem is performance related as it only seems to happen using a combination of lots of data and applying more and more custom styles and templates. I have been able to reproduce the issue pretty consistently using the following scenario...
My data object looks like this:
public class MyDataObject { public string prop1 { get; set; } public string prop2 { get; set; } public string prop3 { get; set; } public string prop4 { get; set; } public string prop5 { get; set; } public string prop6 { get; set; } public string prop7 { get; set; } public string prop8 { get; set; } public string prop9 { get; set; } public string prop10 { get; set; } } And I populate my RadGridView like this:
ObservableCollection<MyDataObject> TheList = new ObservableCollection<MyDataObject>(); for (int i = 0; i <= 500; i++) { MyDataObject x = new MyDataObject() { prop1 = Guid.NewGuid().ToString(), prop2 = Guid.NewGuid().ToString(), prop3 = (i%6).ToString(), prop4 = (i%9).ToString(), prop5 = Guid.NewGuid().ToString(), prop6 = Guid.NewGuid().ToString(), prop7 = Guid.NewGuid().ToString(), prop8 = Guid.NewGuid().ToString(), prop9 = Guid.NewGuid().ToString(), prop10 = Guid.NewGuid().ToString(), }; TheList.Add(x); } this.rgv.ItemsSource = TheList;In my xaml page I create a simple RadGridView and apply a "Style" and "HeaderRowStyle" like this:
<telerik:RadGridView x:Name="rgv" ShowColumnFooters="True" ShowGroupFooters="True" Style="{StaticResource style}" HeaderRowStyle="{StaticResource headerrowstyle}"/>And my App.xaml file has the following resources:
<Application xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="SilverlightApplication123.App"> <Application.Resources> <telerik:Office_BlackTheme x:Key="Theme"/> <telerik:InvertedBooleanToOpacityConverter x:Key="InvertedBooleanToOpacityConverter" /> <telerik:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> <telerik:BooleanToOpacityConverter x:Key="BooleanToOpacityConverter" /> <telerik:GridLineWidthToThicknessConverter x:Key="GridLineWidthToThicknessConverter" /> <SolidColorBrush x:Key="brsh_NormalBlue" Color="#FF102E4E" /> <SolidColorBrush x:Key="brsh_HighlightBlue" Color="#FF1896FE" /> <SolidColorBrush x:Key="RowBackground_Regular" Color="#FFFFFFFF" /> <SolidColorBrush x:Key="RowBackground_Alternate" Color="#FFFBFBFB" /> <SolidColorBrush x:Key="brsh_OuterBorderColor" Color="#FFD2DEDF" /> <SolidColorBrush x:Key="brsh_InnerBorderColor" Color="#FFFCFCFC" /> <LinearGradientBrush x:Key="brsh_ColumnHeaderFillNormal" EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFD2E4FF" Offset="0"/> <GradientStop Color="#FFF9FBFD" Offset="0.808"/> </LinearGradientBrush> <LinearGradientBrush x:Key="brsh_ColumnHeaderFillMouseOver" EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFA9CBFF" Offset="0.316"/> <GradientStop Color="#FFFEFEFE" Offset="1"/> </LinearGradientBrush> <SolidColorBrush x:Key="brsh_GroupHeaderBlue" Color="#FFF4F7FD" /> <SolidColorBrush x:Key="brsh_GridLines" Color="#FFE8E8E8" /> <Style x:Key="style" TargetType="telerik:RadGridView"> <Setter Property="AlternationCount" Value="2" /> <Setter Property="RowIndicatorVisibility" Value="Collapsed" /> <Setter Property="Foreground" Value="#FF000000"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="AlternateRowBackground" Value="#FFFBFBFB"/> <Setter Property="VerticalGridLinesBrush" Value="{StaticResource brsh_GridLines}"/> <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource brsh_GridLines}"/> <Setter Property="ScrollMode" Value="Deferred" /> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Visible"/> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Visible"/> <Setter Property="VerticalAlignment" Value="Stretch"/> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="EnableColumnVirtualization" Value="True" /> <Setter Property="EnableRowVirtualization" Value="True" /> <Setter Property="RowHeight" Value="22" /> <Setter Property="FontFamily" Value="Segoe UI" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="telerik:RadGridView"> <Grid x:Name="PART_MasterGridContainer"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="GridViewActivity"> <VisualState x:Name="Idle"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_GridViewLoadingIndicator"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Busy"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_GridViewLoadingIndicator"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="ColumnHeadersVisibility"> <VisualState x:Name="ColumnHeadersVisible"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_HeaderRow"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="ColumnHeadersCollapsed"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_HeaderRow"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="ColumnFootersVisibility"> <VisualState x:Name="ColumnFootersVisible"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_FooterRow"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="ColumnFootersCollapsed"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_FooterRow"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="GroupPanelVisibility"> <VisualState x:Name="GroupPanelVisible"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_GroupPanel"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="GroupPanelCollapsed"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_GroupPanel"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="InsertRowVisibility"> <VisualState x:Name="InsertRowVisible"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_AddNewRow"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="InsertRowCollapsed"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_AddNewRow"> <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="1*" /> </Grid.RowDefinitions> <!-- Grouping Panel --> <telerik:GridViewGroupPanel x:Name="PART_GroupPanel" Grid.Row="0" Grid.Column="0" Margin="0,0,0,1" /> <!-- Data + ScrollBars --> <Border Grid.Row="1" Grid.Column="0" BorderBrush="{StaticResource brsh_OuterBorderColor}" BorderThickness="1"> <Grid x:Name="HierrarchyBackground" Background="#FFFFFFFF"> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*" /> <ColumnDefinition x:Name="ScrollBarColumn" MinWidth="0" Width="0" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition x:Name="PART_AttachedBehaviorRow" Height="Auto" /> <RowDefinition Height="1*" /> <RowDefinition x:Name="ScrollBarRow" Height="0" MinHeight="0" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <telerik:GridViewScrollViewer x:Name="PART_ItemsScrollViewer" Grid.Row="1" Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="2" Background="Transparent" CanContentScroll="True" telerik:StyleManager.Theme="{StaticResource Theme}"> <telerik:GridViewScrollViewer.HeaderRow> <telerik:GridViewHeaderRow x:Name="PART_HeaderRow" IndentLevel="{TemplateBinding GroupCount}" telerik:StyleManager.Theme="{StaticResource Theme}" /> </telerik:GridViewScrollViewer.HeaderRow> <telerik:GridViewScrollViewer.FooterRow> <telerik:GridViewFooterRow x:Name="PART_FooterRow" IndentLevel="{TemplateBinding GroupCount}" telerik:StyleManager.Theme="{StaticResource Theme}"/> </telerik:GridViewScrollViewer.FooterRow> <telerik:GridViewScrollViewer.NewRow> <telerik:GridViewNewRow x:Name="PART_AddNewRow" IndentLevel="{TemplateBinding GroupCount}" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="Collapsed"/> </telerik:GridViewScrollViewer.NewRow> <telerik:GridViewVirtualizingPanel x:Name="PART_GridViewVirtualizingPanel" /> </telerik:GridViewScrollViewer> <!-- Scroll Position Indicator --> <telerik:ScrollPositionIndicator x:Name="PART_ScrollPositionIndicator" Grid.Row="1" Grid.RowSpan="1" Grid.Column="0" Grid.ColumnSpan="2" ContentTemplate="{TemplateBinding ScrollPositionIndicatorTemplate}" HorizontalAlignment="Right" IsHitTestVisible="False" Margin="0,0,28,0" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="{Binding IsScrolling, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"> </telerik:ScrollPositionIndicator> <!-- Previewer for Frozen Columns --> <Border x:Name="PART_FrozenColumnsPreview" Grid.Row="0" Grid.RowSpan="4" Grid.Column="0" Grid.ColumnSpan="1" Background="#33000000" HorizontalAlignment="Left" Visibility="Collapsed" VerticalAlignment="Stretch" Width="6"> </Border> </Grid> </Border> <!-- Busy/Loading Indicator --> <telerik:GridViewLoadingIndicator x:Name="PART_GridViewLoadingIndicator" Grid.Row="1" Grid.RowSpan="1" Grid.Column="0" Grid.ColumnSpan="1" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="Collapsed" /> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="headerrowstyle" TargetType="telerik:GridViewHeaderRow"> <Setter Property="MinHeight" Value="27"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="telerik:GridViewHeaderRow"> <telerik:SelectiveScrollingGrid> <telerik:SelectiveScrollingGrid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="1*"/> </telerik:SelectiveScrollingGrid.ColumnDefinitions> <Border x:Name="PART_GridViewHeaderRowBorder" BorderBrush="{StaticResource brsh_OuterBorderColor}" BorderThickness="1,0,1,1" Grid.ColumnSpan="4" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <Border BorderBrush="{StaticResource brsh_InnerBorderColor}" BorderThickness="1,1,1,1" Background="{StaticResource brsh_ColumnHeaderFillNormal}"> </Border> </Border> <telerik:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.Row="0" Grid.Column="3" telerik:StyleManager.Theme="{StaticResource Theme}"/> <!-- RowIndicatorVisiblity = Collapsed --> <Border x:Name="PART_IndicatorPresenter" Grid.Row="0" Grid.RowSpan="1" Grid.Column="0" Grid.ColumnSpan="1" Width="16" BorderBrush="Green" Background="YellowGreen" BorderThickness="0,0,1,1" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{TemplateBinding RowIndicatorVisibility}"> </Border> <!-- IndentPresenter (for grouping alignment - items are added here for each grouped column) --> <telerik:IndentPresenter x:Name="PART_IndentPresenter" Grid.Row="0" Grid.Column="1" IndentLevel="{TemplateBinding IndentLevel}" MinHeight="{TemplateBinding MinHeight}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" telerik:StyleManager.Theme="{StaticResource Theme}"> <telerik:IndentPresenter.ItemTemplate> <DataTemplate> <telerik:GridViewHeaderIndentCell> <telerik:GridViewHeaderIndentCell.Template> <ControlTemplate TargetType="telerik:GridViewHeaderIndentCell"> <Border BorderBrush="{StaticResource brsh_OuterBorderColor}" BorderThickness="0,0,1,1" Width="16"> <Border BorderBrush="{StaticResource brsh_InnerBorderColor}" BorderThickness="1" Background="{StaticResource brsh_ColumnHeaderFillNormal}"> </Border> </Border> </ControlTemplate> </telerik:GridViewHeaderIndentCell.Template> </telerik:GridViewHeaderIndentCell> </DataTemplate> </telerik:IndentPresenter.ItemTemplate> </telerik:IndentPresenter> <!-- I think this is only used in the hierarchy tables (not for us) --> <Border x:Name="PART_HierarchyIndentPresenter" BorderBrush="#FF848484" BorderThickness="0,0,1,1" Grid.Column="2" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HasHierarchy, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}" Width="16"> <Border BorderBrush="Red" BorderThickness="1"> <Border.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FF5B5B5B" Offset="1"/> <GradientStop Color="#FF868686"/> <GradientStop Color="#FF4F4F4F" Offset="0.42"/> <GradientStop Color="#FF0E0E0E" Offset="0.43"/> </LinearGradientBrush> </Border.Background> </Border> </Border> </telerik:SelectiveScrollingGrid> </ControlTemplate> </Setter.Value> </Setter> </Style> </Application.Resources> </Application> If I run this application, and group on column "prop4", you should see 8 collapsed groups. I then expand groups "7" and "8" and scroll the grid such that the header for group "8" is just visible at the top of the datagrid... At that point if you collapse group "8", you should see that the grid loses some rows... (You can see the attached picture for a visual of what I mean)... As I have been tryign to replicate this, I have managed to see several similar situations caused by expand/collapse...
