public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			View.BackgroundColor = UIColor.White;
			View.AutosizesSubviews = true;

			// Perform any additional setup after loading the view, typically from a nib.
			var button = new FlatButton (new RectangleF (20, 20, 280, 43));
			button.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
			button.SetTitle ("SHOW ALERT");
			View.AddSubview (button);

			var progressView = new FlatProgressView(new Rectangle(20, 84, 280, 20));
			progressView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
			progressView.Progress = .66f;
			View.AddSubview (progressView);

			var slider = new FlatSlider(new Rectangle(20, 114, 280, 20));
			slider.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
			View.AddSubview (slider);
		}
Пример #2
0
        static void SetThemeOnChildren(ViewGroup parentViewGroup, FlatTheme theme, bool includeNormalViews)
        {
            for (int i = 0; i < parentViewGroup.ChildCount; i++)
            {
                var view = parentViewGroup.GetChildAt(i);


                var vtype = view.GetType();

                if (view is FlatButton)
                {
                    (view as FlatButton).Theme = theme;
                }
                else if (view is FlatCheckBox)
                {
                    (view as FlatCheckBox).Theme = theme;
                }
                else if (view is FlatEditText)
                {
                    (view as FlatEditText).Theme = theme;
                }
                else if (view is FlatRadioButton)
                {
                    (view as FlatRadioButton).Theme = theme;
                }
                else if (view is FlatSeekBar)
                {
                    (view as FlatSeekBar).Theme = theme;
                }
                else if (view is FlatTextView)
                {
                    (view as FlatTextView).Theme = theme;
                }
                else if (view is FlatToggleButton)
                {
                    (view as FlatToggleButton).Theme = theme;
                }

                //TODO: Need to add code for settheme static method
                if (includeNormalViews)
                {
                    if (vtype == typeof(CheckBox))
                    {
                        FlatCheckBox.SetTheme(view as CheckBox, theme);
                    }
                    else if (vtype == typeof(RadioButton))
                    {
                        FlatRadioButton.SetTheme(view as RadioButton, theme);
                    }
                    else if (vtype == typeof(ToggleButton))
                    {
                        FlatToggleButton.SetTheme(view as ToggleButton, theme);
                    }
                    else if (vtype == typeof(EditText))
                    {
                        FlatEditText.SetTheme(view as EditText, theme);
                    }
                    else if (vtype == typeof(TextView))
                    {
                        FlatTextView.SetTheme(view as TextView, theme);
                    }
                    else if (vtype == typeof(SeekBar))
                    {
                        FlatSeekBar.SetTheme(view as SeekBar, theme);
                    }
                    else if (vtype == typeof(Button))
                    {
                        FlatButton.SetTheme(view as Button, theme);
                    }
                }

                var childViewGroup = view as ViewGroup;

                if (childViewGroup != null)
                {
                    SetThemeOnChildren(childViewGroup, theme, includeNormalViews);
                }
            }
        }