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

SplitButton is drawed incorrectly when IsEnabled=false by default and then enabled back #9656

Open
Prochy opened this issue May 14, 2024 · 2 comments
Labels
area-SplitButton team-Controls Issue for the Controls team

Comments

@Prochy
Copy link

Prochy commented May 14, 2024

Describe the bug

If I set IsEnabled=false by default for SplitButton, then I enabled it e.g. by binding, the control is rendered wrong until I hover over the control. After the hover over the control, it is drawn correctly. (See attached pictures)

There is workaround but ofc it's not ideal. The workaround is to have IsEnabled = enable at the start and switch false to on loaded event. Then it looks like it works fine.

Steps to reproduce the bug

I attached an app sample but short the steps are following:

  1. Create simple xaml with SplitButton control:
    Enable split button
2. Create Enabled property that has "False" value 3. Change the Enabled property to True when the item is rendered. 4. [sample.zip](https://github.com/microsoft/WindowsAppSDK/files/15308750/sample.zip)

Expected behavior

The SplitButton should be rendered in the same way as it is when the SplitButton is enabled by default from the app start.

Screenshots

After start
image
After enabling the SplitButton
image
After hovering over the control and put mouse control out of the control rectangle
image

NuGet package version

Windows App SDK 1.5.3: 1.5.240428000

Packaging type

Unpackaged

Windows version

Windows 10 version 22H2 (19045, 2022 Update)

IDE

Visual Studio 2022-preview

Additional context

No response

@Prochy Prochy changed the title SplitButton is drawed incorrectly when IsEnabled=false by default and then enabled SplitButton is drawed incorrectly when IsEnabled=false by default and then enabled back May 14, 2024
@Prochy
Copy link
Author

Prochy commented May 17, 2024

Another workaround is to refresh style on IsEnabledChanged event. I'm using custom split button style in my app and this code works fine as well.

IsEnabledChanged="SplitButton_IsEnabledChanged"
Style="{ThemeResource CustomSplitButtonStyle}"

private void SplitButton_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
var splitButton = sender as SplitButton;
var style = splitButton.Style;
splitButton.Style = null;
splitButton.Style = style;
}

@codendone codendone transferred this issue from microsoft/WindowsAppSDK May 23, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label May 23, 2024
@codendone codendone added team-Controls Issue for the Controls team area-SplitButton and removed needs-triage Issue needs to be triaged by the area owners labels May 23, 2024
Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-SplitButton team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

2 participants