Bug 32201 - ContextActions not rendered when added in OnAppearing
Summary: ContextActions not rendered when added in OnAppearing
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 1.4.0
Hardware: Macintosh Mac OS
: Normal minor
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-21 10:24 UTC by Falko Schindler
Modified: 2016-04-13 18:04 UTC (History)
3 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Falko Schindler 2015-07-21 10:24:33 UTC
When adding a context action button in OnAppearing, it is not visible on iOS (can't swipe on cell). On Android it works as expected. Also, if moved to the constructor, the context action is visible on iOS as well.

A minimum example for reproducing the bug is as follows:

public App()
{
    MainPage = new ContentPage {
        Content = new ListView {
            ItemsSource = new List<string>{ "Apple", "Banana", "Cherry" },
            ItemTemplate = new DataTemplate(typeof(MyCell)),
        },
    };
}

class MyCell: ViewCell
{
    public MyCell()
    {
        View = new Label();
        View.SetBinding(Label.TextProperty, ".");
    }

    protected override void OnAppearing()
    {
        base.OnAppearing();

        ContextActions.Add(new MenuItem { Text = "Delete" });
    }
}
Comment 1 Rui Marinho 2015-07-30 13:21:20 UTC
Hi thanks, we have identified the issue. Please set the ContextActions on the constructor as a workaround.

Warm Regards
Xamarin Forms Team
Comment 2 Falko Schindler 2015-07-30 13:59:34 UTC
Hi,

moving it to the constructor isn't an option due to this bug: https://bugzilla.xamarin.com/show_bug.cgi?id=32206
So these two bugs hold me from using context actions in my app. :(
Comment 3 Rui Marinho 2016-04-13 18:04:59 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
 
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d