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

ControlsHelper.ContentCharacterCasing not working for Label #3699

Closed
Gerardo-Sista opened this issue Nov 19, 2019 · 2 comments · Fixed by #3706
Closed

ControlsHelper.ContentCharacterCasing not working for Label #3699

Gerardo-Sista opened this issue Nov 19, 2019 · 2 comments · Fixed by #3706
Milestone

Comments

@Gerardo-Sista
Copy link

Gerardo-Sista commented Nov 19, 2019

Hello,
in MahApps v2 if I set

<Label mah:ControlsHelper.ContentCharacterCasing="Upper" Content="{lng:Language Key=WarningsContent}" />

the casing of bound text remains the same as was set in the bound value (lowercase)

Is it normal?

For completeness on labels is applied this simple style in app.xaml:

   <!--LABEL STYLE-->
            <Style TargetType="{x:Type Label}" BasedOn="{StaticResource MahApps.Styles.Label}">
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="FontSize" Value="{StaticResource LabelFontSize}" />
                <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Accent}" />
            </Style>

Thank you.

@timunie
Copy link
Collaborator

timunie commented Nov 29, 2019

HI @Gerardo-Sista ,
currently using mah:ControlsHelper.ContentCharacterCasing="Upper" is not applicateable on Label. You can use mah:ContentControlEx or adjust your Style:

    <Style TargetType="{x:Type Label}">
        <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Label.Text}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <mah:ContentControlEx x:Name="PART_ContentPresenter"
                                          Padding="{TemplateBinding Padding}"
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                          Content="{TemplateBinding Content}"
                                          ContentCharacterCasing="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(mah:ControlsHelper.ContentCharacterCasing)}"
                                          ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                          RecognizesAccessKey="True"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Happy coding
Tim

punker76 pushed a commit to timunie/MahApps.Metro that referenced this issue Nov 30, 2019
punker76 added a commit to timunie/MahApps.Metro that referenced this issue Nov 30, 2019
@punker76 punker76 added this to the 2.0.0 milestone Nov 30, 2019
@Gerardo-Sista
Copy link
Author

Thank you for fixing @punker76 @timunie .
As end user the name ControlsHelper suggests me that can be applied to all controls, so it feels natural to use is for label, textbox etc. etc.

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.

3 participants