AndreiMisiukevich/ContextMenu

ObjectDisposedException: Cannot access a disposed object. Object name: 'ContextMenu.Droid.ContextMenuViewRenderer'.

nielscup opened this issue · 3 comments

I get the above error when navigating to the page containing the contextmenu items the second time. I am using COntextViewCell 2.0.0. Any ideas?

Fix ContextMenuViewRenderer:

    bool isDisposed;

    protected override void Dispose(bool disposing)
    {
        base.Dispose(disposing);
        isDisposed |= disposing;
    }

    protected void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        if (!isDisposed && ChildCount > 0)
        {
            var bar = GetChildAt(0);
            bar.HorizontalScrollBarEnabled = false;
            bar.VerticalScrollBarEnabled = false;
            bar.OverScrollMode = OverScrollMode.Never;
        }
    }

Hey) how about pull request ?)

Yeah sorry, I don't have a lot of time on my hands, this was a bit quicker for me.