I created a custom function to update a feature attribute.
I started by adding a dock pane and binding an update action to a button.
The update was a success, but I cannot undo it with the built-in undo button of ArcGIS Pro, which is dimmed. I can only discard the edit by using the discard button. I am wondering what's wrong. I would be grateful if anyone could point me in a direction.
part of the dock pane xaml
<Button Content="Update"
Command="{Binding Update}"/>
part of the C# of the ViewModel
private ICommand update;
public ICommand Update
{
get
{
if (update == null)
{
update = new RelayCommand(() => UpdateFeatureNumber());
}
return update;
}
}
private void UpdateFeatureNumber()
{
QueuedTask.Run(() =>
{
EditOperation editOperation = new EditOperation
{
Name = "Update Attribute"
};
editOperation.Modify(currentRow, "Field", value);
if (editOperation.Execute())
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Updated.", "Update Attribute", MessageBoxButton.OK, MessageBoxImage.Information);
return;
}
});
}