Hello, the documentation for the BeginEdit command shows there's a property exposed called Parameter, and it states "Gets an optional parameter holding additional information associated with the operation." However, I can't seem to be able to find any documentation regarding its usage. I would like to pass a custom object to this command, how can I accomplish this?
I'm using it inside of a Telerik RadDataGrid. The following is what the command looks like attached to the grid, where "tg" is "using:Telerik.UI.Xaml.Controls.Grid" and "local" is simply where the three command classes live in my project.
SomeArbitraryView.xaml:
<tg:RadDataGrid.Commands>
<local:CustomBeginEditCommand />
<local:CustomCommitEditCommand />
<local:CustomDataBindingCompleteCommand />
</tg:RadDataGrid.Commands>
The next snippet is what the BeginEdit class looks like, boiled down to the essentials.
CustomBeginEditCommand.cs:
using Microsoft.Toolkit.Uwp.Helpers;
using System.Collections.Generic;
using Telerik.UI.Xaml.Controls.Grid;
using Telerik.UI.Xaml.Controls.Grid.Commands;
namespace YourNamespace
{
public class CustomBeginEditCommand : DataGridCommand
{
public CustomBeginEditCommand()
{
Id = CommandId.BeginEdit;
}
public override bool CanExecute(object parameter)
{
return true;
}
public override void Execute(object parameter)
{
var context = parameter as EditContext;
DataGridCellInfo cellInfo = context.CellInfo;
// Here is what Telerik offers us to access this optional parameter, but it's always null by default until I can figure out how to pass my custom object
var optionalParam = context.Parameter;
// ...
Owner.CommandService.ExecuteDefaultCommand(CommandId.BeginEdit, context);
}
}
}
My knee-jerk reaction is to have something right in the XAML that I can fill with my custom object, but that doesn't seem to be a valid solution. Any help is appreciated!