-
Notifications
You must be signed in to change notification settings - Fork 372
Open
Labels
bug 🐛An unexpected issue that highlights incorrect behaviorAn unexpected issue that highlights incorrect behaviormvvm-toolkit 🧰Issues/PRs for the MVVM ToolkitIssues/PRs for the MVVM Toolkitneeds author feedback 📝This issue or PR needs a reply from the authorThis issue or PR needs a reply from the author
Description
Describe the bug
When using [ObservableProperty] from CommunityToolkit.Mvvm 8.4 on a bool property bound TwoWay to Microsoft.Maui.Controls.Picker.IsOpen, the generated OnIsProjectPickerExpandedChanged method is never called
Regression
8.0.3
Steps to reproduce
- Run the ObservablePropertyIssue sample attached in this https://github.com/SuthiYuvaraj/Samples/tree/main/ObservablePropertyIssue repository.
- Open the Picker and select an item.
- After selecting the item, the SelectionText is not updated. The PropertyChanged notification is never raised.
<Picker Title="Select a project"
ItemsSource="{Binding Projects}"
ItemDisplayBinding="{Binding Name, x:DataType=models:Project}"
SelectedItem="{Binding SelectedProject}"
SelectedIndex="{Binding SelectedProjectIndex}"
IsOpen="{Binding IsProjectPickerExpanded, Mode=TwoWay}"/>
public partial class MainPageViewModel : ObservableObject
{
[ObservableProperty]
private bool _isProjectPickerExpanded;
[ObservableProperty]
private string _selectionText = "No project selected";
partial void OnIsProjectPickerExpandedChanged(bool value)
{
SelectionText = value
? "Picker is open..."
: SelectedProject is not null
? $"Selected: {SelectedProject.Name} – {SelectedProject.Description}"
: "No project selected";
}
// ...
}With reference to the code snippet , OnIsProjectPickerExpandedChanged is never called.
Expected behavior
The OnIsProjectPickerExpandedChanged PropertyChanged method is expected to be invoked whenever the IsOpen property changes.
Screenshots
No response
IDE and version
VS 2022
IDE version
No response
Nuget packages
- CommunityToolkit.Common
- CommunityToolkit.Diagnostics
- CommunityToolkit.HighPerformance
- CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)
8.0.4
Additional context
- .NET MAUI CommunityToolkit:8.0.4
- OS: MacCatalyst Xcode 26.2
- .NET MAUI:11.0.0-preview.1.26104.11
Help us help you
Yes, I'd like to be assigned to work on this item
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug 🐛An unexpected issue that highlights incorrect behaviorAn unexpected issue that highlights incorrect behaviormvvm-toolkit 🧰Issues/PRs for the MVVM ToolkitIssues/PRs for the MVVM Toolkitneeds author feedback 📝This issue or PR needs a reply from the authorThis issue or PR needs a reply from the author