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

SfBottomSheet.IsOpenProperty Binding Does Not Behave as Expected #57

Open
araxis opened this issue Dec 19, 2024 · 0 comments
Open

SfBottomSheet.IsOpenProperty Binding Does Not Behave as Expected #57

araxis opened this issue Dec 19, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@araxis
Copy link

araxis commented Dec 19, 2024

Description

Packages:
Syncfusion.Maui.Toolkit Version="1.0.3"
CommunityToolkit.Maui Version="10.0.0"
CommunityToolkit.Maui.Markup Version="5.1.0"

The SfBottomSheet component's IsOpenProperty is bound to the SelectedDevice property using a converter. While it works as expected initially, it fails to update when SelectedDevice is reset to null.

  • Initial Behavior: When SelectedDevice is null and IsOpen property is false, the bottom sheet remains closed as expected.
  • Expected Behavior on Selection: When a device is selected, SelectedDevice is assigned a non-null value. The converter updates IsOpen property to true, and the bottom sheet opens as expected.
  • Unexpected Behavior on Reset: When SelectedDevice is reset to null, the converter updated IsOpen property to false. However, the bottom sheet remains open.
var bottomSheet = new SfBottomSheet
{
    Content = CreateMainContent(),
    BottomSheetContent = CreateBottomSheetContent()
}.Bind(SfBottomSheet.IsOpenProperty, 
       static (ViewModel vm) => vm.SelectedDevice,
       convert: device => device is not null);

Steps to Reproduce

No response

Version with bug

1.0.3

Is this a regression from previous behavior?

Not sure, haven't tested other versions

Last Known Working Version

Not sure, haven't tested other versions

Affected platforms

Android, Windows

Affected Platform Versions

No response

Have you found a workaround?

Instead of relying on data binding, using an event-based approach resolves the issue and ensures the IsOpen property updates as expected when SelectedDevice is reset to null.

        viewModel.PropertyChanged += (sender, args) =>
        {
           if (args.PropertyName == nameof(viewModel.SelectedDevice))
          {
          		bottomSheet.IsOpen = viewModel.SelectedDevice != null;
          }
        };

Relevant log output

No response

@PaulAndersonS PaulAndersonS added the bug Something isn't working label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants