Skip to content

DefaultExpanderStyle not public #11005

@Mangepange

Description

@Mangepange

Describe the bug

When I construct a Style like this:

<StackPanel>
    <StackPanel.Resources>
        <Style x:Key="MyExpanderStyle"
               BasedOn="{CustomResource DefaultExpanderStyle}"
               TargetType="Expander">
            <Setter Property="MinHeight" Value="16" />
            <Setter Property="MinWidth" Value="36" />
            <Setter Property="Padding" Value="0" />
        </Style>
    </StackPanel.Resources>
    <Expander Content="Something"
              Header="Test"
              Style="{StaticResource MyExpanderStyle}" />
</StackPanel>

I get an exception, "Cannot find a Resource with the Name/Key DefaultExpanderStyle".
I have found the style defined in the generic.xaml:

    <Style TargetType="controls:Expander" BasedOn="{StaticResource DefaultExpanderStyle}" />
    <Style x:Key="DefaultExpanderStyle" TargetType="controls:Expander">

But it doesn't look like it's exposed?

Trying to override some specific resouce values, for example ExpanderMinHeight and ExpanderHeaderPadding does not work, but several of the other resources used in the Expander style works, for example ExpanderChevronButtonSize and ExpanderContentBackground.

Why is this important?

Because all other controls have default styles that are public.

Steps to reproduce the bug

Create a Style which is BasedOn DefaultExpanderStyle.

Actual behavior

No response

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.8.5: 1.8.260209005

Windows version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions