public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			string selectedColor = "";

			PickerModel model = new PickerModel();
			model.ValueChanged += (sender, e) => {
				selectedColor = model.SelectedItem;
			};

			UIPickerView picker = new UIPickerView();
			picker.ShowSelectionIndicator = false;
			picker.BackgroundColor = UIColor.White;
			picker.Model = model;

			this.color.Text = model.SelectedItem;

			UIToolbar toolbar = new UIToolbar();
			toolbar.BarStyle = UIBarStyle.Default;
			toolbar.Translucent = true;
			toolbar.SizeToFit();

			UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
				(s, e) => {
					this.color.Text = selectedColor;
					this.color.ResignFirstResponder();
				});
			toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true);

			this.color.InputView = picker;

			this.color.InputAccessoryView = toolbar;
		}
Exemple #2
0
        void LoadAllowedTextsLabel()
        {
            #region Description Label
            label.Frame         = frameRect;
            label.TextColor     = UIColor.FromRGB(38 / 255.0f, 38 / 255.0f, 38 / 255.0f);
            label.Text          = "This sample illustrates the conversion of Excel documents to JSON file.";
            label.Font          = UIFont.SystemFontOfSize(15);
            label.Lines         = 0;
            label.LineBreakMode = UILineBreakMode.WordWrap;
            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                label.Font  = UIFont.SystemFontOfSize(18);
                label.Frame = new CGRect(5, 5, frameRect.Location.X + frameRect.Size.Width, 35);
            }
            else
            {
                label.Frame = new CGRect(5, 5, frameRect.Location.X + frameRect.Size.Width, 50);
            }
            #endregion

            #region Page Setup Options Label
            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                pageSetuplabel.Font  = UIFont.SystemFontOfSize(18);
                pageSetuplabel.Frame = new CGRect(10, 45, frameRect.Location.X + frameRect.Size.Width - 20, 50);
                layoutButton.Frame   = new CGRect(10, 95, frameRect.Location.X + frameRect.Size.Width - 20, 50);
            }
            else
            {
                pageSetuplabel.Frame = new CGRect(10, 50, frameRect.Location.X + frameRect.Size.Width - 20, 50);
                layoutButton.Frame   = new CGRect(10, 100, frameRect.Location.X + frameRect.Size.Width - 20, 50);
            }

            //filter Label
            pageSetuplabel.TextColor       = UIColor.Black;
            pageSetuplabel.BackgroundColor = UIColor.Clear;
            pageSetuplabel.Text            = "Convert :";
            pageSetuplabel.TextAlignment   = UITextAlignment.Left;
            pageSetuplabel.Font            = UIFont.FromName("Helvetica", 16f);

            //filter button
            layoutButton.SetTitle("Workbook", UIControlState.Normal);
            layoutButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            layoutButton.BackgroundColor     = UIColor.Clear;
            layoutButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            layoutButton.Hidden             = false;
            layoutButton.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;
            layoutButton.Layer.BorderWidth  = 4;
            layoutButton.Layer.CornerRadius = 8;
            layoutButton.Font           = UIFont.FromName("Helvetica", 16f);
            layoutButton.TouchUpInside += ShowFilterPicker;

            #endregion

            #region Layout Picker

            //filterpicker
            PickerModel filterPickermodel = new PickerModel(this.layoutList);
            filterPickermodel.PickerChanged += (sender, e) =>
            {
                this.selectedLayout = e.SelectedValue;
                layoutButton.SetTitle(selectedLayout, UIControlState.Normal);
            };

            layoutPicker.ShowSelectionIndicator = true;
            layoutPicker.Hidden          = true;
            layoutPicker.Model           = filterPickermodel;
            layoutPicker.BackgroundColor = UIColor.White;

            layoutDoneButton.SetTitle("Done\t", UIControlState.Normal);
            layoutDoneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            layoutDoneButton.BackgroundColor     = UIColor.FromRGB(240, 240, 240);
            layoutDoneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            layoutDoneButton.Hidden         = true;
            layoutDoneButton.TouchUpInside += HideFilterPicker;

            layoutPicker.Frame     = new CGRect(0, this.Frame.Size.Height / 4 + 20, this.Frame.Size.Width, this.Frame.Size.Height / 3);
            layoutDoneButton.Frame = new CGRect(0, this.Frame.Size.Height / 4 - 20, this.Frame.Size.Width, 40);

            #endregion

            ///UI CheckBox
            checkSchema.SetTitle("As Schema", UIControlState.Normal);
            checkSchema.SetTitleColor(UIColor.Black, UIControlState.Normal);
            checkSchema.Frame     = new CGRect(10, 155, frameRect.Location.X + frameRect.Size.Width - 20, 50);
            checkSchema.IsChecked = true;

            #region Input Template Button
            //button
            inputButton.SetTitle("Input Template", UIControlState.Normal);
            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                inputButton.Frame = new CGRect(0, 215, frameRect.Location.X + frameRect.Size.Width, 10);
            }
            else
            {
                inputButton.Frame = new CGRect(0, 220, frameRect.Location.X + frameRect.Size.Width, 10);
            }

            #endregion

            #region Convert Button
            convertButton.SetTitle("Convert", UIControlState.Normal);
            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                convertButton.Frame = new CGRect(0, 245, frameRect.Location.X + frameRect.Size.Width, 10);
            }
            else
            {
                convertButton.Frame = new CGRect(0, 250, frameRect.Location.X + frameRect.Size.Width, 10);
            }

            #endregion
        }