Google News
logo
WPF - Interview Questions
What is WPF accesstext Control?
The AccessText control in WPF converts a character preceded by an underscore to an Access Key. The Access Key is registered and therefore raises an event when pressed.
 
Creating an AccessText
 
The AccessText element represents an AccessText control in XAML. 
 
<AccessText>_Click Me</AccessText>
 
The following code snippet adds an AccessText to a Button control. The button control click event will be raised when you select the ALT+C keys on the keyboard.
<Button Name="Button1" Width="120" Height="50" Margin="33,70,59,124" FontSize="16" Click="Button1_Click">
    <AccessText>_Click Me</AccessText>
</Button>
If there are 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.
Advertisement