Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7626293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:18:23+00:00 2026-05-31T05:18:23+00:00

My Label.Content in WPF doesn’t display the first occurrence of _ character. Why? <Window

  • 0

My Label.Content in WPF doesn’t display the first occurrence of “_” character. Why?

<Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="148" Width="211">
    <Grid>
        <Label Content="L_abel" Height="28" HorizontalAlignment="Left" Margin="37,31,0,0" Name="label1" VerticalAlignment="Top" />
    </Grid>
</Window>

enter image description here

When set Label.Content ="L__abel" :

enter image description here

There is no additional code in project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:18:23+00:00Added an answer on May 31, 2026 at 5:18 am

    _ is used in WPF to signal an access key, i.e. a key you can press with Alt to give focus or invoke an UI element. This is similar to how & is used in the Windows API and Windows Forms. Since labels are intended to be used as the label for another control (to describe a text box, for example), this is pretty much expected. You should see the a in your example underlined when you press Alt.

    From the documentation:

    To set the access key, add an underscore before the character that should be the access key. If your content has multiple underscore characters, only the first one is converted into an access key; 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:

    <Label>__Hello_World</Label> 
    

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

    I guess if you neither require nor want the features Label provides, you may use a TextBlock.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here you have a simple WPF program: <!-- Updater.xaml --> <Window x:Class=Update.Updater xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
I have a details view window in WPF and a label may look like
In a WPF I have a label: <Label Name=lblTest Content=This is a label></Label> If
I have defined the WPF label with content=Label_Label . While displaying it shows LabelLabel
The look of a WPF CheckBox misaligns the check portion with the label (content)
I am playing about with WPF and databinding a Label control's content: <Label Content={Binding
I have a Label, whose content is displayed by a while loop. when i
label { display: block; width: 156px; cursor: pointer; padding-right: 6px; padding-bottom: 1px; } <label
I've implemented a simple WPF splash screen window which informs the user about the
I'm trying to bind a Label's 'Content' property to a property from some custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.