XamWebGrid-
I have to Move up and down the XamWebGrid row on Move up and move down button.
Please suggest the way.
-Pankaj
Ok Done.Got it.
Really appreciate your help.
Thanks
Its just my data object.
ObservableCollection<Comic> _data;
You would replace it with your own data object.
-SteveZ
Yes the same functionality I want. But Could you please tell me what is the Comic in your code.
Hi Pankaj,
I"m not sure what you mean?
Are you saying that when a user hits the up and down key on the grid, you need to move the active row in the collection?
If so, it'd look something like this:
grid.ItemsSource = this._data;
grid.AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(grid_KeyDown), true);
void grid_KeyDown(object sender, KeyEventArgs e) {
if (grid.ActiveCell != null) {
if (e.Key == Key.Down) {
// B/c the grid already handled the keydown and changed the active cell.
int index = grid.ActiveCell.Row.Index - 1;
Comic data = (Comic)grid.Rows[index].Data;
this._data.Remove(data);
this._data.Insert(index + 1, data);
// Delay so the row has time to be rendered.
this.Dispatcher.BeginInvoke(() => {
grid.ActiveCell = grid.Rows[index + 1].Cells[0];
});
}
else if(e.Key == Key.Up)
{
Hope this helps,