Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Back Button Disappearing in DialogViewController

$
0
0

Ok so this is weird.

I have a DialogViewController with RadioGroups and I did an experiment. If I load the RadioElements inside a RadioGroup programmatically with an async method, the back button disappears. Here's the code:

    public partial class RadioGroupTest : DialogViewController
    {
        public RadioGroupTest()
            : base(UITableViewStyle.Grouped, null)
        {
            this.BuildRadioGroups();
        }

        private async void BuildRadioGroups()
        {
            Root = new RootElement("Settings") {
                new Section (){
                    new RootElement("Element A", new RadioGroup(0)){
                        new Section ("Choose Element A"){
                            new RadioElement ("Element A1"),
                            new RadioElement ("Element A2"),
                            new RadioElement ("Element A3"),
                            new RadioElement ("Element A4"),
                        },
                    },
                    new RootElement("Element B", new RadioGroup(0)){
                        new Section ("Choose Element B"){
                            new RadioElement ("Element B1"),
                            new RadioElement ("Element B2"),
                            new RadioElement ("Element B3"),
                            new RadioElement ("Element B4"),
                        },
                    },
                    new RootElement("Element C", new RadioGroup(0)){
                        await this.BuildElementCSection("Clients"),
                    },
                }
            };
        }

        private async Task BuildElementCSection(string groupName)
        {
            Section mySection = new Section("Select the Owner");

            try
            {
                List myElements = new List();
                List elementList = await vw_ClientsCustomersManager.GetClientsCustomers();
                foreach (vw_ClientsCustomers customer in elementList)
                    myElements.Add(new MyRadioElement(customer.CustomersName, customer.CustomersClientUID, groupName));
                mySection.AddAll(myElements);
            }
            catch (Exception ex)
            {
                new UIAlertView("Error", ex.Message, null, "OK", null).Show();
            }

            return mySection;
        }
    }

Under "Element C" I load RadioElements programmatically. This happens through a function that reads from the database asynchronously, therefore I have to use the await keyword.

When the dialog loads and I tap on any of my radio groups, it goes inside the list and there is a back button. Now, if I tap on any of the radio groups, it goes inside the list and the back button is gone!

BUT........if I slide the finger where the back button is supposed to be: the back button reappears!!

This doesn't happen if I load all my elements without an async function.

Any ideas???


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>