Select to view content in your preferred language

How to create a custom category for an added layer through the Operation class for the undo/redo stack

236
0
02-25-2025 06:23 AM
DaveLewis73
Regular Contributor

I am having difficulty being able to create a custom category for adding a map layer through the Operation class that will go into the undo/redo stack using C# and the 3.1 SDK.  By default, it appears that the category for a new layer is simply "Mapping."  However, I want to add layers that I can find and differentiate them from others in the undo/redo stack with a custom category, like "MyCategory" (or something else).  I would ultimately like to be able to make a call to eventually remove these custom layers from the undo/redo stack when they are no longer needed with some code, like map.OperationManager.ClearUndoCategory("MyCategory").  I have tried subclassing the Operation class into a new class that I could define the custom category with, but this doesn't appear to be possible in the 3.1 SDK because "Category" appears to be read only.  I have read online that it is possible to assign a custom category to an operation, but haven't found a workable option (including using ChatGPT).  Is this possible and if so how would I go about doing it?

0 Kudos
0 Replies