Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expander Header removing "_" character

I'm binding the Expander.Header property in XAML to a backing public property of string type in my ViewModel using the MVVM pattern:

public string EnumName {...}

I'm setting this property to "X_Y_Z" but for some strange reason the Expander Header is removing the first underscore character and it is displayed as XY_Z. I tried adding a "\" before or setting it to @"X_Y_Z" but no luck.

Here my XAML binding portion:

<Expander IsExpanded="true" Header="{Binding EnumName}">

Anybody know why I'm getting this behavior? Is it taking the first "_" as a keyboard shortcut or a meta-character?

Thanks,

like image 201
Adolfo Perez Avatar asked Oct 14 '25 08:10

Adolfo Perez


1 Answers

Probably converted to an access-key because there is a Label or a ContentPresenter with RecognizesAccessKey set to true in your Expander.Template.

You can for example switch out the template or escape underscores in your values (two underscores in a row).

like image 107
H.B. Avatar answered Oct 16 '25 20:10

H.B.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!