private void ApplyTheme()
		{
			Application.Current.Resources = new ResourceDictionary ();

			// Global styles for all controls of these types
	        var labelStyle = new Style (typeof(Label)) {
	            Setters = {
					new Setter { Property = Label.TextColorProperty, Value = Device.OnPlatform<Color>(Color.FromHex("484848"), Color.FromHex("ECECEC"), Color.FromHex("ECECEC")) },
					new Setter { Property = Label.FontSizeProperty, Value = 12 },
					new Setter { Property = Label.FontFamilyProperty, Value = Device.OnPlatform<string>(IOS_FONT_NAME_NORMAL, ANDROID_FONT_NAME_NORMAL, WINDOWS_FONT_NAME_NORMAL) },
	            }
	        };
			Application.Current.Resources.Add (labelStyle);

			var buttonStyle = new Style (typeof(Button)) {
	            Setters = {
					new Setter { Property = Button.TextColorProperty, Value = Color.FromHex("161616") },
					new Setter { Property = Button.FontFamilyProperty, Value = Device.OnPlatform<string>(IOS_FONT_NAME_BOLD, ANDROID_FONT_NAME_BOLD, WINDOWS_FONT_NAME_BOLD) },
	            }
	        };
			Application.Current.Resources.Add (buttonStyle);

			var pageStyle = new Style (typeof(ContentPage)) {
	            Setters = {
					new Setter { Property = ContentPage.PaddingProperty, Value = Device.OnPlatform<Thickness>(new Thickness(0, 20, 0, 0), 0, 0) },
	            }
	        };
			Application.Current.Resources.Add (pageStyle);
		}
Exemple #2
0
        public ImplicitStyleCSharp()
        {
            var entryStyle = new Xamarin.Forms.Style(typeof(Entry))
            {
                Setters =
                {
                    new Setter {
                        Property = Entry.TextColorProperty, Value = Color.Blue
                    }
                }
            };

            Resources = new ResourceDictionary();
            Resources.Add(entryStyle);
            Content = new StackLayout {
                Children =
                {
                    new Entry {
                        Text = "These entries"
                    },
                    new Entry {
                        Text = "are demostrating"
                    },
                    new Entry {
                        Text = "implicit styles,"
                    },
                    new Entry {
                        Text = "and an implicit style override", BackgroundColor = Color.Lime
                    },
                }
            };
        }
		public SimpleTriggerPage ()
		{
			var t = new Trigger (typeof(Entry));
			t.Property = Entry.IsFocusedProperty;
			t.Value = true;
			t.Setters.Add (new Setter {Property = Entry.ScaleProperty, Value = 1.5 } );


			var s = new Style (typeof(Entry));
			s.Setters.Add (new Setter { Property = AnchorXProperty, Value = 0} );
			s.Triggers.Add (t);

			Resources = new ResourceDictionary ();
			Resources.Add (s);


			Padding = new Thickness (20, 50, 120, 0);
			Content = new StackLayout { 
				Spacing = 20,
				Children = {
					new Entry { Placeholder = "enter name" },
					new Entry { Placeholder = "enter address" },
					new Entry { Placeholder = "enter city and name" },
				}
			};
		}
Exemple #4
0
        public App()
        {
            #region // スタイル設定
            Application.Current.Resources = new ResourceDictionary();

            var fsi = "20";
            var fsa = "30";
            var fswp = "40";

            var appTitleLabel = new Style(typeof(Label))
            {

                Setters =
                {
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromHex("AA3333") }, // 薄紫
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(fsi,fsa,fswp) },
                }
            };
            Application.Current.Resources.Add("TitleLabel", appTitleLabel);

            var nav = new NavigationPage(new StartPage());
            nav.BarBackgroundColor = Color.FromHex("3498DB");
            nav.BarTextColor = Color.White;
            MainPage = nav;
        }
Exemple #5
0
        public SaveToDictionaryCS()
        {
            var labelStyle = new Style(typeof(Label))
            {
                Setters = {
                new Setter { Property = Label.XAlignProperty, Value = TextAlignment.End },
                new Setter { Property = Label.YAlignProperty, Value = TextAlignment.Center },
                new Setter { Property = Label.WidthRequestProperty, Value = 150 }
                }
            };

            var labelName = new Label { Text = "Name:", Style = labelStyle };
            entryName = new Entry { Placeholder = "Input your name", HorizontalOptions = LayoutOptions.FillAndExpand };
            var labelBirthday = new Label { Text = "Birthday:", Style = labelStyle };
            pickerBirthday = new DatePicker { Date = new DateTime(1990, 1, 1) };
            var labelLike = new Label { Text = "Like Xamarin?", Style = labelStyle };
            switchLike = new Switch { };
            var saveButton = new Button { Text = "Save", HorizontalOptions = LayoutOptions.FillAndExpand };
            saveButton.Clicked += saveButton_Clicked;
            var loadButton = new Button { Text = "Load", HorizontalOptions = LayoutOptions.FillAndExpand };
            loadButton.Clicked += loadButton_Clicked;
            var clearButton = new Button { Text = "Clear", HorizontalOptions = LayoutOptions.FillAndExpand };
            clearButton.Clicked += clearButton_Clicked;
            resultLabel = new Label { Text = "", FontSize = 30 };

            Title = "Save to dictionary (C#)";
            Content = new StackLayout
            {
                Padding = 10,
                Spacing = 10,
                Children = {
                    new Label { Text = "DataSave Sample", FontSize = 40, HorizontalOptions = LayoutOptions.Center },
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            labelName, entryName
                        }
                    },
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            labelBirthday, pickerBirthday
                        }
                    },
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            labelLike, switchLike
                        }
                    },
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            saveButton, loadButton, clearButton
                        }
                    },
                    resultLabel
                }
            };
        }
		public App ()
		{
			InitializeComponent ();

			// The Application ResourceDictionary is available in Xamarin.Forms 1.3 and later
			if (Application.Current.Resources == null) {
				Application.Current.Resources = new ResourceDictionary();
			}

			var appStyle = new Style (typeof(Label)) {
				BaseResourceKey = Device.Styles.SubtitleStyleKey,
				Setters = {
					new Setter { Property = Label.TextColorProperty, Value = Color.Green }
				}
			};
			Application.Current.Resources.Add ("AppStyle", appStyle);

			var boxStyle = new Style (typeof(BoxView)) {
				Setters = {
					new Setter { Property = BoxView.ColorProperty, Value = Color.Aqua }
				}
			};
			Application.Current.Resources.Add (boxStyle); // implicit style for ALL boxviews

			var tabs = new TabbedPage ();
			tabs.Children.Add (new StylePage {Title = "C#", Icon = "csharp.png"});
			tabs.Children.Add (new StyleXaml {Title = "Xaml", Icon = "xaml.png"});
			tabs.Children.Add (new DynamicResourceXaml {Title = "Dynamic", Icon = "xaml.png"});

			//tabs.Children.Add (new OldResourceDictionary {Title = "Old", Icon = "xaml.png"});

			MainPage = tabs;
		}
 private static void ApplyStyle(BindableObject bindable, Style newvalue)
 {
   foreach (var setter in newvalue.Setters )
   {
       bindable.SetValue(setter.Property, setter.Value);
   }
 }
Exemple #8
0
		public static void RegisterGlobalStyles ()
		{
			Application.Current.Resources = new ResourceDictionary ();

			var buttonStyle = new Style (typeof(Button)) {
				Setters = {
					new Setter { Property = Button.BackgroundColorProperty, Value = Colors.ButtonBackgroundColor },
					new Setter { Property = Button.BorderRadiusProperty, Value = 0 },
					new Setter { Property = Button.BorderWidthProperty, Value = 0 },
					new Setter { Property = Button.FontAttributesProperty, Value = FontAttributes.None },
					new Setter { Property = Button.FontFamilyProperty, Value = "HelveticaNeue-Thin" },
					new Setter { Property = Button.FontSizeProperty, Value = 25 },
					new Setter { Property = Button.TextColorProperty, Value = Colors.ButtonTextColor }
				}
			};

			var mainLabelStyle = new Style (typeof(Label)) {
				Setters = {
					new Setter { Property = Label.BackgroundColorProperty , Value = Color.Transparent },
					new Setter { Property = Label.FontAttributesProperty , Value = FontAttributes.None },
					new Setter { Property = Label.FontFamilyProperty , Value = "HelveticaNeue-Thin" },
					new Setter { Property = Label.FontSizeProperty , Value = 32f },
					new Setter { Property = Label.HorizontalOptionsProperty , Value = LayoutOptions.Center },
					new Setter { Property = Label.TextColorProperty , Value = Color.White  }
				}
			};

			Application.Current.Resources.Add (buttonStyle);
			Application.Current.Resources.Add ("MainLabelStyle", mainLabelStyle);
		}
 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(ChatPage));
     btnStyle = this.FindByName<Style>("btnStyle");
     lstMensagem = this.FindByName<ListView>("lstMensagem");
     txtMensagem = this.FindByName<Entry>("txtMensagem");
     btnEnviarMensagem = this.FindByName<Button>("btnEnviarMensagem");
 }
        private static Setter GetPaddingFromStyle(Style style)
        {
            if (style == null || style.Setters == null)
            {
                return null;
            }

            return style.Setters.FirstOrDefault(s => s.Property == Frame.PaddingProperty);
        }
Exemple #11
0
        public App()
        {
            #region Style
            var contentPageStyle = new Style(typeof(ContentPage))
            {
                Setters = {
                new Setter { Property = ContentPage.BackgroundColorProperty, Value = Constants.palette.primary },
                }
            };
            var labelStyle = new Style(typeof(Label))
            {
                Setters = {
                new Setter { Property = Label.TextColorProperty, Value = Constants.palette.primary_text },
                }
            };
            var editorStyle = new Style(typeof(Editor))
            {
                Setters = {
                new Setter { Property = Editor.TextColorProperty, Value = Constants.palette.primary_text },
                new Setter { Property = Editor.BackgroundColorProperty, Value = Constants.palette.primary_light },
                }
            };
            var buttonStyle = new Style(typeof(Button))
            {
                Setters = {
                new Setter { Property = Button.TextColorProperty, Value = Constants.palette.primary_text },
                new Setter { Property = Button.BackgroundColorProperty, Value = Constants.palette.primary_light },
                }
            };
            var switchStyle = new Style(typeof(Switch))
            {
                Setters = {
                new Setter { Property = Switch.BackgroundColorProperty, Value = Constants.palette.primary_light },
                }
            };

            Resources = new ResourceDictionary();
            Resources.Add("contentPageStyle", contentPageStyle);
            Resources.Add("labelStyle", labelStyle);
            Resources.Add("editorStyle", editorStyle);

            #endregion

            // The root page of your application
            mainPage = new NavigationPage(new mainPage())
            {
                BarBackgroundColor = Constants.palette.primary_dark,
                BarTextColor = Constants.palette.icons,
                Title = "VOCAB MASTER",

            };
            MainPage = mainPage;
        }
Exemple #12
0
        public void InitStyles()
        {
            Application.Current.Resources = new ResourceDictionary();
            var buttonStyle = new Style(typeof(Button))
            {
                Setters = {
                    new Setter { Property = Button.TextColorProperty, Value = Color.White },
                    new Setter { Property = Button.BackgroundColorProperty, Value = Color.FromRgb(71, 87, 112) }
                }
            };

            Application.Current.Resources.Add("ButtonStyle", buttonStyle);
        }
Exemple #13
0
        public App()
        {
            // The root page of your application
            MainPage = new NavigationPage(new Inicio());

            // Amostra grátis de Styles
            var btnStyle = new Style(typeof(Button));
            btnStyle.Setters.Add(new Setter() { Property = Button.BackgroundColorProperty, Value = Color.Red });
            btnStyle.Setters.Add(new Setter() { Property = Button.TextColorProperty, Value = Color.White });

            Resources = new ResourceDictionary();

            Resources.Add(btnStyle);
        }
Exemple #14
0
 public LabelStyles(Color firstColor, Color secondColor)
 {
     display4 = CreateStyle (firstColor, 76, StyleKit.LightFont);
     display3 = CreateStyle (firstColor, 50, StyleKit.RegularFont);
     display2 = CreateStyle (firstColor, 42, StyleKit.RegularFont);
     display = CreateStyle (firstColor, 30, StyleKit.RegularFont);
     headline = CreateStyle (secondColor, 20, StyleKit.RegularFont, LineBreakMode.WordWrap);
     title = CreateStyle (firstColor, 16, StyleKit.MediumFont);
     subhead = CreateStyle (secondColor, 14, StyleKit.RegularFont, LineBreakMode.WordWrap);
     body2 = CreateStyle (firstColor, 12, StyleKit.MediumFont, LineBreakMode.WordWrap);
     body = CreateStyle (firstColor, 12, StyleKit.RegularFont, LineBreakMode.WordWrap);
     caption = CreateStyle (secondColor, 9, StyleKit.RegularFont, LineBreakMode.WordWrap);
     action = CreateStyle (firstColor, 16, StyleKit.LightFont, LineBreakMode.WordWrap);
 }
        public App()
        {
            // The root page of your application
            MainPage = new NavigationPage(new SearchPatient());

            Current.Resources = new ResourceDictionary();
            Current.Resources.Add("UlycesColor", Color.FromRgb(121, 248, 81));
            var navigationStyle = new Style(typeof (NavigationPage));
            var barTextColorSetter = new Setter {Property = NavigationPage.BarTextColorProperty, Value = Color.White};
            var barBackgroundColorSetter= new Setter {Property = NavigationPage.BarBackgroundColorProperty, Value = Color.Red};

            navigationStyle.Setters.Add(barTextColorSetter );
            navigationStyle.Setters.Add(barBackgroundColorSetter);

            Current.Resources.Add(navigationStyle);
        }
        private View CreateContent()
        {
            var labelRedStyle = new Xamarin.Forms.Style(typeof(Label))
            {
                Setters = { CreateColorSetter(Color.Red), CreateOptionsSetter() }
            };

            var labelBlueStyle = new Xamarin.Forms.Style(typeof(Label))
            {
                Setters = { CreateColorSetter(Color.Blue), CreateOptionsSetter() }
            };

            var labelGreenStyle = new Xamarin.Forms.Style(typeof(Label))
            {
                Setters = { CreateColorSetter(Color.Green), CreateOptionsSetter() }
            };

            var resources = new ResourceDictionary();

            resources.Add("labelRedStyle", labelRedStyle);
            resources.Add("labelBlueStyle", labelBlueStyle);
            resources.Add("labelGreenStyle", labelGreenStyle);

            var layout = new StackLayout {
                Children =
                {
                    new Label {
                        Text = "These labels", Style = labelRedStyle
                    },
                    new Label {
                        Text = "are demonstrating", Style = labelGreenStyle
                    },
                    new Label {
                        Text = "explict styles,", Style = labelBlueStyle
                    },
                    new Label {
                        Text = "and an explict style override", Style = labelGreenStyle
                    }
                }
            };

            layout.Resources = resources;

            return(layout);
        }
Exemple #17
0
        public DateTimeView(Card card)
        {
            var labelStyle = new Style (typeof(Label))
                .Set (Label.FontSizeProperty, 8)
                .Set (Label.TextColorProperty, StyleKit.MediumGrey)
                .Set (Image.VerticalOptionsProperty, LayoutOptions.Center);

            var iconStyle = new Style (typeof(Image))
                .Set (Image.HeightRequestProperty, 10)
                .Set (Image.WidthRequestProperty, 10)
                .Set (Image.VerticalOptionsProperty, LayoutOptions.Center);

            var stack = new StackLayout () {
                VerticalOptions = LayoutOptions.Center,
                HeightRequest = 20,
                Padding = new Thickness (0),
                Orientation = StackOrientation.Horizontal,
                Children = {
                    new Image () {
                        Style = iconStyle,
                        Source = StyleKit.Icons.SmallCalendar,
                    },
                    new Label () {
                        //Text = card.DueDate.ToShortDateString (),
                        Style = labelStyle,
                    },
                    new BoxView () { Color = Color.Transparent, WidthRequest = 20 },
                    new Image () {
                        Style = iconStyle,
                        Source = StyleKit.Icons.SmallClock,
                    },
                    new Label () {
                        Text = card.DirationInMinutes.ToString () + " Minutes",
                        Style = labelStyle,
                    }
                }
            };

            Content = stack;
        }
		public App()
        {
            Application.Current.Resources = new ResourceDictionary ();

			// Create implicit styles for elements
			var buttonStyle = new Style (typeof(Button)) {
				Setters = {
					new Setter { Property = Button.BackgroundColorProperty, Value = Color.FromHex(ThemeColors.Accent) },
					new Setter { Property = Button.TextColorProperty, Value = Color.FromHex(ThemeColors.TextIcons) },
					new Setter { Property = Button.BorderRadiusProperty, Value = 0 },
					new Setter { Property = Button.HeightRequestProperty, Value = 42 }
				}
			};
			Application.Current.Resources.Add(buttonStyle);

			var entryStyle = new Style (typeof(Entry)) {
				Setters = {
					new Setter { Property = Entry.TextColorProperty, Value = Color.FromHex(ThemeColors.PrimaryText) },
				}
			};
			Application.Current.Resources.Add(entryStyle);

			var labelStyle = new Style (typeof(Label)) {
				Setters = {
					new Setter { Property = Label.TextColorProperty, Value = Color.FromHex(ThemeColors.PrimaryText)  },
				}
			};
			Application.Current.Resources.Add(labelStyle);

			var pickerStyle = new Style (typeof(Picker)) {
				Setters = {
					new Setter { Property = Picker.BackgroundColorProperty, Value = Color.FromHex(ThemeColors.Accent) },
				}
			};
			Application.Current.Resources.Add(pickerStyle);

            // The root page of your application
            this.MainPage = new NavigationDrawer();
        }
        public Inicio()
        {
            InitializeComponent();

            //lblSubTitle.Style = Device.Styles.SubtitleStyle;
            //lblTitle.Style = Device.Styles.TitleStyle;
            //lblBody.Style = Device.Styles.BodyStyle;
            //lblCaption.Style = Device.Styles.CaptionStyle;
            //lblItemDetail.Style = Device.Styles.ListItemDetailTextStyle;
            //lblItemText.Style = Device.Styles.ListItemTextStyle;

            var estiloTitulo = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter {Property = Label.TextColorProperty, Value=Color.Yellow},
                    new Setter {Property = Label.FontSizeProperty, Value = 30},
                    new Setter {Property = Label.XAlignProperty, Value = TextAlignment.Center}
                }
            };

            lblTitle.Style = estiloTitulo;
        }
Exemple #20
0
        public App()
        {
            #region // スタイル設定
            Application.Current.Resources = new ResourceDictionary();

            var appTitleLabel = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromHex("554575") }, // 薄紫
                    new Setter { Property = Label.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Large, typeof(Label)) },
                }
            };
            Application.Current.Resources.Add("TitleLabel", appTitleLabel);

            var SubColoredLabel = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromHex("999") }
                }
            };
            Application.Current.Resources.Add("SubColoredLabel", SubColoredLabel);
            #endregion
            //9783bf
            var nav = new NavigationPage(new StartPageCS());
            nav.BarBackgroundColor = Color.FromHex("8c70c1");
            if (Device.OS == TargetPlatform.Windows)
            {
                nav.BarTextColor = Color.Black;
            }
            else
            {
                nav.BarTextColor = Color.White;
            }
            MainPage = nav;
        }
        public LoginPage()
        {
            InitializeComponent ();

            // Invia.Image = "icon.png";

            var buttonStyle = new Style (typeof(Button)) {
                Setters = {
                    new Setter { Property = Button.BackgroundColorProperty, Value = Color.Green },
                    new Setter { Property = Button.BorderColorProperty, Value = Color.Blue },
                    new Setter { Property = Button.BorderRadiusProperty, Value = 10 },
                    new Setter { Property = Button.HeightRequestProperty, Value = 42 }
                }
            };

            this.Invia.Style = buttonStyle;

            // if (App.Current.Resources == null) {
            // 	App.Current.Resources = new ResourceDictionary ();
            //}
            // App.Current.Resources.Add (buttonStyle);

            Invia.Clicked += Invia_Clicked;;
        }
Exemple #22
0
        private void SetGlobalStyles()
        {
            var button = new Style(typeof (Button))
            {
                Setters =
                {
                    new Setter {Property = Button.BackgroundColorProperty, Value = Color.FromHex("3499DB")},
                    new Setter {Property = Button.TextColorProperty, Value = Color.White},
                }
            };

            // add button style
            Resources.Add(button);

            var page = new Style(typeof(ContentPage))
            {
                Setters =
                {
                    new Setter {Property = VisualElement.BackgroundColorProperty, Value = Color.White}
                }
            };

            // add page style
            Resources.Add(page);

            // create identical page styles
            foreach (var key in _pages.Values)
            {
                var derived = new Style(key)
                {
                    BasedOn = page
                };

                Resources.Add(derived);
            }
        }
        public Style GeneratePageStyle()
        {
            var themeStyle = new Style(typeof(ContentPage))
            {
                Setters = {
                    new Setter { Property = ContentPage.BackgroundColorProperty, Value = m_theme.backgroundColour }
                }
            };

            return themeStyle;
        }
        public Style GenerateButtonStyle()
        {
            var themeStyle = new Style(typeof(Button))
            {
                Setters = {
                    new Setter { Property = Button.BackgroundColorProperty, Value = m_theme.backgroundColour },
                    new Setter { Property = Button.TextColorProperty, Value = m_theme.fontColour },
                    /*new Setter { Property = Button.FontProperty, Value = m_theme.font },*/
                    new Setter { Property = Button.FontSizeProperty, Value = Device.GetNamedSize(m_theme.fontSize, typeof(Button)) },
                    new Setter { Property = Button.BorderColorProperty, Value = Color.White },
                    new Setter { Property = Button.BorderRadiusProperty, Value = 2 },
                    new Setter { Property = Button.BorderWidthProperty, Value = 2 }
                }
            };

            return themeStyle;
        }
        public Style GeneratePickerStyle()
        {
            var themeStyle = new Style(typeof(Picker))
            {
                Setters = {
                    new Setter { Property = Picker.BackgroundColorProperty, Value = m_theme.backgroundColour },
                    new Setter { Property = Picker.StyleProperty, Value = GenerateLabelStyle() }
                }
            };

            return themeStyle;
        }
        public Style GenerateEntryStyle()
        {
            var themeStyle = new Style(typeof(Entry))
            {
                Setters = {
                new Setter { Property = Entry.BackgroundColorProperty, Value = m_theme.backgroundColour },
                    new Setter { Property = Entry.TextColorProperty, Value = m_theme.fontColour }
                }
            };

            return themeStyle;
        }
Exemple #27
0
		private void SetStyles()
		{
			Resources = new ResourceDictionary ();

			var contentStyle = new Style (typeof(ContentPage)) {
				Setters = {
					new Setter {
						Property = ContentPage.BackgroundColorProperty,
						Value = Color.White
					}
				}
			};
			Resources.Add (contentStyle);

			var entryStyle = new Style (typeof(Entry)) {
				Setters = {
					new Setter {
						Property = Entry.BackgroundColorProperty,
						Value = Color.FromHex("EEEEEE")
					},
					new Setter {
						Property = Entry.TextColorProperty,
						Value = Color.FromHex("333333")
					},
					new Setter {
						Property = Entry.HorizontalOptionsProperty,
						Value = LayoutOptions.FillAndExpand
					},
					new Setter {
						Property = Entry.VerticalOptionsProperty,
						Value = LayoutOptions.CenterAndExpand
					}
				}
			};
			Resources.Add (entryStyle);

			var editorStyle = new Style (typeof(Editor)) {
				Setters = {
					new Setter {
						Property = Editor.BackgroundColorProperty,
						Value = Color.FromHex("EEEEEE")
					},
					new Setter {
						Property = Editor.TextColorProperty,
						Value = Color.FromHex("333333")
					},
					new Setter {
						Property = Editor.HorizontalOptionsProperty,
						Value = LayoutOptions.FillAndExpand
					},
					new Setter {
						Property = Editor.VerticalOptionsProperty,
						Value = LayoutOptions.FillAndExpand
					}
				}
			};
			Resources.Add (editorStyle);

			var pickerStyle = new Style (typeof(Picker)) {
				Setters = {
					new Setter {
						Property = Picker.BackgroundColorProperty,
						Value = Color.FromHex("EEEEEE")
					},
					new Setter {
						Property = Picker.HorizontalOptionsProperty,
						Value = LayoutOptions.FillAndExpand
					},
					new Setter {
						Property = Picker.VerticalOptionsProperty,
						Value = LayoutOptions.CenterAndExpand
					}
				}
			};
			Resources.Add (pickerStyle);

			var datePickerStyle = new Style (typeof(DatePicker)) {
				Setters = {
					new Setter {
						Property = DatePicker.BackgroundColorProperty,
						Value = Color.FromHex("EEEEEE")
					},
					new Setter {
						Property = DatePicker.HorizontalOptionsProperty,
						Value = LayoutOptions.FillAndExpand
					},
					new Setter {
						Property = DatePicker.VerticalOptionsProperty,
						Value = LayoutOptions.CenterAndExpand
					}
				}
			};
			Resources.Add (datePickerStyle);

			var buttonStyle = new Style (typeof(Button)) {
				Setters = {
					new Setter { 
						Property = Button.BackgroundColorProperty, 
						Value = Color.FromHex("DDDDDD")
					},
					new Setter {
						Property = Button.BorderRadiusProperty,
						Value = 5
					},
					new Setter {
						Property = Button.BorderWidthProperty,
						Value = 2
					},
					new Setter {
						Property = Button.BorderColorProperty,
						Value = Color.FromHex("444444")
					},
					new Setter {
						Property = Button.TextColorProperty,
						Value = Color.FromHex("333333")
					},
					new Setter {
						Property = Button.HorizontalOptionsProperty,
						Value = LayoutOptions.FillAndExpand
					},
					new Setter {
						Property = Button.VerticalOptionsProperty,
						Value = LayoutOptions.CenterAndExpand
					}
				}
			};
			Resources.Add (buttonStyle);

			var labelStyle = new Style (typeof(Label)) {
				Setters = {
					new Setter {
						Property = Label.TextColorProperty,
						Value = Color.FromHex ("333333")
					}
				}
			};
			Resources.Add (labelStyle);

		}
        public override void Load()
        {
            #region Style PageTitle
            Style pageTitleStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(18, 21, 25) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(255, 255, 255) },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.TailTruncation }
                }
            };
            #endregion

            #region Style Title
            Style titleStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(14, 14, 18) },
                    new Setter { Property = Label.FontAttributesProperty, Value = FontAttributes.Bold },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromHex("444") },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.TailTruncation }
                }
            };
            #endregion

            #region Style Description
            Style descriptionStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(13, 13, 17) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromHex("444") },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.TailTruncation }
                }
            };
            #endregion

            #region Style Description
            Style descriptionLightStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(13, 13, 17) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(255, 255, 255) },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.WordWrap }
                }
            };
            #endregion

            #region Style ListTitle
            Style listTitleStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(14, 15, 19) },
                    new Setter { Property = Label.FontAttributesProperty, Value = FontAttributes.Bold },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromHex("444") },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.TailTruncation }
                }
            };
            #endregion

            #region Style ListPercent
            Style listPercentStyle = new Style(typeof(Label))
            {
                Setters = 
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(16, 18, 22) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(206, 58, 24) },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap }
                }
            };
            #endregion

            #region Style ListPercentSymbol
            Style listPercentSymbolStyle = new Style(typeof(Label))
            {
                Setters = 
                {
                    new Setter { Property = Label.TextProperty, Value = "%" },
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontAttributesProperty, Value = FontAttributes.Bold },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(12, 12, 16) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(206, 58, 24) },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap },
                    new Setter { Property = Label.TranslationYProperty, Value = -2 }
                }
            };
            #endregion

            #region Style LabelPercent
            Style labelPercentStyle = new Style(typeof(Label))
            {
                Setters = 
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(21, 21, 25) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(255, 255, 255) },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap }
                }
            };
            #endregion

            #region Style LabelPercentSymbol
            Style labelPercentSymbolStyle = new Style(typeof(Label))
            {
                Setters = 
                {
                    new Setter { Property = Label.TextProperty, Value = "%" },
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(11, 11, 15) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(255, 255, 255) },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap },
                    new Setter { Property = Label.TranslationYProperty, Value = -2 }
                }
            };
            #endregion

            #region Style LinkStyle
            Style linkStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(13, 13, 17) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromHex("005EB8") },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.TailTruncation }
                }
            };
            #endregion

            #region Style MenuStyle
            Style menuStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(17, 17, 22) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromHex("EEE") },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap }
                }
            };
            #endregion

            #region Style MenuHint
            Style menuHintStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(13, 13, 18) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromHex("EEE") },
                    new Setter { Property = Label.OpacityProperty, Value = 0.5 },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap }
                }
            };
            #endregion

            #region Style Menu disabled
            Style menuDisabledStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(17, 17, 22) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromHex("7F7F7F") },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap }
                }
            };
            #endregion

            #region Style Categoty
            Style categoryStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontAttributesProperty, Value = FontAttributes.Bold },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(9, 11, 15) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(255, 255, 255) },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap }
                }
            };
            #endregion

            #region Style DetailTitle
            Style detailTitleStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(18, 21, 25) },
                    new Setter { Property = Label.FontAttributesProperty, Value = FontAttributes.Bold },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(68, 68, 68) },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.TailTruncation }
                }
            };
            #endregion

            #region Style DetailDistance
            Style detailDistanceStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(42, 42, 46) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(60, 68, 68) },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap }
                }
            };
            #endregion

            #region Style DetailPhone
            Style detailPhoneStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(19, 22, 26) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(0, 94, 184) },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap }
                }
            };
            #endregion

            #region Style Setting
            Style settingStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(17, 17, 21) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(255, 255, 255) },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap }
                }
            };
            #endregion

            #region Style SettingHint
            Style settingHintStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter { Property = Label.FontFamilyProperty, Value =  Device.OnPlatform("Arial", "Arial", "Arial") },
                    new Setter { Property = Label.FontSizeProperty, Value = Device.OnPlatform(13, 13, 17) },
                    new Setter { Property = Label.TextColorProperty, Value = Color.FromRgb(255, 255, 255) },
                    new Setter { Property = Label.OpacityProperty, Value = 0.5 },
                    new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.NoWrap }
                }
            };
            #endregion

            Resources.Add(PageTitleStyle, pageTitleStyle);
            Resources.Add(TitleStyle, titleStyle);
            Resources.Add(DescriptionStyle, descriptionStyle);
            Resources.Add(DescriptionLightStyle, descriptionLightStyle);
            Resources.Add(ListTitleStyle, listTitleStyle);
            Resources.Add(ListPercentStyle, listPercentStyle);
            Resources.Add(ListPercentSymbolStyle, listPercentSymbolStyle);
            Resources.Add(LabelPercentStyle, labelPercentStyle);
            Resources.Add(LabelPercentSymbolStyle, labelPercentSymbolStyle);
            Resources.Add(LinkStyle, linkStyle);
            Resources.Add(MenuStyle, menuStyle);
            Resources.Add(MenuHintStyle, menuHintStyle);
            Resources.Add(MenuDisabledStyle, menuDisabledStyle);
            Resources.Add(CategoryStyle, categoryStyle);
            Resources.Add(DetailTitleStyle, detailTitleStyle);
            Resources.Add(DetailDistanceStyle, detailDistanceStyle);
            Resources.Add(DetailPhoneStyle, detailPhoneStyle);
            Resources.Add(SettingStyle, settingStyle);
            Resources.Add(SettingHintStyle, settingHintStyle);
        }
 public static BoxView CreateSeparator(Style style)
 {
     return new BoxView {
         Style = style
     };
 }
Exemple #30
0
        public SaveByVMCS()
        {
            BindingContext = vm;

            var labelStyle = new Style(typeof(Label))
            {
                Setters = {
                new Setter { Property = Label.XAlignProperty, Value = TextAlignment.End },
                new Setter { Property = Label.YAlignProperty, Value = TextAlignment.Center },
                new Setter { Property = Label.WidthRequestProperty, Value = 150 }
                }
            };

            var labelName = new Label { Text = "Name:", Style = labelStyle };
            entryName = new Entry { Placeholder = "Input your name", HorizontalOptions = LayoutOptions.FillAndExpand };
            entryName.SetBinding(Entry.TextProperty, "Name", mode: BindingMode.TwoWay);

            var labelBirthday = new Label { Text = "Birthday:", Style = labelStyle };
            var pickerBirthday = new DatePicker { };
            pickerBirthday.SetBinding(DatePicker.DateProperty, "Birthday", mode: BindingMode.TwoWay);

            var labelLike = new Label { Text = "Like Xamarin?", Style = labelStyle };
            var switchLike = new Switch { };
            switchLike.SetBinding(Switch.IsToggledProperty, "Like", mode: BindingMode.TwoWay);

            var saveButton = new Button { Text = "Save", HorizontalOptions = LayoutOptions.FillAndExpand };
            saveButton.Clicked += saveButton_Clicked;
            var loadButton = new Button { Text = "Load", HorizontalOptions = LayoutOptions.FillAndExpand };
            loadButton.Clicked += loadButton_Clicked;
            var clearButton = new Button { Text = "Clear", HorizontalOptions = LayoutOptions.FillAndExpand };
            clearButton.Clicked += clearButton_Clicked;
            resultLabel = new Label { Text = "", FontSize = 30 };

            Title = "Save to dic by vm (C#)";
            Content = new StackLayout
            {
                Padding = 10,
                Spacing = 10,
                Children = {
                    new Label { Text = "DataSave Sample", FontSize = 40, HorizontalOptions = LayoutOptions.Center },
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            labelName, entryName
                        }
                    },
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            labelBirthday, pickerBirthday
                        }
                    },
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            labelLike, switchLike
                        }
                    },
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            saveButton, loadButton, clearButton
                        }
                    },
                    resultLabel
                }
            };
        }
        public Style GenerateLabelStyle()
        {
            var themeStyle = new Style(typeof(Label))
            {
                Setters = {
                new Setter { Property = Label.BackgroundColorProperty, Value = m_theme.backgroundColour },
                    /*new Setter { Property = Label.FontProperty, Value = m_theme.font },*/
                    new Setter { Property = Label.FontSizeProperty, Value = Device.GetNamedSize(m_theme.fontSize, typeof(Label)) },
                    new Setter { Property = Label.TextColorProperty, Value = m_theme.fontColour }
                }
            };

            return themeStyle;
        }
Exemple #32
0
        public TopPage()
        {
            Label labeliOSDevCamp = new Label
            {
                Text = "Developed at iOSDevCamp 2015"
            };
                 Color backGroundColor = Device.OnPlatform<Color>(
                 Color.Green,
                 Color.Green,
                 Color.Green
            );

            Color textColor = Device.OnPlatform<Color>(
                   Color.Black,
                   Color.Black,
                   Color.Black
                );
            double buttonHeight = Device.OnPlatform<double>
              (
                50, // iOS
                50, // Android
                80  // Windows Phone

             );
            var buttonStyle = new Style(typeof(Button))
            {
                Setters = {
                  new Setter {Property = Button.BackgroundColorProperty, Value = backGroundColor},
                  new Setter {Property = Button.BorderRadiusProperty, Value = 0},
                  new Setter {Property = Button.HeightRequestProperty, Value = buttonHeight},
                  new Setter {Property = Button.TextColorProperty, Value = textColor }
                }
            };
            Label labelProgrammer = new Label
            {
                Text = "Programmers = Chris Mason, Tanlin Dickey"
            };
            Button playGameButton = new Button
            {
                Text = "Play Tic Tac Toe",
                Style = buttonStyle
            };
            Button aboutGameButton = new Button
            {
                Text = "About TicTacToeXam",
                Style = buttonStyle
            };

           

            // add the event handler to go to the other page
            playGameButton.Clicked += OnPlayGameButtonClicked;

            aboutGameButton.Clicked += OnAboutGameButtonClicked;

            Content = new StackLayout
            {
                Children = {
                    new Label { Text = "TicTacToe using Xamarin.Forms!" },
                    labeliOSDevCamp,
                    labelProgrammer,
                    playGameButton,
                    aboutGameButton,
                    webView
                }
            };
        }