This is a migrated thread and some comments may be shown as answers.

Losing RadGridView.GroupDescriptors on rebind

1 Answer 135 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Paul Whittam
Top achievements
Rank 1
Paul Whittam asked on 22 Nov 2011, 04:53 PM
Hi,
I'm having problems with my RadGridView losing it's GroupDescriptors when the underlying source data is refreshed - the Group is configured in the xaml.
I have seen on other posts that this is by design (from telerik), but I have tried re-applying the group descriptors on the DataLoaded event, but I am presented with an error at runtime stating that I cannot alter the ObservableColelction during data load.

My xaml is as follows:
<telerik:RadGridView x:Name="AccountsGridView" FontSize="11" Margin="5" AutoGenerateColumns="False"
                                           ItemsSource="{Binding AccountsList,Mode=TwoWay}"
                                           IsFilteringAllowed="True" 
                                           CanUserResizeColumns="False"
                                           CanUserSortColumns="False"
                                           RowIndicatorVisibility="Collapsed"
                                           Visibility="{Binding Text, ElementName=AccountWarningText,
                                           Converter={StaticResource RequestWarningVisibilityConverter},
                                           FallbackValue=Collapsed, ConverterParameter=RadGridView}"
                                           DragElementAction="None"
                                           ShowGroupPanel="True" IsReadOnly="True"
                                           AutoExpandGroups="True" CanUserSelect="False" CanUserReorderColumns="False">
                           <telerik:RadGridView.GroupDescriptors >
                               <telerik:GroupDescriptor Member="Status" SortDirection="Ascending" />
                           </telerik:RadGridView.GroupDescriptors>
                           <telerik:RadGridView.Columns>
                               <telerik:GridViewDataColumn Header="Account" DataMemberBinding="{Binding AccountName }" IsSortable="True"/>
                               <telerik:GridViewDataColumn Header="OB" DataMemberBinding="{Binding OpeningBalance }" IsSortable="True"/>
                               <telerik:GridViewDataColumn Header="Status"  DataMemberBinding="{Binding Status }"  IsSortable="True" IsVisible="False" />
                               <telerik:GridViewDataColumn Header="Year To Date"  DataMemberBinding="{Binding PeriodToDate }" IsSortable="True"/>
                               <telerik:GridViewDataColumn Header="Planned"  DataMemberBinding="{Binding ProjectedPeriod }"   IsSortable="True"/>
                               <telerik:GridViewDataColumn Header="Balance"  DataMemberBinding="{Binding Balance }"  IsSortable="True"/>
                           </telerik:RadGridView.Columns>
                       </telerik:RadGridView>

I think that the issue is based around the fact that the ItemSource is bound to a ViewModel, and that in turn is populated by an Async WCF Service call, therefore I cannot inform the xaml (or xaml.cs) when the call is complete in order to be able to re-apply the GroupDescriptors.
I wonder if you could give some advice on the direction I should be looking please.

Thank you

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 24 Nov 2011, 01:23 PM
Hello Paul Whittam,

I was not able to get the case when I loose the GroupDescriptors on Rebind of my Asynchronously loaded GridView. You could try to define the GroupDescriptors on the bound , for example, ICollectionView instead of defining them on the GridView.

If this does not help, then could you please give us some more information regarding what is the type of the bound collection? It would be better if you could send us some test application, which we could test at our end.

Kind regards,
Didie
the Telerik team

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

Tags
GridView
Asked by
Paul Whittam
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or