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

Scrolling two grids

9 Answers 358 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dmitry
Top achievements
Rank 1
Dmitry asked on 23 Apr 2009, 05:14 PM
I have a scenario where i have two grids side-by-side in my WPF app and as i scroll one grid id like to scroll the second one to keep in sync. both grids will contain one column that will have a matching key.

how can i accomplish this?

9 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 24 Apr 2009, 01:34 PM
Hello Dmitry,

I am sending you a sample that demonstrates how you can sync two grids.

Sincerely yours,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dmitry
Top achievements
Rank 1
answered on 24 Apr 2009, 09:10 PM
This is a very interesting example, thank you, it does do the basics of what I need.

The only concern I have is what happens when one of the grids is sorted. Id need to keep the grids in sync then by a key value (which will be the only thing matching between them) and not an exact visual position. I have some ideas but I welcome more suggestions.
0
Kristjan Einarsson
Top achievements
Rank 1
answered on 10 Jan 2012, 03:55 PM
Hi I am having some trouble using this in .Net 4. I have Q3 2011 SP1 Installed, Have you disabled this feature ?
0
Kristjan Einarsson
Top achievements
Rank 1
answered on 10 Jan 2012, 05:02 PM
To be more precise I get this error:
'Telerik.Windows.Controls.RadGridView' does not contain a definition for 'ItemsControl' and no extension method 'ItemsControl' accepting a first argument of type 'Telerik.Windows.Controls.RadGridView' could be found (are you missing a using directive or an assembly reference?)

Regards
Kristján
0
Maya
Telerik team
answered on 10 Jan 2012, 05:44 PM
Hello,

You can use ChildrenOfType<T> extension method and find the required ScrollBar-s and GridViewScrollViewer-s. I am attaching the updated sample with binaries from our current official release.

 

Greetings,
Maya
the Telerik team

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

0
Kristjan Einarsson
Top achievements
Rank 1
answered on 11 Jan 2012, 10:38 AM
Works like a charm, thank you.

ps. do you have any tips if on of the grids has two more columns that are frozen,, or will that always be a problem ?
Thanks again
kristján
0
Maya
Telerik team
answered on 12 Jan 2012, 08:43 AM
Hello,

Could you clarify a bit - what is the exact behavior that you require in case there are frozen columns ? 

Greetings,
Maya
the Telerik team

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

0
Kristjan Einarsson
Top achievements
Rank 1
answered on 12 Jan 2012, 09:55 AM
Hi again,
Yes, in the grid with the frozen columns has two more columns so the two grids don't scroll at the same pace
Example
grid 1
frozen1| frozen2|Col1|Col2|Col3......
grid 2
Col1|Col2|Col3......

So my temp solution for now is to put two columns in the grid 2 with an empty header and freeze them, then put width on those frozen columns, that way I get the same scroll for both grids..... I was just wondering if there is any other way to accomplish that ? Otherwise this works well.

Cheers
kristján  
0
Maya
Telerik team
answered on 12 Jan 2012, 10:58 AM
Hello,

I believe such functionality cannot be easily supported since the width of the columns needs to be calculated, the speed of scrolling as well. 
Nevertheless, I am happy to see that you find a proper solution for your specific scenario that fits your current requirements.


Kind regards,
Maya
the Telerik team

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

Tags
GridView
Asked by
Dmitry
Top achievements
Rank 1
Answers by
Milan
Telerik team
Dmitry
Top achievements
Rank 1
Kristjan Einarsson
Top achievements
Rank 1
Maya
Telerik team
Share this question
or