Наследование: Xamarin.Forms.StackLayout
Пример #1
0
        public LoginView()
        {
            BindingContext = new LoginViewModel(new AccountService(), Navigation, this);

            var stack = new BaseStackLayout
            {
                Orientation = StackOrientation.Vertical,
                Spacing = 10
            };

            var loginHeader = new Label
            {
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                Text = "Bloggity Login",
                LineBreakMode = LineBreakMode.WordWrap
            };

            var usernameEntry = new CustomTextEntry("Username") {Placeholder = "Username"};
            var passwordEntry = new CustomTextEntry("Password") {Placeholder = "Password", IsPassword = true};
            var loginButton = new CustomButton { Text = "Login" };
            loginButton.SetBinding(Button.CommandProperty, "LoginCommand");

            stack.Children.Add(loginHeader);
            stack.Children.Add(usernameEntry);
            stack.Children.Add(passwordEntry);
            stack.Children.Add(loginButton);

            Content = stack;
        }
Пример #2
0
		public BaseStackLayout GetBaseLayout()
		{
			var grid = new Grid
			{
				BackgroundColor = Color.White.ToFormsColor(),
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				RowDefinitions =
				{
					new RowDefinition { Height = GridLength.Auto }
				},
				ColumnDefinitions =
				{
					new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }
				}
			};

			grid.Children.Add (Drawer, 0, 1, 0, 1);
			foreach (var layout in Layouts) 
			{
				grid.Children.Add (layout, 1, 4, 0, 1);
			}

			var baseLayout = new BaseStackLayout 
			{ 
				Children = { grid },
				Padding = new Thickness(0)
			};

			return baseLayout;
		}
Пример #3
0
		void CreateDrawerLayout()
		{
			Drawer = new BaseStackLayout 
			{
				Padding = new Thickness(0)
			};

			var cell = new DataTemplate(typeof(TextCell));
			cell.SetBinding(TextCell.TextProperty, "Title");

			Drawer.Children.Add (ListView);
		}
Пример #4
0
        public PostsListView()
        {
            var stack = new BaseStackLayout
            {
                Orientation = StackOrientation.Vertical,
                Spacing = 10
            };

            var about = new Label
            {
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                Text = "Posts",
                LineBreakMode = LineBreakMode.WordWrap
            };

            stack.Children.Add(about);

            Content = stack;
        }
Пример #5
0
        public HomeMasterView(HomeViewModel viewModel)
        {
            Icon = "slideout.png";
            BindingContext = viewModel;
            
			var layout = new BaseStackLayout 
			{ 

				BackgroundColor = Color.DarkGray.ToFormsColor(),
				Spacing = 0,
				Padding = new Thickness(0)
			};

            #region Add list view to layout

			var cell = new DataTemplate(typeof(ListImageCell));
			cell.SetBinding(TextCell.TextProperty, "Title");
			cell.SetBinding(ImageCell.ImageSourceProperty, "Icon");

            ListView = new ListView
			{
				BackgroundColor = Color.DarkGray.ToFormsColor(),
				ItemTemplate = cell,
				ItemsSource = viewModel.MenuItems
			};

            // Set default selected item to settings view
            if (_postsListView == null)
                _postsListView = new PostsListView();

            PageSelection = _postsListView;

            //Change to the correct page
            ListView.ItemSelected += ListItemSelected;
			ListView.SelectedItem = viewModel.MenuItems.FirstOrDefault(a => a.MenuType == HomeMenuType.Posts);
            layout.Children.Add(ListView);
            
            #endregion

            Content = layout;
        }