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

System.ArgumentNullException when removing an item from a BindableCollection binded to a FlyoutsControl #1565

Closed
jonferreira opened this issue Oct 2, 2014 · 1 comment
Labels
Milestone

Comments

@jonferreira
Copy link

Using Caliburn.Micro.Demo add the following

ShellView.xaml

<Button MinWidth="90"
                    Margin="2"
                    cal:Message.Attach="[Event Click] = [Action RemoveFlyout]"
                    Content="Remove Bottom" />

ShellViewModel.cs

public void RemoveFlyout()
        {
            Flyouts.RemoveAt(0);
        }

error happens in FlyoutsControl.cs line 104

private void DetachHandlers(Flyout item)
        {
            var isOpenChanged = DependencyPropertyDescriptor.FromProperty(Flyout.IsOpenProperty, typeof(Flyout));
            var themeChanged = DependencyPropertyDescriptor.FromProperty(Flyout.ThemeProperty, typeof(Flyout));
            isOpenChanged.RemoveValueChanged(item, this.FlyoutStatusChanged);
            themeChanged.RemoveValueChanged(item, this.FlyoutStatusChanged);
        }

isOpenChanged.RemoveValueChanged(item, this.FlyoutStatusChanged); is returning System.ArgumentNullException because item is null

private void DetachHandlers(Flyout item)
        {
            if (item != null)
            {
                var isOpenChanged = DependencyPropertyDescriptor.FromProperty(Flyout.IsOpenProperty, typeof(Flyout));
                var themeChanged = DependencyPropertyDescriptor.FromProperty(Flyout.ThemeProperty, typeof(Flyout));
                isOpenChanged.RemoveValueChanged(item, this.FlyoutStatusChanged);
                themeChanged.RemoveValueChanged(item, this.FlyoutStatusChanged);
            }
        }

is an easy fix but most likely the wrong one...here ends my expertise. I'll wait for a comment from one of the Gurus out there...

@punker76 punker76 added the Bug label Dec 1, 2014
@punker76 punker76 added this to the v1.0 milestone Dec 1, 2014
@punker76
Copy link
Member

punker76 commented Dec 1, 2014

fixed with #1681

@punker76 punker76 closed this as completed Dec 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants