Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header Text with underscore not working #3715

Closed
thomas-karl opened this issue Dec 23, 2019 · 2 comments · Fixed by #3717
Closed

Header Text with underscore not working #3715

thomas-karl opened this issue Dec 23, 2019 · 2 comments · Fixed by #3717
Assignees
Milestone

Comments

@thomas-karl
Copy link

Describe the bug
If you bind the GroupBox header to a text property in your view model like that:
<GroupBox Header="{Binding HeaderText}" />
and your property HeaderText is a string with Content "Header_Text", the text is not displayed as expected.

Expected behavior
I would expect the header text to display "Header_Text", while it displays "HeaderText".

Reason for this seems to be the ContentPresenter.RecognizesAccessKey Property, which is set to true by default for the GroupBox's HeaderContent via ContentControlEx.

Is this by design and if so, should it be configurable?

As a workaround I put a TextBlock in Header like this:

<GroupBox>
    <GroupBox.Header>
        <TextBlock Text="{Binding HeaderText}" />
    </GroupBox.Header>
</GroupBox>

Environment

  • MahApps.Metro version 1.6.5
  • OS: Win10 1903
  • Visual Studio 2017 15.9.17
  • .NET Framework 4.6.1

Many thanks in advance!

@punker76 punker76 self-assigned this Dec 23, 2019
@punker76 punker76 added this to the 2.0.0 milestone Dec 23, 2019
@punker76 punker76 added the Bug label Dec 23, 2019
punker76 added a commit that referenced this issue Dec 25, 2019
…cessKey

Introduce a new attached dependency property ControlsHelper.RecognizesAccessKey to allow set the RecognizesAccessKey of controls which has a ContentControlEx inside.
punker76 added a commit that referenced this issue Dec 26, 2019
Introduce new attached property ControlsHelper.RecognizesAccessKey
@punker76
Copy link
Member

@thomas-karl You can change this default behavior (from WPF) with the new attached property ControlsHelper.RecognizesAccessKey.

@thomas-karl
Copy link
Author

Thank you very much! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants