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

Custom Expander style requires BasedOn to be set #18115

Open
kazo0 opened this issue Sep 4, 2024 · 3 comments
Open

Custom Expander style requires BasedOn to be set #18115

kazo0 opened this issue Sep 4, 2024 · 3 comments

Comments

@kazo0
Copy link
Contributor

kazo0 commented Sep 4, 2024

Seems like an issue with winui: microsoft/microsoft-ui-xaml#6528

The suggestion in that issue is to remove the BasedOn. Curious that it is required for non-Windows platforms.

For now, you can use platform conditionals and define this in your xaml

xmlns:not_win="http://uno.ui/not_win"
mc:Ignorable="not_win"

and use this for BasedOn:

not_win:BasedOn="{StaticResource DefaultExpanderStyle}"

I will create an issue in the Uno repo to investigate the need for the BasedOn in Uno platforms

Originally posted by @kazo0 in #17774 (reply in thread)

If you remove the BasedOn="{StaticResource DefaultExpanderStyle}" from the custom Expander style in the attached sample app, it renders properly on Windows but does not display properly on other platforms

ReproWinStyle.zipWithout BasedOn (Windows):

image

Without BasedOn (Android):

image

With BasedOn (Android):

image

@jeromelaban
Copy link
Member

@kazo0 is this a blocker?

@kazo0
Copy link
Contributor Author

kazo0 commented Nov 18, 2024

@jeromelaban it's not blocking anything, just something we noticed

@Xiaoy312
Copy link
Contributor

counter-intuitively, it seems that BasedOn is to be expected?
image

For system controls that use WinUI styles (Windows.UI.Xaml.Controls namespace), set BasedOn="{StaticResource Default<ControlName>Style}", where <ControlName> is the name of the control. [...]
For WinUI 2 controls (Microsoft.UI.Xaml.Controls namespace), the default style is defined in the metadata, so omit BasedOn.
-- https://learn.microsoft.com/en-us/windows/apps/design/style/xaml-styles#avoid-restyling-controls

^ even MS is suggesting that

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

No branches or pull requests

3 participants