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

[Solved] Not getting Scrolling offset value of RadGridView

8 Answers 253 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.
Deepak Agarwal
Top achievements
Rank 1
Deepak Agarwal asked on 08 Jul 2010, 12:18 PM

In my application, I fill Rad grid view with near about 1000 records and refill the gird in every 45 seconds. In mid of refresh, If user has scrolled the grid vertically or horizontally then after refresh Horizontal and vertical scrolling bar moves onto to the top and left corner. So I just want to fix them where user left the scrolling bar and for that I need the value of scrolling offset of rad grid view but I am not able to fetch that.

Please help me to get and reset Scrolling Vertical and
horizontal offset value from Rad Grid View.

8 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 08 Jul 2010, 12:26 PM
Hello Deepak Agarwal,

 You can get the GridView's ScrollViewer like so:

var viewer = this.radGridView1.FindChildByType<GridViewScrollViewer>();

and you can manipulate it as you see fit.

Kind regards,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Deepak Agarwal
Top achievements
Rank 1
answered on 08 Jul 2010, 06:37 PM
Thanks. Its working successfully
0
Jarred Froman
Top achievements
Rank 1
answered on 24 Sep 2010, 08:06 PM

I've been trying to accomplish something similar as well... except, I'm trying to refresh the cells of the grid after a cell is edited.  Within the cell's CellEditEnded event, I have the following code:

var scrollViewer = this.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
var verticalPosition = scrollViewer.VerticalOffset;
var horizontalPosition = scrollViewer.HorizontalOffset;
  
Dispatcher.BeginInvoke(() =>
    {
        Items.Refresh();
        scrollViewer.ScrollToHorizontalOffset(horizontalPosition);
        scrollViewer.ScrollToVerticalOffset(verticalPosition);
    });

This works fine if I click off in to another cell to trigger the EditEnded event, but if I use the Enter or Tab key, the screen moves around and then doesn't move back to the same position it was in originally.  Any ideas of what could cause this or any suggestions for alternative solutions?

Thanks,
-Jarred Froman
0
Vlad
Telerik team
answered on 27 Sep 2010, 06:43 AM
Hello Jarred,

 Can you post more info about your scenario? Usually if the data object is INotifyPropertyChanged the cell value will be updated automatically - you do not need to scroll or stuff like this.  

Regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jarred Froman
Top achievements
Rank 1
answered on 27 Sep 2010, 04:18 PM
We are overriding the CreateCellElement to change the color of other cells based on the data entered, so I'm not sure how to do that properly with just firing a notifypropertychanged on the value itself.  I tried triggering it on those cells which should be updated, but that doesn't seem to call the CreateCellElement.  The only clear solution I could see so far was a refresh, although if there is a cleaner solution, I am all ears!

Thanks,
-Jarred Froman
0
Pavel Pavlov
Telerik team
answered on 29 Sep 2010, 10:12 AM
Hello Jarred Froman,

If I understand the requirement correctly - you need to conditionally colorize cells, based on their value.

The typical approach here would be.

1. Your business object should implement the INotifyPropertyChanged interface. This way , when the value changes , RadGridView will know to refresh the UI.

2. You may bind the color of the cell to the value, using an IValueConverter. ( something like value to color converter) .

In case this sounds obscure, just let me know and I will provide some additional assistance.


Kind regards,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jarred Froman
Top achievements
Rank 1
answered on 29 Sep 2010, 09:02 PM
I've created converters before but I'm not having any luck binding to the color of the cell.  Would you be able to provide a quick sample?

Thanks,
-Jarred Froman
0
Vlad
Telerik team
answered on 30 Sep 2010, 07:24 AM
Hello,

 You can check this blog post and this demo for more info about conditional formating of cells. 

All the best,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Deepak Agarwal
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Deepak Agarwal
Top achievements
Rank 1
Jarred Froman
Top achievements
Rank 1
Vlad
Telerik team
Pavel Pavlov
Telerik team
Share this question
or