Common interface for controls that support mnemonics (e.g. & character in text)
Remarks: Not all platforms support mnemonics, such as macOS. However, you can still show the mnemonic character in the text by using the & character.
Properties
AlwaysShowMnemonic
#Gets or sets whether the mnemonic character should always be shown, even if the user has not pressed the mnemonic key (e.g. Alt key on Windows)
Remarks: Not all platforms support this, but on those that do, it will always show the mnemonic character in the text. On macOS, this will show the mnemonic character in the text, but it will still not be activated by pressing the mnemonic key (e.g. Alt key). This is useful if you have other logic hat requires the mnemonic character to be visible, such as for accessibility purposes.
Text
#Text to display on the control, including mnemonics (e.g. & character to indicate a mnemonic key) when UseMnemonic is true.
UseMnemonic
#Gets or sets whether the control should use mnemonics in the text (e.g. & character to indicate a mnemonic key)
Remarks: This is true by default, and allows the control to process mnemonics in the text with an ampersand character (e.g. "Click &here" will allow the user to press Alt+H to activate the control). To show a literal ampersand character, you can use a double ampersand (e.g. "Click && here"). Not all platforms support mnemonics, such as macOS, so even if this is set to true, it may not work as expected on those platforms. Setting this to false will stop the control from processing mnemonics in the text, and you no longer need to use double ampersands to show an ampersand character.