diff --git a/Perspex.Controls/Primitives/AccessText.cs b/Perspex.Controls/Primitives/AccessText.cs index 2e74bfcc4d..d8df03b50f 100644 --- a/Perspex.Controls/Primitives/AccessText.cs +++ b/Perspex.Controls/Primitives/AccessText.cs @@ -13,6 +13,21 @@ namespace Perspex.Controls.Primitives /// public class AccessText : TextBlock { + /// + /// Defines the property. + /// + public static readonly PerspexProperty ShowAccessKeyProperty = + PerspexProperty.Register("ShowAccessKey", inherits: true); + + /// + /// Gets or sets a value indicating whether the access key should be underlined. + /// + public bool ShowAccessKey + { + get { return this.GetValue(ShowAccessKeyProperty); } + set { this.SetValue(ShowAccessKeyProperty, value); } + } + /// /// Renders the to a drawing context. /// @@ -23,7 +38,7 @@ namespace Perspex.Controls.Primitives int underscore = this.Text?.IndexOf('_') ?? -1; - if (underscore != -1) + if (underscore != -1 && this.ShowAccessKey) { var rect = this.FormattedText.HitTestTextPosition(underscore); var offset = new Vector(0, -0.5);