I want to add "paste to selected cell" command to Row. I don't want to change SelectionMode="Extended".
I've added RoutedUICommand:
private void PasteToCell_Executed(object sender, ExecutedRoutedEventArgs e)
{
GridViewCell cell = e.OriginalSource as GridViewCell;
if (cell != null)
{
var value = Clipboard.GetText();
cell.BeginEdit();
TextBox tb = (TextBox)cell.GetEditingElement();
1 -> tb.Text = value;
2 -> if (ApplicationCommands.Paste.CanExecute(value, tb))
ApplicationCommands.Paste.Execute(value, tb);
3 -> cell.Value = value;
4 -> cell.SetCurrentValue(GridViewCell.ValueProperty, value);
5 -> cell.SetValue(GridViewCell.ValueProperty, value);
cell.CommitEdit();
}
}
No one work. I don't know how to realize this feature.
I've added RoutedUICommand:
private void PasteToCell_Executed(object sender, ExecutedRoutedEventArgs e)
{
GridViewCell cell = e.OriginalSource as GridViewCell;
if (cell != null)
{
var value = Clipboard.GetText();
cell.BeginEdit();
TextBox tb = (TextBox)cell.GetEditingElement();
1 -> tb.Text = value;
2 -> if (ApplicationCommands.Paste.CanExecute(value, tb))
ApplicationCommands.Paste.Execute(value, tb);
3 -> cell.Value = value;
4 -> cell.SetCurrentValue(GridViewCell.ValueProperty, value);
5 -> cell.SetValue(GridViewCell.ValueProperty, value);
cell.CommitEdit();
}
}
No one work. I don't know how to realize this feature.