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

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

3 Answers 152 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris Andrews
Top achievements
Rank 1
Chris Andrews asked on 01 Sep 2010, 04:56 PM
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

3 Answers, 1 is accepted

Sort by
0
Chris Andrews
Top achievements
Rank 1
answered on 01 Sep 2010, 06:15 PM
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>
0
Dan
Top achievements
Rank 1
answered on 26 Sep 2017, 12:26 PM

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.

 

 

 

 

0
Martin Ivanov
Telerik team
answered on 29 Sep 2017, 07:59 AM
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.
Tags
GridView
Asked by
Chris Andrews
Top achievements
Rank 1
Answers by
Chris Andrews
Top achievements
Rank 1
Dan
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or