EnumBindablePicker for Xamarin Forms (component)

Nuget Package

EnumBindablePicker for Xamarin Forms

This EnumBindablePicker is the result of studying blog and forum posts. I'm using this component in more than 2000 views and 700 users. I think my component is stable.

Download it from NuGet.

What's included?

A enum bindable picker component.

Example

In your XAML

Add at the top of your page the following code:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
          xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
          xmlns:enums="clr-namespace:yournamespace;assembly=yournamespace"
          xmlns:psce="clr-namespace:PSC.Xamarin.Controls.EnumBindablePicker;
                      assembly=PSC.Xamarin.Controls.EnumBindablePicker">

Add a bindable picker in your form:

<psce:EnumBindablePicker x:TypeArguments="enums:YourEnum" 
                          SelectedItem="{Binding YourField, Mode=TwoWay}" />

In your ViewModel

		private YourEnum _importance;

		public YourEnum Importance
		{
			get
			{
				return _importance;
			}

			set
			{
				if (_importance != value)
				{
					this._importance = value;
					OnPropertyChanged("Importance");
				}
			}
		}

iOS

You must add in your AppDelegate.cs the initialisation for this component like. Add the following code:

public override bool FinishedLaunching(UIApplication app, 
                                       NSDictionary options)
{
    global::Xamarin.Forms.Forms.Init();

    // initialize my components
    // this is a work around only for iOS. If you don't do that, you received an error like 
    // System.IO.FileNotFoundException
    EnumBindablePicker temporary = new EnumBindablePicker();

    ...

}

Advertsing

125X125_06

Planet Xamarin

Planet Xamarin

Calendar

<<  February 2018  >>
MonTueWedThuFriSatSun
2930311234
567891011
12131415161718
19202122232425
2627281234
567891011

View posts in large calendar

Month List