public MaterialDesignPage()
        {
            this.Title = "Material Design";

            fab = new CoreFloatingActionButton()
            {
                Size         = FABControlSize.Normal,
                ColorNormal  = Color.FromHex("#DF8049"),
                ColorPressed = Color.FromHex("#DF8049").MultiplyAlpha(0.4),
                ImageName    = "plus.png"
            };

            fab.SetBinding(CoreFloatingActionButton.CommandProperty, "FABClicked");
            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(0.95f, 0.95f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));


            var fteUserName = new CoreFloatingTextEntry()
            {
                Placeholder = "User Name",
                ErrorText   = "Required Field",
                ErrorColor  = Color.Red,
                Validator   = CoreFloatingTextEntry.RequiredValidator
            };

            var ftePassword = new CoreFloatingTextEntry()
            {
                Placeholder = "Password",
                IsPassword  = true,
                ErrorText   = "Required Field",
                ErrorColor  = Color.Red,
                Validator   = CoreFloatingTextEntry.RequiredValidator
            };


            Content = new StackContainer(true)
            {
                Padding  = new Thickness(20, 30, 20, 20),
                Spacing  = CoreSettings.On <double>(40, 5, 5),
                Children = { fteUserName, ftePassword }
            };

            AbsoluteLayer.Children.Add(fab);
        }
示例#2
0
        public TodoPage()
        {
            this.Title = "Todo List";

            var fab = new CoreFloatingActionButton()
            {
                Size         = FABControlSize.Normal,
                ColorNormal  = CoreStyles.NavigationBarColor,
                ColorPressed = CoreStyles.NavigationBarColor.MultiplyAlpha(0.4),
                ImageName    = "plus.png",
            };

            fab.SetBinding(CoreFloatingActionButton.CommandProperty, "FABClicked");
            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(0.95f, 0.95f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

            var lst = new CoreListView()
            {
                IsPullToRefreshEnabled = true,
                ItemTemplate           = new DataTemplate(typeof(TodoPageCell)),
                RowHeight = 65
            };

            lst.SetBinding(CoreListView.ItemsSourceProperty, "CurrentTodoList");
            lst.SetBinding(CoreListView.IsRefreshingProperty, "IsRefreshing");
            lst.SetBinding(CoreListView.RefreshCommandProperty, "RefreshData");
            lst.SetBinding(CoreListView.IsVisibleProperty, "DataExists");
            lst.Effects.Add(new HideListSeparatorEffect());
#if __IOS__
            lst.Effects.Add(new RemoveEmptyRowsEffect());
#endif


            var imgLabel = new Label()
            {
                FontSize          = 75,
                TextColor         = Color.LightGray,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center
            };
            imgLabel.SetBinding(Label.TextProperty, "EmptyDataIcon.Unicode");
            imgLabel.SetBinding(Label.FontFamilyProperty, "EmptyDataIcon.FontFamily");

            var imgDescription = new Label()
            {
                TextColor               = Color.LightGray,
                FontSize                = 32,
                HorizontalOptions       = LayoutOptions.Center,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                Text = "The dataset is empty. Try adding an item manually."
            };

            var emptyPanel = new StackLayout()
            {
                Padding  = 30,
                Children = { imgLabel, imgDescription }
            };
            emptyPanel.SetBinding(StackLayout.IsVisibleProperty,
                                  new Binding(path: "DataExists", converter: AppConverters.ReverseBoolean));

            Content = new StackLayout()
            {
                Children = { lst, emptyPanel }
            };

            AbsoluteLayer.Children.Add(fab);
        }