Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionToken value? #26

Open
arivoir opened this issue Jun 25, 2020 · 1 comment
Open

ActionToken value? #26

arivoir opened this issue Jun 25, 2020 · 1 comment
Assignees
Labels
needs more info Further information is requested

Comments

@arivoir
Copy link

arivoir commented Jun 25, 2020

I'm wondering how the ActionToken class works.

https://github.com/microsoft/xaml-designer-extensibility/blob/master/documents/xaml-suggested-actions/xaml-designer-suggested-actions-extensibility.md

  • Why do we need it? Why not simply specify the property Name?
  • What is the "value" parameter in the constructor?
  • What if value is not specified, or the same value is used?
@thsparks
Copy link
Contributor

The ActionToken class allows us to lookup and refer to specific actions or action groups within a provider.

To answer your questions:

  1. We cannot use property name because ActionGroups don't have a property, and not all Actions refer to one either. (For example, Link Actions and Command Actions may not.)
  2. The "value" parameter defines a unique integer id for the given ActionToken. All ActionTokens should be assigned one. If you don't, it may not work. However, if you create an ActionGroup or Action without a token, that is okay. You just won't be able to look it up or refer to it later.
  3. If the same ActionToken value is used for multiple Actions/ActionGroups within a provider, that will also break your ability to look them up later on. If you're inheriting from an existing ActionProvider and wish to avoid duplicates, you can use the Last_Token field to ensure that you don't conflict with any tokens from inherited types. You can see an example of this in our Example for Inherited Controls.

Hopefully that answers your questions. We have some additional documentation on ActionTokens here: Suggested Actions Tokens. Please also feel free to follow up on this thread if you have any more questions, or close the thread if you're satisfied.

Thanks,
Thomas

@thsparks thsparks added the needs more info Further information is requested label Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants