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

[Material][TextBox] Make all property values on Setters from VisualStates accessible via ThemeResources #1469

Closed
ADD-Noureddine-Maachi opened this issue Sep 5, 2024 · 3 comments · Fixed by #1494 or #1495
Assignees
Labels
kind/enhancement New feature or request

Comments

@ADD-Noureddine-Maachi
Copy link

What would you like to be added:

ThemeResources for property values that are currently set directly to Setters in VisualStates.

<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="RootBorder.BorderBrush" Value="{ThemeResource OutlinedTextBoxBorderBrushPointerOver}" />
<Setter Target="ContentElement.Foreground" Value="{ThemeResource OutlinedTextBoxForegroundPointerOver}" />
<Setter Target="PlaceholderElement.Foreground" Value="{ThemeResource OutlinedTextBoxPlaceholderForegroundPointerOver}" />
<Setter Target="HeaderElement.Foreground" Value="{ThemeResource OutlinedTextBoxHeaderForegroundPointerOver}" />
<Setter Target="RootBorder.BorderThickness" Value="2" />
<Setter Target="RootBorder.Padding" Value="0" />
</VisualState.Setters>
</VisualState>

As you can see, the properties RootBorder.BorderThickness and RootBorder.Padding have no ThemeResources like the other Setters.

Why is this needed:

It would be very useful since this way you can easily customize the style referring to the key of the ThemeResource. It would not be convenient to modify the setters in any other way.

Anything else we need to know?

I am having this problem with the Style MaterialOutlinedTextBoxStyle.

@ADD-Noureddine-Maachi ADD-Noureddine-Maachi added the kind/enhancement New feature or request label Sep 5, 2024
@ADD-Noureddine-Maachi
Copy link
Author

ADD-Noureddine-Maachi commented Sep 9, 2024

Besides that, we have found that the behavior of the MinHeight property is not working correctly.

A default Material TextBox with the Style MaterialOutlinedTextBoxStyle has the following values:

Image

We understand that the ActualHeight should also be 56. Is there any element in the Template that is affecting to the TextBox height?

Thanks in advance.

Update

We have found a workaround for now, maybe it can give you some clue or the solution itself.

The workaround is about setting the Height from 38 to 36 to all elements inside the Grid named "Root" (except the ScrollViewer) and changing the ScrollViewer padding from 0,10 to 0,7.

@kazo0
Copy link
Collaborator

kazo0 commented Sep 9, 2024

FYI @agneszitte as I know we had worked on fiddling with these numbers previously

@agneszitte
Copy link
Contributor

agneszitte commented Nov 8, 2024

Hi @ADD-Noureddine-Maachi

The fixes are now available with the latest dev build of Uno Themes, but they haven’t yet been released in a stable version of uno.sdk. We’ll need to conduct additional QA to ensure these changes don’t introduce any regressions.

In the meantime, you can already test the latest fixes by overriding the Uno Themes version specifically (alongside the latest stable uno.sdk version you're currently using). To do so, add the following to your Directory.Build.props file:

<PropertyGroup>
    <UnoThemesVersion>5.4.0-dev.18</UnoThemesVersion>
</PropertyGroup>

Warning

Please remember to remove this override when it’s no longer necessary, once the fixes are included in a stable release of uno.sdk.

Here are the details of the related changes to the Resource Keys with the latest updates:
Material Migration Guide - Upgrading to Uno Themes v-next

Please feel free to reach out to us with any additional feedback as needed.

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