Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
AccessText Class
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
AccessText Class

Updated: November 2007

Specifies with an underscore the character that is used as the access key.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/xaml/presentation

Visual Basic (Declaration)
<ContentPropertyAttribute("Text")> _
Public Class AccessText _
    Inherits FrameworkElement _
    Implements IAddChild
Visual Basic (Usage)
Dim instance As AccessText
C#
[ContentPropertyAttribute("Text")]
public class AccessText : FrameworkElement, IAddChild
Visual C++
[ContentPropertyAttribute(L"Text")]
public ref class AccessText : public FrameworkElement, 
    IAddChild
J#
/** @attribute ContentPropertyAttribute("Text") */
public class AccessText extends FrameworkElement implements IAddChild
JScript
public class AccessText extends FrameworkElement implements IAddChild
XAML Object Element Usage
<AccessText>
  Text
</AccessText>

If your content has multiple underscore characters, only the first one is converted into an AccessKey; the other underscores appear as normal text. If the underscore that you want converted to the access key is not the first underscore, use two consecutive underscores for any underscores that precede the one that you want to convert. For example, the following code contains an access key and displays as _HelloWorld:

<AccessText>__Hello_World</AccessText> 

Because the underscore that precedes H is a double, the W key registers as the access key.

To use AccessText as a content host in a control style, set RecognizesAccessKey in the ContentPresenter, as this example shows:

<ContentPresenter RecognizesAccessKey="True"/> 

You can use the AccessText tag to create an AccessKey; however, a tag is not necessary. The following example shows how to create an access key with and without the AccessText tag.

C#
<Button Click="edit_Click">
  <AccessText>_Edit</AccessText>
</Button>
<Button Click="cut_Click">_Cut</Button>

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows Vista

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker