Video: Xamarin Forms Picker
[PLEASE SUBSCRIBE MY CHANNEL, THANK YOU!] Welcome to Channel NTL, Wish you have a nice day! and Healthy Today we will learning about Xamarin Forms Picker. Picker control allow you show a drop down list and pick a value Now, we create new Project Choose save location Keep your Project name short If too long it will error when building I will connect to my real phone to show Design Here I'll use Gorilla Player to show Design in Xamarin Forms Click Ok Done, now we start design First of thing we should do is Update all packages to lastest version Right Click on Solution -> Choose Nuget Package Select all packages Update Update to get new improve performance, error fixed and more With your current Project Before update you need create a Backup For easy roll back Ok, done Now we design Create a 'Picker' set name for it I prefer 'My' preflix We move to code behide of this page Here I create an method to get data for 'Picker' More details about 'Picker' you can see on Xamarin site This create data for 'Picker' in XAML Here is create in code behide Create a List with data type is 'string' Add Item in this list and then set 'ItemSource' properties to that List Create a List inside is data type: string int new we add items Check syntax Then set properties 'ItemSource' equal listData Check syntax again this row create a 'Picker' in code with Title I will set Title for MyPicker here 'Pick a value' now we start debug on my Samsung J7 Prime It's take a lot of time to build with slow computer my pc is Core i3 gen 7.
but it still slow build Ok, we click on this picker Here this is data we have create in code behide done I'll test on iOS 8Gb Ram with MacOS on virtual machine. It's full Ram SSD If you want run MacOS on virtual machine you need 16Gb Ram I have not enought Ram to run Android Emulator so I must run on real device run on my Samsung sorry start again If possible buy a real Mac Ok it's run I must stop record video to save time If not this video will take over hours. haha This is 'Picker' control on iOS Here is Android ok Next we will get value when user choose on Picker we use event OnPickerSelectedIndexChange this event 'SelectedIndexChange' create 'selected' variable to hold MyPicker selectedItem and convert to string I'll show this value to big Label For exception, we should put it inside try catch [PLEASE SUBSCRIBE MY CHANNEL, THANK YOU!].