-
Notifications
You must be signed in to change notification settings - Fork 117
Description
Describe the bug
This is very likely a regression from #579.
I use a ColorPickerButton in my app, and TwoWay x:Bind that to a property. The value of that property is not reflected in the ColorPicker that opens when the user clicks the ColorPickerButton, instead the x:Bind updates the property to transparent.
After I open the picker once and choose a color, it seems to work properly on subsequent opens — only the first one is affected.
Steps to reproduce
In a blank WinUI/WinAppSDK 1.7 project, add a Frame and an empty page.
Modify the page to this:
<?xml version="1.0" encoding="utf-8"?>
<Page
x:Class="App9.Main"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App9"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<controls:ColorPickerButton SelectedColor="{x:Bind MySelectedColor, Mode=TwoWay}" />
</Grid>
</Page>Code behind:
public sealed partial class Main : Page, INotifyPropertyChanged
{
private Color _mySelectedColor = Colors.Blue;
public Color MySelectedColor
{
get => _mySelectedColor;
set
{
if (_mySelectedColor != value)
{
_mySelectedColor = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MySelectedColor)));
}
}
}
public Main()
{
this.InitializeComponent();
}
public event PropertyChangedEventHandler? PropertyChanged;
}Expected behavior
I expect clicking the ColorPickerButton not to modify the value of the bound property. If the user dismisses the ColorPicker, then the value of the property should still be the same as if nothing happened.
Setting the value to transparent, makes just clicking the ColorPickerButton a 'destructive' operation.
Screenshots
No response
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
26100
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
2022
Visual Studio Build Number
Version 17.13.6
Device form factor
Desktop
Additional context
No response
Help us help you
No, I'm unable to contribute a solution.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status