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

ColorPickerButton SelectedColor binding not updating correctly #4367

Closed
3 of 20 tasks
Marv51 opened this issue Nov 8, 2021 · 4 comments · Fixed by #4372
Closed
3 of 20 tasks

ColorPickerButton SelectedColor binding not updating correctly #4367

Marv51 opened this issue Nov 8, 2021 · 4 comments · Fixed by #4372
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior Completed 🔥 controls 🎛️
Milestone

Comments

@Marv51
Copy link
Contributor

Marv51 commented Nov 8, 2021

Describe the bug

ColorPickerButton's SelectedColor property, ignores changes to the source color completely. The color picker never reflects the updated color, even after it is closed and opened.

From looking at the source ColorPickerButton does not seem to forward changes of the "SelectedColor" to the internal ColorPicker. This is because the Color gets set once during OnApplyTemplate and not afterwards.

  • Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:
    unclear, but clearly a bug

Steps to Reproduce

  • Can this be reproduced in the Sample App? (Either in a sample as-is or with new XAML pasted in the editor.) If so, please provide custom XAML or steps to reproduce. If not, let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...)
    Sample App does not cover this use case.

Steps to reproduce the behavior:

<controls:ColorPickerButton  
    SelectedColor="{Binding SelectedElement.ZoneColor, Mode=TwoWay}" />
  • Let's assume SelectedElement.ZoneColor is blue, if you open the color picker, this works correctly.
  • Now close the color picker and through some other method (for example a button) change the SelectedElement.ZoneColor
  • now look at the ColorPickerButton, the preview has updated to the current/correct color
  • Click the ColorPickerButton the colorpicker is still showing the previous blue color as selected

Expected behavior

Screenshots

The source has a blue/cyan color, preview on ColorPickerButton was updated, but colorpicker shows previous value:
grafik

Environment

NuGet Package(s):

Package Version(s): 7.0.3

Windows 10 Build Number:

  • Fall Creators Update (16299)
  • April 2018 Update (17134)
  • October 2018 Update (17763)
  • May 2019 Update (18362)
  • May 2020 Update (19041)
  • Win 11 (22000)
  • Insider Build ({build_number})

App min and target version:

  • Fall Creators Update (16299)
  • April 2018 Update (17134)
  • [min] October 2018 Update (17763)
  • May 2019 Update (18362)
  • [target] May 2020 Update (19041)
  • Insider Build ({build_number})

Device form factor:

  • Desktop
  • Xbox
  • Surface Hub
  • IoT

Visual Studio version:

  • 2017 (15.{minor_version})
  • 2019 (16.{minor_version})
  • 2022 (17.{minor_version})

Additional context

Using WinUI 3 Desktop version 0.8.5.

Would a PropertyChangedCallback on the SelectedColor dependency property be the preferred way to fix this? If so I could create a PR for this.

@Marv51 Marv51 added the bug 🐛 An unexpected issue that highlights incorrect behavior label Nov 8, 2021
@ghost ghost added the needs triage 🔍 label Nov 8, 2021
@ghost
Copy link

ghost commented Nov 8, 2021

Hello Marv51, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@XAML-Knight
Copy link
Contributor

Hi @Marv51 , yes, adding a DP callback method would be my first inclination - go ahead and file a PR for this.

Marv51 added a commit to Marv51/WindowsCommunityToolkit that referenced this issue Nov 9, 2021
Update internal ColorPicker Color when ColorPickerButton SelectedColor changes
@ghost ghost added the In-PR 🚀 label Nov 9, 2021
@Marv51
Copy link
Contributor Author

Marv51 commented Nov 9, 2021

@XAML-Knight PR is ready.

@ghost ghost added the needs attention 👋 label Nov 24, 2021
@ghost
Copy link

ghost commented Nov 24, 2021

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

@michael-hawker michael-hawker added this to the 7.2/8.0? milestone Dec 7, 2021
@ghost ghost added Completed 🔥 and removed In-PR 🚀 labels Jan 19, 2022
XAML-Knight pushed a commit to XAML-Knight/WindowsCommunityToolkit that referenced this issue Jan 21, 2022
Update internal ColorPicker Color when ColorPickerButton SelectedColor changes
@ghost ghost locked as resolved and limited conversation to collaborators Mar 21, 2022
@michael-hawker michael-hawker modified the milestones: 8.0, 7.1.3 Aug 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior Completed 🔥 controls 🎛️
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants