GridView In RadPane re-get's bound ItemsSource when (un)pinned

4 posts, 0 answers
  1. Chris Andrews
    Chris Andrews avatar
    41 posts
    Member since:
    Mar 2010

    Posted 01 Sep 2010 Link to this post

    Hello,

    I've searched the forums and tickets but can't seem to find my specific scenario.

    Basically, we have a RadGridView in a RadDocking Pane.  The ItemsSource is bound to a property which is an ObservableCollection.  The issue we are having is when the pane is either pinned or unpinned, the ItemsSource is retrieved again from the property causing scroll position, filters, etc... to be re-set as if the grid was initially loaded.

    Is there any way to prevent this from happening, or could this be a bug?  I would like to avoid using an explicit binding mode if possible.

    Thanks for the help,
    Chris
  2. Chris Andrews
    Chris Andrews avatar
    41 posts
    Member since:
    Mar 2010

    Posted 01 Sep 2010 Link to this post

    Update:

    After some trial and error, I found the workaround I was needing.

    Basically, if I set the datacontext to the pane directly, it seems to work just fine.

    Sharing this for others that may have a similiar issue.

    Before:
    <telerik:RadPane Title="Pane 1">
        <telerik:RadGridView ItemsSource="{Binding EmployeeList}" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding LastName}" Header="Last Name"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Married}" Header="Is Married"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </telerik:RadPane>

    After:
    <telerik:RadPane Title="Pane 1" DataContext="{Binding EmployeeList}">
        <telerik:RadGridView ItemsSource="{Binding}" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding LastName}" Header="Last Name"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Married}" Header="Is Married"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </telerik:RadPane>
  3. Dan
    Dan avatar
    1 posts
    Member since:
    Jan 2016

    Posted 26 Sep in reply to Chris Andrews Link to this post

    As per the above solution, I bind the property as DataContext in RadPane. And filter operation is works fine.

    Below is the code snippet for reference

    <telerik:RadPane  x:Name="errorView"  telerik:RadDocking.SerializationTag="PaneBottom" DataContext="{Binding ApplicationErrorContentControl.ErrorLog}"
                                                 CanFloat="True"
                                                 CanUserClose="False" 
                                                 Header="Error"
                                                 IsPinned="False">
                            <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                                <commonView:ApplicationErrorView />
                            </ScrollViewer>
                        </telerik:RadPane>

       Inside the RadPane I placed "ApplicationErrorView" and its ViewModel is ApplicationErrorContentControl. The issue we are facing is "ViewModel - ApplicationErrorContentControl" is not been set as DataContext anywhere. Due to this the other events raised in View are not getting called in its associated ViewModel.

     

     

     

     

  4. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1406 posts

    Posted 29 Sep Link to this post

    Hello Dan,

    I contacted you in your ticket (#1132306).

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top