Beispiel #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            var wheelView = FindViewById <WheelPicker>(Resource.Id.wheelView);
            var text1     = FindViewById <TextView>(Resource.Id.valueText);
            var text2     = FindViewById <TextView>(Resource.Id.valueText2);

            var model = new DatePickerModel();

            model.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(model.SelectedDate))
                {
                    text1.Text = model.SelectedDate.ToLongDateString();
                }
            };

            //Use wheelView.SelectedItemIndexChangedCommand for Mvvm bindings
            wheelView.SelectedItemIndexChanged += (sender, args) =>
            {
                text2.Text = $"Wheel {args.WheelIndex} selection changed to item index {args.SelectedItemIndex} ('{model.GetWheel(args.WheelIndex)[args.SelectedItemIndex]}')";
                model.UpdateWheelsFromSelection(args.WheelIndex, wheelView.SelectedItemsIndex);
            };

            //Optional: use an item builder to build complex cells for each wheel item
            wheelView.ItemsSimpleTemplates = new List <ItemFactoryDelegate> {
                ItemBuilder, ItemBuilder, ItemBuilder
            };

            wheelView.ItemsSource        = model.Wheels;
            wheelView.SelectedItemsIndex = new List <int> {
                0, 0, 0
            };
        }
Beispiel #2
0
        protected override void OnCreate(Bundle bundle)
        {
            Vapolia.WheelPickerCore.Config.License = "eyJhbGciOiJSUzI1NiIsImtpZCI6InZhcG9saWFzaWciLCJ0eXAiOiJKV1QifQ.eyJodHRwczovL3NjaGVtYXMudmFwb2xpYS5ldS8yMDIwLzA1L2NsYWltcy9MaWNlbnNlc0NsYWltIjoie1wiTGljZW5zZXNcIjpbe1wiUHJvZHVjdFwiOlwid2hlZWxwaWNrZXJcIixcIk9zXCI6XCJpb3NcIixcIkFwcElkXCI6XCJjb20udmFwb2xpYS5XaGVlbFBpY2tlckRlbW9Gb3Jtc1wiLFwiTWF4QnVpbGRcIjpcIjIwMjEtMDctMDlUMjA6MTM6MTYuODM1NTg5KzAyOjAwXCJ9LHtcIlByb2R1Y3RcIjpcIndoZWVscGlja2VyXCIsXCJ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MDoxMzoxNi44MzU1ODkrMDI6MDBcIn1dfSIsIm5iZiI6MTU5NDMxODM5NiwiZXhwIjoxOTA5ODUxMTk2LCJpYXQiOjE1OTQzMTgzOTYsImlzcyI6Imh0dHBzOi8vdmFwb2xpYS5ldS9hdXRob3JpdHkiLCJhdWQiOiJodHRwczovL3ZhcG9saWEuZXUvYXV0aG9yaXR5L2xpY2Vuc2VzIn0.qsktxo6OA0HNQU0TVnVxzQ0j6zoMw3CSbwTzhRfkQ3jmHnYk3N1pcnRobcP69h-9P8X3M9Ye-2iflq5Kkdv36unwp4B6X6HLpFlz1su9doMQmlHkea1HkNXip2o3BCgCOWFHDVdVLYV9D-AQtspiuiOTthgRezYvqt1kLtfM3qfrjKw7tTXv2TAX91T8-iNRb3OSc9TQeHESPBDTYYFDV6SHUECRSuOH8_-V5gUtxoIS7c1xMOJkdty-L8pYGn45BmtdaL3bMdXY_eYQwq7uYIxRHPcQ-KEioqtyU158Jzh4uX14OjcBkQ2Bz1Qhd6rFNz8Q0EpZ2roNfoNpqLX-XQ";

            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            var wheelView = FindViewById <WheelPicker>(Resource.Id.wheelView);
            var text1     = FindViewById <TextView>(Resource.Id.valueText);
            var text2     = FindViewById <TextView>(Resource.Id.valueText2);

            var model = new DatePickerModel();

            model.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(model.SelectedDate))
                {
                    text1.Text = model.SelectedDate.ToLongDateString();
                }
            };

            //Use wheelView.SelectedItemIndexChangedCommand for Mvvm bindings
            wheelView.SelectedItemIndexChanged += (sender, args) =>
            {
                text2.Text = $"Wheel {args.WheelIndex} selection changed to item index {args.SelectedItemIndex} ('{model.GetWheel(args.WheelIndex)[args.SelectedItemIndex]}')";
                model.UpdateWheelsFromSelection(args.WheelIndex, wheelView.SelectedItemsIndex);
            };

            //Optional: use an item builder to build complex cells for each wheel item
            wheelView.ItemsSimpleTemplates = new List <ItemFactoryDelegate> {
                ItemBuilder, ItemBuilder, ItemBuilder
            };

            wheelView.ItemsSource        = model.Wheels;
            wheelView.SelectedItemsIndex = new List <int> {
                0, 0, 0
            };
        }