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

XAML Binding failed in ColorPicker #414

Open
1 of 24 tasks
Poker-sang opened this issue May 6, 2024 · 0 comments
Open
1 of 24 tasks

XAML Binding failed in ColorPicker #414

Poker-sang opened this issue May 6, 2024 · 0 comments

Comments

@Poker-sang
Copy link
Contributor

Poker-sang commented May 6, 2024

Describe the bug

The ColorPicker/ColorPickerButton has a binding failed issue (When use {x:Bind} on ColorPicker.Color or ColorPickerButton.SelectedColor):

CommunityToolkit.WinUI.Controls.ColorPicker
Color
Microsoft.UI.Xaml.Controls.GridView.SelectedValue
Object
Converter failed to convert value of type 'null' to type 'Color'			

This issue has been present since version 7.x.

Steps to reproduce

It's easy to reproduce this issue:

<controls:ColorPicker Color="{x:Bind ColorX}" />
Color ColorX { get; set; }

And then you can see: (see Screenshots)

Expected behavior

No Binding failure

Screenshots

image

image

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 10 21H2 (Build 19044)
  • Windows 10 22H2 (Build 19045)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

No response

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Windows 10, version 2104 (Build 20348)
  • Windows 11, version 22H2 (Build 22000)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

No response

Visual Studio Build Number

No response

Device form factor

No response

Additional context

I thought the bug is caused by this line:

SelectedValue="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Color, Mode=TwoWay}"

Maybe the TemplateParent is null or something?

Help us help you

No, I'm unable to contribute a solution.

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

1 participant