Search code examples
xamlxamarin.formsmaster-pagespicker

How to show picker on item selected in MasterPage?


I installed Xamarin.Forms.InputKit in NuGet and trying to show picker on certain selected item in MasterPage.

xmlns:i18n="clr-namespace:agroNet.AppResource;assembly=agroNet"

<Picker Title="{i18n:Translate ChangeLanguage}">
    <Picker.Items>
        <x:String>Srpski</x:String>
        <x:String>Engleski</x:String>
    </Picker.Items>
</Picker>

Currently, MasterPageDetail looks like this (For now I want it to be blank): enter image description here

So, on select item "Change language" enter image description here

I want to show Picker, like this: enter image description here


Solution

  • In MasterPage I have ListView_ItemSelected method for navigation over pages... So, solution is to add these lines in code

    if (item.Id == 4)
    {
        DisplayActionSheet(LocalizationResource.ChangeLanguage, "", "", LocalizationResource.SerbianLanguage, LocalizationResource.EnglishLanguage);
    }
    

    Using tihs, there is no need of any modification of xaml file.