User (Old forums)MemberJuly 24, 2007 at 8:52 amPost count: 23064
Hi I’m writing a navigator control that will be part of my grid footer. It will have the commands listed below, at the end of this message.
I have 3 questions I need help with, ** Many Thanks In Advance **, Rich
(1) How can I determine the first and last visible row in the view port after a ScrollViewer change ? In other words, how do I determine the underlying item for the first virtualized row currently displayed on screen?
I would like my navigator PageUp/PageDown/First/Last commands to mimc the way the grid works but I can’t find any existing command bindings to re-use, so I created my own.
The default grid PageUp/PageDown/Ctrl-PageUp/Ctrl-PageDown behavior pages to the requested location and moves the CurrentItem be the first or last row in the ScrollViewer Viewport.
How could I mimic this behavior?
Using the method below I’m able to call ScrollViewer.PageDown() for example to page down, but I don’t know which rows are currently displayed in the Viewport and therefore do not know which row to make the new CurrentItem.
For my PageUp/PageDown commands I’m using the ScrollViewer as shown:
ScrollViewer sv = dataGrid.Template.FindName(“PART_ScrollViewer”, navi.XceedDataGrid) as ScrollViewer;
if (sv != null)
(2) What Command or method should be called to mimic the “ESC” key feature? Using Cell.CancelEdit appears to commit the current edit in progress.
For my CancelEdit command I call CancelEdit on the current cell as follows:
Cell currentCell = …
(3) Will v1.2 include a navigator control or additonal grid commands to make it easiser to write one?
COMMAND LIST FOR THE MY FOOTER NAVIGATOR CONTROL which is under CONSTRUCTION:
static public RoutedUICommand PreviousItem;
static public RoutedUICommand NextItem;
static public RoutedUICommand FirstItem;
static public RoutedUICommand LastItem;
static public RoutedUICommand PageDown;
static public RoutedUICommand PageUp;
static public RoutedUICommand CancelEdit;
static public RoutedUICommand BeginEdit;
static public RoutedUICommand EndEdit;
static public RoutedUICommand DeleteItem;
static public RoutedUICommand RestoreItem;
Imported from legacy forums. Posted by Richard (had 721 views)Xceed SupportMemberAugust 6, 2007 at 8:25 amPost count: 5658
1) The first visible row can be determined by accessing the ScrollViewer’s “VerticalOffset” (if the panel has Vertical orientation).
From that offset, you can call myDataGridControl.GetContainerFromIndex( first ) to obtain the UI Element for the row (Note: it is possible that the element returned is not for a Data item. e.g. GroupHeaderControl ).
Same goes for the last visible, but instead of VerticalOffset, you can use: VerticalOffset + ViewportHeight – 1
2) The problem here is not that the Cell.CancelEdit commits the edition, its mainly because as soon as you click elsewhere, the current row in edition gets commited…
There is currently no workaround to avoid this “limitation”…
3) No Navigator is to be included in v1.2, some additional command (not a ton however) but none of those listed in your post…
Imported from legacy forums. Posted by Marcus [Xceed] (had 2635 views)
- You must be logged in to reply to this topic.