Losing RadGridView.GroupDescriptors on rebind

2 posts, 0 answers
  1. Paul Whittam
    Paul Whittam avatar
    3 posts
    Member since:
    Oct 2006

    Posted 22 Nov 2011 Link to this post

    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
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 24 Nov 2011 Link to this post

    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 >>

Back to Top