Hi,
I have the following situation:
When i change ItemsSource the layout become corrupted:
What i found out is in OnItemsSourceChanged in GridViewDataControl
there is if statement:
The problem occurs in Bind method. When in debug i skip Bind and move cursor
to else statement the grid displayed correctly:
This situation could be prevented if i scroll through all columns to the end.
In this case all displayed correctly.
Also this behavior fixed when i add grouping by dragging column to group panel.
I hope you will help me to overcome this problem.
Best regards,
Roman Denysenko
I have the following situation:
- columns are created in code. There are 20 columns.
- ItemsSource is ICollectionView
- grid has grouping by one column
<
telerik:RadGridView
x:Name
=
"SearchResults"
ShowGroupPanel
=
"True"
IsReadOnly
=
"True"
AutoGenerateColumns
=
"False"
CanUserFreezeColumns
=
"False"
RowIndicatorVisibility
=
"Collapsed"
FrozenColumnCount
=
"1"
ItemsSource
=
"{Binding ResultsSource}"
SelectionMode
=
"Single"
SelectedItem
=
"{Binding SelectedItem, Mode=TwoWay}"
Grid.Row
=
"1"
RowDetailsVisibilityMode
=
"VisibleWhenSelected"
AutoExpandGroups
=
"True"
EnableColumnVirtualization
=
"True"
EnableFloatingButtons
=
"True"
EnableRowVirtualization
=
"True"
EnableActionButton
=
"True"
>
</
telerik:RadGridView:GridView
>
When i change ItemsSource the layout become corrupted:
- the count of visible columns becomes 12, but the real number is 20
- the group descriptor disappears
What i found out is in OnItemsSourceChanged in GridViewDataControl
there is if statement:
if
(
this
.ControlLoaded || (
this
.ParentOfType<UIElement>() ==
null
))
{
if
(!
this
.CommitEdit())
{
this
.CancelEdit();
}
if
(
this
.VirtualizingPanel !=
null
)
{
this
.VirtualizingPanel.ClearBringIntoViewContainer();
}
if
((
this
.ItemsScrollViewer !=
null
) && !
this
.ShouldKeepScrollState)
{
this
.ItemsScrollViewer.ScrollToTop();
if
(
this
.ItemsScrollViewer.VerticalOffset > 0.0)
{
base
.UpdateLayout();
}
this
.ItemsScrollViewer.InvalidateScrollInfo();
}
base
.ItemContainerGenerator.Refresh();
this
.InvalidateInternalParts(
true
);
base
.InvalidateMeasure();
base
.InvalidateArrange();
this
._rowTrackingRoot.Clear();
this
.InternalColumns.RecreateColumnsBlockListForVirtualizedRows =
true
;
this
.InternalColumns.RecreateColumnsBlockListForNonVirtualizedRows =
true
;
this
.InternalColumns.InvalidateColumnWidthsCalculation();
this
.Bind(newValue);
}
else
{
this
.shouldBind =
true
;
this
.NewDataSource = newValue;
}
The problem occurs in Bind method. When in debug i skip Bind and move cursor
to else statement the grid displayed correctly:
this
.shouldBind =
true
;
this
.NewDataSource = newValue;
This situation could be prevented if i scroll through all columns to the end.
In this case all displayed correctly.
Also this behavior fixed when i add grouping by dragging column to group panel.
I hope you will help me to overcome this problem.
Best regards,
Roman Denysenko