PickersΒΆ

namespace UIWidgets.Examples
{
   using System.Linq;
   using UIWidgets;
   using UnityEngine;

     public class PickerIntTest : MonoBehaviour
   {
             [SerializeField]
             PickerInt PickerTemplate;

             int currentValue = 0;

             public void Test()
             {
                     // create picker by template
                     var picker = PickerTemplate.Clone();

                     // set values from template
                     picker.ListView.DataSource = PickerTemplate.ListView.DataSource.ToObservableList();
                     // or set new values
                     //picker.ListView.DataSource = Enumerable.Range(1, 100).ToObservableList();

                     // show picker with callbacks
                     picker.Show(currentValue, ValueSelected, Canceled);
             }

             // will be called if value selected
             void ValueSelected(int value)
             {
                     currentValue = value;
                     Debug.Log("value: " + value);
             }

             // will be called if cancel button pressed
             void Canceled()
             {
                     Debug.Log("canceled");
             }
     }
}