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

[WASM] SettingsExpander does not render correctly #17312

Closed
MartinZikmund opened this issue Jun 26, 2024 · 1 comment · Fixed by #17645
Closed

[WASM] SettingsExpander does not render correctly #17312

MartinZikmund opened this issue Jun 26, 2024 · 1 comment · Fixed by #17645
Assignees
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification

Comments

@MartinZikmund
Copy link
Member

Current behavior

CommunityToolkit/Windows#393

Expected behavior

No response

How to reproduce it (as minimally and precisely as possible)

No response

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

@MartinZikmund MartinZikmund added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Jun 26, 2024
@ajpinedam ajpinedam self-assigned this Jul 22, 2024
@Xiaoy312 Xiaoy312 changed the title SettingsExpander does not render correctly on WASM [WASM] SettingsExpander does not render correctly Aug 13, 2024
@Xiaoy312 Xiaoy312 assigned Xiaoy312 and unassigned ajpinedam Aug 13, 2024
@ajpinedam
Copy link
Contributor

We found the problem with this issue is connected to the Uno Expander Control.

The SettingsExpander has the following Style Configuration (simplified version):

<Expander>
    <Expander.Header>
        <SettingsCard />
    </Expander.Header>
    <Expander.Content>
        <ItemsControl />
    </Expander.Content>
</Expander>

When rendered, the SettingsCard is part of the Visual Tree, but the Data bound is not correct.

The SettingsCard sets a TemplateBinding from the Expander.Header but due to an issue on the TemplatedParent Syncronization this is returning the wrong information.

Expander Control Template Template (simplified version):

<!-- Expander ControlTemplate -->
<Grid>
    <RowDefinition x:Name="Row0" Height="Auto" />
    <RowDefinition x:Name="Row1" Height="*" />    
    <ToggleButton  Content="{TemplateBinding Header}" Style="{StaticResource ExpanderHeaderDownStyle}" />
    <Border>
        <ContentPresenter Content="{TemplateBinding Content}" Grid.Row="1" />
    </Border>
</Grid>


<!-- Expander Header Control Template (ExpanderHeaderDownStyle) -->
<Grid>
     <ContentPresenter x:Name="ContentPresenter" />
</Grid>

As can be seen, the Header ContentPresenter is inside a ToggleButton. When calling the TemplatedParentSyncronization here, this returns a level dip in the UI tree.

Specifically, in this line of code:

return (this.TemplatedParent as IFrameworkElement)?.TemplatedParent;

It's returning the Expander instead of the SettingsExpander

We believe that @Xiaoy312 PR 17645 will fix this issue since this PR is fixing issues related to the TemplatedParent like this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants