Bug 38776 - Toggle SwitchCell programatically not working
Summary: Toggle SwitchCell programatically not working
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.0.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-02-15 21:51 UTC by ssavaria
Modified: 2016-12-20 20:51 UTC (History)
2 users (show)

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

4 source files of the Control. (2.89 KB, application/zip)
2016-02-15 21:51 UTC, ssavaria

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:

Description ssavaria 2016-02-15 21:51:50 UTC
Created attachment 15051 [details]
4 source files of the Control.

I need a listview in which you can select (toggle) only 1 item, or multiple if needed. I've coded the control and put it in a Content Page as the MainPage. However, when I put it in my application, I can't have only one item selected. Here is the code of the page : 

 <StackLayout Orientation="Vertical">
    <max:MaxSwitchListView x:Name="ListViewMain" HeightRequest="200" IsMultiSelect="False" CanDeleteItems="False" />

MaxSwitchListView is basically a ListView with a custom SwitchCell into it. When the user toggles an item, the previously toggled item is deselected (SwitchCell.On = false). However, this is not working in my setup. Here is the setup :

MainPage = new NavigationPage(new TabbedPage());

In a tab of the main page, I have a button which sends the user to another Page where the above code is put as is. I tested with Navigate.PushAsync and PushModalAsync and both aren't working.

However, when I set the code above in a ContentPage as the MainPage, it works as expected.

The full code of the control is in attachment...

I repeat : The control works in the MainPage, but does not when further in my navigation setup.
Comment 1 adrianknight89 2016-11-24 19:47:03 UTC
Can you attach an actual full repro?
Comment 2 Paul DiPietro [MSFT] 2016-12-20 20:51:39 UTC
Please reopen this with a functional, minimized reproduction if the issue in question is still occurring on the latest stable release.