public LinkedInLoginPage(LinkedInConnection connection)//string key, string secret, string scope, string redirectURL)
        {
            this.Title = "LinkedInLoginPage";

            this._Connection = connection;
            this._Browser = new WebView();

           // LinkedInConnection connection = new LinkedInConnection(key, secret, scope, redirectURL);
            this._Connection.SignIn(this._Browser);
            Label lbl = new Label() { Text = "Connecting..." };
            lbl.SetBinding(Label.IsVisibleProperty, "IsVisible", BindingMode.OneWay, new BooleanInverterConverter());
            lbl.BindingContext = this._Browser;

            this._BaseLayout = new StackLayout()
            {
                Orientation = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            this._BaseLayout.Children.Add(lbl);
            this._BaseLayout.Children.Add(this._Browser);

            this._Browser.IsVisible = false;


            Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);  // Accomodate iPhone status bar.
            Content = this._BaseLayout;

        }
Esempio n. 2
0
    public OpcionesCell()
    {
      var image = new Image
      {
        HorizontalOptions = LayoutOptions.Start,
      };
      image.SetBinding(Image.SourceProperty, new Binding("Imagen"));
      image.SetBinding(Image.BackgroundColorProperty, new Binding("ColorFondo", BindingMode.OneWay, new ColorConverter()));
      image.WidthRequest = image.HeightRequest = 24;

      var nameLabel = new Label
      {
        HorizontalOptions = LayoutOptions.FillAndExpand,
        TextColor = Color.Black,
        BackgroundColor = Color.Gray
      };
      nameLabel.SetBinding(Label.TextProperty, "Nombre");
      nameLabel.SetBinding(Label.BackgroundColorProperty, new Binding("ColorFondo", BindingMode.OneWay, new ColorConverter()));

      var viewLayout = new StackLayout()
      {
        Orientation = StackOrientation.Horizontal,
        VerticalOptions = LayoutOptions.CenterAndExpand,
        Children = { image, nameLabel}
      };
      viewLayout.SetBinding(StackLayout.BackgroundColorProperty, new Binding("ColorFondo", BindingMode.OneWay, new ColorConverter()));

      View = viewLayout;
    }
Esempio n. 3
0
        public sideCustomViewCell()
        {
            StackLayout s = new StackLayout {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
                Orientation = StackOrientation.Horizontal,
                Padding = 10,
                Spacing = 10
            };
            s.SetBinding (StackLayout.BackgroundColorProperty, "Background");

            Label l = new Label {
                FontSize = 17,
                FontAttributes = FontAttributes.Bold,
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Center
            };
            l.SetBinding (Label.TextProperty, "Title");
            l.SetBinding (Label.TextColorProperty, "TextColour");

            Image i = new Image {
            };
            i.SetBinding (Image.SourceProperty, "IconSource");

            s.Children.Add (i);
            s.Children.Add (l);

            this.View = s;
        }
Esempio n. 4
0
        public customCellTags()
        {
            Label l = new Label{
                FontSize = 18,
                FontAttributes = FontAttributes.Bold,
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Center,
                WidthRequest = 200
            };

            l.SetBinding (Label.TextProperty, "Name");
            l.SetBinding (Label.TextColorProperty, "TextColour");

            Image i = new Image {
            };

            i.SetBinding (Image.SourceProperty, "checkImage");

            StackLayout cellLayout = new StackLayout {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Spacing = 20,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Orientation = StackOrientation.Horizontal,
                Padding = 5
            };

            cellLayout.Children.Add (i);
            cellLayout.Children.Add (l);

            this.View = cellLayout;
        }
        public RangeSliderBubble()
        {
            // Init
            this.BackgroundColor = Color.Transparent;

            // Image
            _image = new Image();

            AbsoluteLayout.SetLayoutFlags(_image, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(_image, new Rectangle(0f, 0f, 1f, 1f));

            _image.SetBinding(Image.SourceProperty, new Binding(path: "Source", source: this));

            this.Children.Add(_image);

            // Label
            _label = new Label() { VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center };

            AbsoluteLayout.SetLayoutFlags(_label, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(_label, new Rectangle(0.5f, 0.75f, 0.8f, 0.5f));

            _label.SetBinding(Label.TextProperty, new Binding(path: "Text", source: this));
            _label.SetBinding(Label.FontFamilyProperty, new Binding(path: "FontFamily", source: this));
            _label.SetBinding(Label.FontSizeProperty, new Binding(path: "FontSize", source: this));
            _label.SetBinding(Label.TextColorProperty, new Binding(path: "TextColor", source: this));

            this.Children.Add(_label);
        }
Esempio n. 6
0
        public TitleBarView()
        {
            //Spacing = 0;
            //Padding=new Thickness(10,0);
            Padding = new Thickness(10, 10);
            BackgroundColor = Color.White; //Color.FromHex("#f7f7f7");
            Orientation = StackOrientation.Vertical;
            textLabel = new Label();
            textLabel.BindingContext = this;
            lineView = new LineView()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            lineView.BindingContext = this;

            textLabel.SetBinding(Label.TextProperty,"Text");
            textLabel.SetBinding(Label.TextColorProperty, "TextColor");
            textLabel.SetBinding(Label.FontAttributesProperty, "FontAttributes");

            textLabel.SetBinding(Label.FontFamilyProperty, "FontFamily");

            textLabel.SetBinding(Label.FontSizeProperty, "FontSize");

            //lineView.SetBinding(LineView.BackgroundColorProperty, "UnderLineColor");
            lineView.BackgroundColor = Color.FromHex("#eee");
            lineView.SetBinding(LineView.HeightRequestProperty, "UnderLineHeight");

            Children.Add(textLabel);
            Children.Add(lineView);
        }
Esempio n. 7
0
        public HorizontalCell()
        {
            Grid grid = new Grid {
                Padding = new Thickness (5, 0, 5, 0),
                ColumnDefinitions = {
                    new ColumnDefinition { Width = new GridLength (0.3, GridUnitType.Star) },
                    new ColumnDefinition { Width = new GridLength (0.7, GridUnitType.Star) },
                },
                RowDefinitions = {
                    new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }
                }
            };

            var leftLabel = new Label {
                YAlign = TextAlignment.Center,
                XAlign = TextAlignment.Start,
            };

            var rightLabel = new Label {
                YAlign = TextAlignment.Center,
                XAlign = TextAlignment.End,
            };

            leftLabel.SetBinding<HorizontalCell> (Label.TextProperty, vm => vm.Text);
            leftLabel.SetBinding<HorizontalCell> (Label.TextColorProperty, vm => vm.TextColor);

            rightLabel.SetBinding<HorizontalCell> (Label.TextProperty, vm => vm.Detail);
            rightLabel.SetBinding<HorizontalCell> (Label.TextColorProperty, vm => vm.DetailColor);

            grid.Children.Add (leftLabel, 0, 0);
            grid.Children.Add (rightLabel, 1, 0);

            grid.BindingContext = this;
            View = grid;
        }
Esempio n. 8
0
        View CreateContent(ImageCell cell)
        {
            XForm.Label text = new XForm.Label
            {
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                FontAttributes          = FontAttributes.Bold,
            };
            XForm.Label detailLabel = new XForm.Label
            {
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.FillAndExpand,
            };
            detailLabel.FontSize = Device.GetNamedSize(NamedSize.Micro, detailLabel);

            text.SetBinding(XForm.Label.TextProperty, new Binding("Text", source: cell));
            text.SetBinding(XForm.Label.TextColorProperty, new Binding("TextColor", source: cell));

            detailLabel.SetBinding(XForm.Label.TextProperty, new Binding("Detail", source: cell));
            detailLabel.SetBinding(XForm.Label.TextColorProperty, new Binding("DetailColor", source: cell));

            XForm.Image image = new XForm.Image
            {
                HeightRequest     = Element.ItemHeight,
                WidthRequest      = Element.ItemWidth,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Aspect            = Aspect.Fill
            };
            image.SetBinding(XForm.Image.SourceProperty, new Binding("ImageSource", source: cell));

            var view = new AbsoluteLayout();

            view.Children.Add(image, new XForm.Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);
            view.Children.Add(new StackLayout
            {
                VerticalOptions   = LayoutOptions.EndAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new StackLayout {
                        VerticalOptions   = LayoutOptions.EndAndExpand,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Padding           = 15,
                        Spacing           = 0,
                        BackgroundColor   = XForm.Color.FromHex("#2b7c87"),
                        Children          = { text, detailLabel }
                    }
                }
            }, new XForm.Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);

            cell.SetBinding(GridView.BindingContextProperty, new Binding("BindingContext", source: view));
            return(view);
        }
Esempio n. 9
0
		public ScanPage()
		{
			this.Title = "Beacon Scanner";

			var beaconDataTemplate = new DataTemplate(() =>
			{
				var identifierLabel = new Label { HorizontalTextAlignment = TextAlignment.Start };
				var proximityLabel = new Label { HorizontalTextAlignment = TextAlignment.Start };
				var distanceLabel = new Label { HorizontalTextAlignment = TextAlignment.Start };
				var mtsLabel = new Label { HorizontalTextAlignment = TextAlignment.Start };

				identifierLabel.Text = "Kontakt";
				identifierLabel.FontSize = 20;
				//identifierLabel.SetBinding(Label.TextProperty, "Distance");
				proximityLabel.FontSize = 15;
				proximityLabel.SetBinding(Label.TextProperty, "Distance");

				distanceLabel.FontSize = 12;
				distanceLabel.SetBinding(Label.TextProperty, "Proximity");
				distanceLabel.SetBinding(Label.TextColorProperty, "Proximity", BindingMode.Default, new ColorConverter());

				mtsLabel.FontSize = 12;
				mtsLabel.SetBinding(Label.TextProperty, "Meters", BindingMode.Default, new MtsConverter());

				var beaconInfo = new StackLayout();
				beaconInfo.Padding = new Thickness(10, 0, 0, 0);
				//beaconInfo.Orientation = StackOrientation.Horizontal;
				beaconInfo.Children.Add(identifierLabel);
				beaconInfo.Children.Add(proximityLabel);
				beaconInfo.Children.Add(
					new StackLayout{
					Orientation = StackOrientation.Horizontal,
					Children = { distanceLabel, mtsLabel }
				});

				return new ViewCell { View = beaconInfo };
			});

			_beaconsList = new ListView();
			_beaconsList.RowHeight = 80;
			_beaconsList.VerticalOptions = LayoutOptions.FillAndExpand;
			_beaconsList.ItemTemplate = beaconDataTemplate;


			var container = new StackLayout();
			container.HorizontalOptions = LayoutOptions.FillAndExpand;
			container.VerticalOptions = LayoutOptions.FillAndExpand;
			container.Children.Add(_beaconsList);

			this.Content = container;
		}
            public CustomCell()
            {
                //instantiate each of our views
                var image = new Image();
                StackLayout cellWrapper = new StackLayout();
                StackLayout horizontalLayout = new StackLayout();
                Label left = new Label();
                Label right = new Label();

                //set bindings
                left.SetBinding(Label.TextProperty, "name");
                right.SetBinding(Label.TextProperty, "description");
                image.SetBinding(Image.SourceProperty, "profileIcon");

                //Set properties for desired design
                cellWrapper.BackgroundColor = Color.FromHex("#eee");
                horizontalLayout.Orientation = StackOrientation.Horizontal;
                right.HorizontalOptions = LayoutOptions.EndAndExpand;
                left.TextColor = Color.FromHex("#f35e20");
                right.TextColor = Color.FromHex("503026");

                //add views to the view hierarchy
                horizontalLayout.Children.Add(image);
                horizontalLayout.Children.Add(left);
                horizontalLayout.Children.Add(right);
                cellWrapper.Children.Add(horizontalLayout);
                View = cellWrapper;
            }
Esempio n. 11
0
        public InitialPage()
        {
            BindingContext = new InitialPageModel (this.Navigation);

            Title = "Welcome to Peter";

            Label timeLabel = new Label {
                HorizontalOptions = LayoutOptions.Center,
            };
            timeLabel.SetBinding<InitialPageModel> (Label.TextProperty, vm => vm.DrinkingHoursDisplay);

            Slider timeSlider = new Slider (1, 24, 5) {
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            timeSlider.SetBinding<InitialPageModel> (Slider.ValueProperty, vm => vm.DrinkingHours, BindingMode.TwoWay);

            Button pressMe = new Button {
                Text = "Help Peter",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                FontSize = 60,
                HeightRequest = 200,
                BackgroundColor = Color.Yellow,
            };
            pressMe.SetBinding<InitialPageModel> (Button.CommandProperty, vm => vm.PressMeCommand);

            Content = new StackLayout {
                Children = {
                    timeLabel,
                    timeSlider,
                    pressMe,
                }
            };
        }
		public ListItemTemplate ()
		{
			var photo = new Image { HeightRequest = 44, WidthRequest = 44 };
			photo.SetBinding (Image.SourceProperty, "Photo");

			var nameLabel = new Label { 
				VerticalTextAlignment = TextAlignment.Center,
				FontAttributes = FontAttributes.None,
				FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
			};

			nameLabel.SetBinding (Label.TextProperty, "Name");

			var titleLabel = new Label { 
				VerticalTextAlignment = TextAlignment.Center,
				FontAttributes = FontAttributes.None,
				FontSize = Device.GetNamedSize (NamedSize.Micro, typeof(Label)),
			};

			titleLabel.SetBinding (Label.TextProperty, "Title");

			var information = new StackLayout {
				Padding = new Thickness (5, 0, 0, 0),
				VerticalOptions = LayoutOptions.StartAndExpand,
				Orientation = StackOrientation.Vertical,
				Children = { nameLabel, titleLabel }
			};

			View = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				Children = { photo, information }
			};
		}
Esempio n. 13
0
        public MenuCell()
        {
            this.Height = 70;
            var title = new Label
            {
                TextColor = Color.White,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize = 21,
                FontAttributes = FontAttributes.Bold,

            };

            title.SetBinding(Label.TextProperty, "Title");

            var cntViewTitle = new ContentView {
                Content = title,
                BackgroundColor = Color.FromRgb(1,112,126),
                HeightRequest = 70,
                HorizontalOptions = LayoutOptions.FillAndExpand,

            };

            View = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation = StackOrientation.Vertical,
                Children = { cntViewTitle },
                HeightRequest = 80,
                Padding = new Thickness(0,2,0,2),

            };
        }
		static StackLayout CreateMiddleRightLayout()
		{
			var ibuLabel = new Label
			{
				HorizontalOptions= LayoutOptions.StartAndExpand,
				FontSize = 11
			};
			ibuLabel.SetBinding(Label.TextProperty, "Ibu");

			var abvLabel = new Label
			{
				HorizontalOptions= LayoutOptions.StartAndExpand,
				FontSize = 11
			};
			abvLabel.SetBinding(Label.TextProperty, "Abv");

			var ctrrghtlayout = new StackLayout ()
			{
				VerticalOptions = LayoutOptions.Center,
				Orientation = StackOrientation.Vertical,
				Children = {ibuLabel, abvLabel }
			};

			return ctrrghtlayout;
		}
Esempio n. 15
0
        private Xamarin.Forms.View CreateCellView(string content, int colIndex, int rowIndex)
        {
            // Create the container view
            var container = new StackLayout()
            {
                BackgroundColor = rowIndex == 0 ? Color.Black : Color.White,
                Padding = new Thickness(10)
            };

            // Create the label
            var label = new Label()
            {
                Text = rowIndex == 0 ? content : content.Replace(",", "\r\n"),
                BackgroundColor = rowIndex == 0 ? Color.Black : Color.White,
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalTextAlignment = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Start,
                TextColor = rowIndex == 0 ? Color.White : Color.Black,
                FontSize = 12,
                LineBreakMode = LineBreakMode.WordWrap
            };

            if (rowIndex == 0)
            {
                label.FontAttributes = FontAttributes.Bold;
            }

            label.SetBinding(Label.FontFamilyProperty, new Binding(path: "FontFamily", source: this));

            container.Children.Add(label);

            // Return...
            return container;
        }
        public BindingSourceCodePage()
        {
            Label label = new Label
            {
                Text = "Binding Source Demo",
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Center
            };

            Slider slider = new Slider
            {
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            // Define Binding object with source object and property.
            Binding binding = new Binding
            {
                Source = slider,
                Path = "Value"
            };

            // Bind the Opacity property of the Label to the source.
            label.SetBinding(Label.OpacityProperty, binding);

            // Construct the page.
            Padding = new Thickness(10, 0);
            Content = new StackLayout
            {
                Children = { label, slider }
            };
        }
        public StackLayout CreateNewCountLayout()
        {
            var lblCount = new Label()
            {
                HorizontalOptions = LayoutOptions.Start,
                FontSize = 24,
            };
            lblCount.SetBinding(Label.TextProperty, new Binding("Count" , stringFormat: "#{0}"));

            var lblPrice = new Label()
            {
                HorizontalOptions = LayoutOptions.End,
                FontSize = 24,
            };
            lblPrice.SetBinding(Label.TextProperty, new Binding("Price", stringFormat: "\t\t\t{0:C2}"));

            var countLayout = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Orientation = StackOrientation.Horizontal,
                Children = { lblCount, lblPrice }
            };

            return countLayout;
        }
        public StackLayout CreateNewInfoLayout()
        {
            //BeerName
            var beerName = new Label()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize = 12,
            };
            beerName.SetBinding(Label.TextProperty, new Binding("beerName",stringFormat: "{0}"));

            //BeerPrice
            var beerPrice = new Label()
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize = 12,
            };
            beerPrice.SetBinding(Label.TextProperty, new Binding("cost", stringFormat: "price: {0}"));

            //Layout
            var infoLayout = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Orientation = StackOrientation.Horizontal,
                Children = { beerName,  beerPrice }
            };

            return infoLayout;
        }
Esempio n. 19
0
		public SessionCell ()
		{
			title = new Label {
				YAlign = TextAlignment.Center
			};
			title.SetBinding (Label.TextProperty, "Title");

			label = new Label {
				YAlign = TextAlignment.Center,
				Font = Font.SystemFontOfSize(10)
			};
			label.SetBinding (Label.TextProperty, "LocationDisplay");

			var fav = new Image {
				Source = FileImageSource.FromFile ("favorite.png"),
			};
			//TODO: implement favorites
			//fav.SetBinding (Image.IsVisibleProperty, "IsFavorite");

			var text = new StackLayout {
				Orientation = StackOrientation.Vertical,
				Padding = new Thickness(0, 0, 0, 0),
				HorizontalOptions = LayoutOptions.StartAndExpand,
				Children = {title, label}
			};

			layout = new StackLayout {
				Padding = new Thickness(20, 0, 0, 0),
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.StartAndExpand,
				Children = {text, fav}
			};
			View = layout;
		}
Esempio n. 20
0
        public UserCell()
        {
            layout = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                Padding = 5
            };

            profileImage = new Image {
                HorizontalOptions = LayoutOptions.Start ,
            };
            profileImage.SetBinding (Image.SourceProperty, new Binding ("ProfileImage"));

            usernameLabel = new Label {
                FontFamily = "AvenirNext-Regular",
                FontSize = 14,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };
            usernameLabel.SetBinding (Label.TextProperty, "Username");

            layout.Children.Add (profileImage);
            layout.Children.Add (usernameLabel);

            View = layout;
        }
Esempio n. 21
0
        public MenuListTemplate()
        {
            List<MenuItem> data = new MenuListData();
            this.ItemsSource = data;
            this.VerticalOptions = LayoutOptions.FillAndExpand;
            this.BackgroundColor = Theme.NavBackgroundColor;
            this.SeparatorColor = Color.Black;
            this.Margin = new Thickness(5);

            var menuDataTemplate = new DataTemplate(() =>
            {
                var pageImage = new Image
                {
                    VerticalOptions = LayoutOptions.Center,
                    HeightRequest = 30,
                    Margin = new Thickness(0, 0, 10, 0)
                };
                var pageLabel = new Label
                {
                    VerticalOptions = LayoutOptions.Center,
                    TextColor = Theme.TextColor,
                    FontSize = 20,
                };

                pageImage.SetBinding(Image.SourceProperty, "IconSource");
                pageLabel.SetBinding(Label.TextProperty, "Name");

                var layout = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    VerticalOptions = LayoutOptions.Center,
                    Children =
                    {
                        pageImage,
                        pageLabel
                    }
                };

                var menuFrame = new Frame
                {
                    OutlineColor = Theme.NavBackgroundColor,
                    BackgroundColor = Theme.NavBackgroundColor,
                    VerticalOptions = LayoutOptions.Center,
                    Padding = new Thickness(10),
                    Content = layout
                };

                return new ViewCell { View = menuFrame };
            });



            var cell = new DataTemplate(typeof(ViewCell));
            cell.SetBinding(TextCell.TextProperty, "Name");
            cell.SetValue(TextCell.TextColorProperty, Color.FromHex("2f4f4f"));


            this.ItemTemplate = menuDataTemplate;
            this.SelectedItem = data[0];
        }
Esempio n. 22
0
        public FancyListCell()
        {
            var image = new Image
              {
            HorizontalOptions = LayoutOptions.Start
              };
              image.SetBinding(Image.SourceProperty, new Binding("Icon"));
              image.WidthRequest = image.HeightRequest = 50;

              var nameLabel = new Label
              {
            HorizontalOptions = LayoutOptions.FillAndExpand,
            VerticalOptions = LayoutOptions.Center,
            FontSize = 26,
            TextColor = Color.Red
               // BackgroundColor = Color.FromRgba(0,0,0,0.5f)
              };
              nameLabel.SetBinding(Label.TextProperty, "Title");

              var viewLayout = new StackLayout()
              {
            Orientation = StackOrientation.Horizontal,
            Spacing = 10,
            Padding = 15,
            Children = { image, nameLabel }
              };
              View = viewLayout;
        }
		public TodoItemCell ()
		{
			StyleId = "Cell";

			var label = new Label {
				StyleId = "CellLabel",
				YAlign = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.StartAndExpand
			};
			label.SetBinding (Label.TextProperty, "Name");

			var tick = new Image {
				StyleId = "CellTick",
				Source = FileImageSource.FromFile ("check"),
				HorizontalOptions = LayoutOptions.End
			};
			tick.SetBinding (Image.IsVisibleProperty, "Done");

			var layout = new StackLayout {
				Padding = new Thickness(20, 0, 20, 0),
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Children = {label, tick}
			};
			View = layout;
		}
Esempio n. 24
0
        public ProductCell()
        {
            // instantiate each of our views
            var image = new Image();
            var cellLayout = new StackLayout();
            var detailsLayout = new StackLayout();
            var nameLabel = new Label();
            var descriptionLabel = new Label();
            var priceLabel = new Label();

            // set bindings
            image.SetBinding(Image.SourceProperty, new Binding("ImageSource", converter: new PathToImageSourceConverter()));
            nameLabel.SetBinding(Label.TextProperty, "Name");
            descriptionLabel.SetBinding(Label.TextProperty, "Description");
            priceLabel.SetBinding(Label.TextProperty, new Binding("Price", stringFormat: "Price: ${0:0.00}"));

            // set properties for desired design
            image.HeightRequest = 70;
            image.WidthRequest = 70;
            descriptionLabel.FontSize =  Device.GetNamedSize(NamedSize.Small, typeof (Label));
            descriptionLabel.TextColor = Color.Gray;
            priceLabel.TextColor = Color.Red;
            cellLayout.Padding = new Thickness(5, 5, 5, 5);
            cellLayout.Orientation = StackOrientation.Horizontal;
            detailsLayout.Padding = new Thickness(5, 0, 0, 0);

            // add views to the view hierarchy
            cellLayout.Children.Add(image);
            cellLayout.Children.Add(detailsLayout);
            detailsLayout.Children.Add(nameLabel);
            detailsLayout.Children.Add(descriptionLabel);
            detailsLayout.Children.Add(priceLabel);
            View = cellLayout;
        }
			public CustomCell()
			{
				var stateLabel = new Label () 
				{
					Text = "State:"
				};

				var stateText = new Label ();
				stateText.SetBinding (Label.TextProperty, "State");

				var cityLabel = new Label () 
				{
					Text = "City:"	
				};

				var cityText = new Label ();
				cityText.SetBinding (Label.TextProperty, "Name");

				var view = new StackLayout () {
					Orientation = StackOrientation.Horizontal,
					Children = 
					{
						stateLabel,
						stateText,
						cityLabel,
						cityText
					}
				};

				View = view;
			}
Esempio n. 26
0
        public ProductEditCell()
        {
            //instantiate each of our views
            StackLayout cellWrapper = new StackLayout ();
            StackLayout horizontalLayout = new StackLayout ();
            Label left = new Label ();
            Label arrow = new Label ();

            //set bindings
            left.SetBinding (Label.TextProperty, "title");

            //Set properties for desired design
            cellWrapper.BackgroundColor = Color.FromHex ("#eee");
            horizontalLayout.Orientation = StackOrientation.Horizontal;
            left.TextColor = Color.FromHex ("#f35e20");
            arrow.TextColor = Color.FromHex ("#f35e20");
            arrow.Text = ">";
            arrow.HorizontalOptions =LayoutOptions.EndAndExpand;
            //add views to the view hierarchy
            horizontalLayout.Children.Add (left);
            horizontalLayout.Children.Add (arrow);

            cellWrapper.Children.Add (horizontalLayout);
            View = cellWrapper;
        }
		public CodedPage ()
		{
			_SomeLabel = new Label {
				XAlign = TextAlignment.Center,
			};
			_SomeLabel.SetBinding (Label.TextProperty, nameof (SomeViewModel.SomeLabel));

			var listViewItemTemplate = new DataTemplate (typeof(ImageCell));
			_ItemsListView = new ListView (ListViewCachingStrategy.RecycleElement) {
				ItemTemplate = listViewItemTemplate,
			};
			_ItemsListView.SetBinding (ListView.ItemsSourceProperty, nameof (SomeViewModel.SomeItems));
			listViewItemTemplate.SetBinding (ImageCell.TextProperty, nameof (SomeItem.ItemName));
			listViewItemTemplate.SetBinding (ImageCell.ImageSourceProperty, nameof (SomeItem.ImageUrl));
			_ItemsListView.ItemTapped += async (sender, e) => {
				var item = ((SomeItem)e.Item);
				ItemSelected (this, item);
				_ItemsListView.SelectedItem = null;
			};

			Padding = new Thickness (0, 20, 0, 0);
			Content = new StackLayout {
				VerticalOptions = LayoutOptions.Fill,
				HorizontalOptions = LayoutOptions.Fill,
				Children = {
					_SomeLabel,
					_ItemsListView,
				}
			};
		}
Esempio n. 28
0
        public HolydayCell()
        {
            Label LabelName = new Label
            {
                TextColor = Color.White,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Start
            };
             Label LabelDate = new Label
            {
                TextColor = Color.White,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Start
            };
            LabelName.SetBinding(Label.TextProperty, "Name", BindingMode.TwoWay);
            LabelDate.SetBinding(Label.TextProperty, "Date", BindingMode.TwoWay);

            Grid grid = new Grid();
            var cd = new ColumnDefinition();
            cd.Width = GridLength.Auto;
            grid.ColumnDefinitions.Add(cd);
            cd = new ColumnDefinition();
            cd.Width = GridLength.Auto;
            grid.ColumnDefinitions.Add(cd);

            grid.Children.AddHorizontal(LabelName);
            grid.Children.AddHorizontal(LabelDate);
            View = grid;
        }
        public static StackLayout GetCountryRenderChartTooltip(FlexChart flexChart)
        {
            Image image = new Image();
            Label title = new Label();
            Label content = new Label();

            StackLayout container = new StackLayout();
            container.Padding = 5;


            container.BackgroundColor = Color.FromHex("#FFFFCA");

            title.SetBinding(Label.TextProperty, "SeriesName");
            title.TextColor = Color.Black;
            title.FontAttributes = FontAttributes.Bold;
            title.FontSize = 14;
            image.SetBinding(Image.SourceProperty, "XValue", BindingMode.OneWay, new FlagConverter());

            StackLayout horizontalContainer = new StackLayout();
            horizontalContainer.Orientation = StackOrientation.Horizontal;

            content.SetBinding(Label.TextProperty, "YValue");
            content.TextColor = Color.Black;
            content.FontSize = 14;

            horizontalContainer.Children.Add(image);
            horizontalContainer.Children.Add(title);

            container.Children.Add(horizontalContainer);
            container.Children.Add(content);

            return container;

            //((RelativeLayout)flexChart.Parent).Children.Add(this, Constraint.Constant(50), Constraint.Constant(50));
        }
			public BaseAsyncActivityTemplate() {
				// Adds the Content Presenter
				var contentPresenter = new ContentPresenter();
				Children.Add(contentPresenter, 0, 0);

				// The overlay that is presented when an Activity is Running
				var overlayGrid = new Grid { BackgroundColor = Color.FromHex("#CCCCCCCC") };
				overlayGrid.SetBinding(IsVisibleProperty, new TemplateBinding("IsActivityRunning"));

				var descriptionLabel = new Label { TextColor = Color.White };
				descriptionLabel.SetBinding(Label.TextProperty, new TemplateBinding("ActivityDescription"));

				var activityIndicator = new ActivityIndicator { Color = Color.White };
				activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new TemplateBinding("IsActivityRunning"));

				// A layout to hold the Activity Indicator and Description
				var activityIndicatorLayout = new StackLayout {
					HorizontalOptions = LayoutOptions.Center,
					VerticalOptions = LayoutOptions.Center,
				};
				activityIndicatorLayout.Children.Add(activityIndicator);
				activityIndicatorLayout.Children.Add(descriptionLabel);

				// Finally add the indicator to the overlay and the overlay to the grid
				overlayGrid.Children.Add(activityIndicatorLayout, 0, 0);
				Children.Add(overlayGrid);
			}
Esempio n. 31
0
        /// <summary>
        ///   Create a layout to hold the name & twitter handle of the user.
        /// </summary>
        /// <returns>The name layout.</returns>
        static StackLayout CreateNameLayout()
        {
            #region Create a Label for name
            Label nameLabel = new Label
                              {
                                  HorizontalOptions = LayoutOptions.FillAndExpand
                              };
            nameLabel.SetBinding(Label.TextProperty, "Name");
            #endregion

            #region Create a label for the Twitter handler.
            Label twitterLabel = new Label
                                 {
                                    HorizontalOptions = LayoutOptions.FillAndExpand,
                                    FontFamily = Fonts.Twitter.FontFamily,
                                    FontSize = Fonts.Twitter.FontSize,
                                    FontAttributes = Fonts.Twitter.FontAttributes
                                 };
            twitterLabel.SetBinding(Label.TextProperty, new Binding(path: "StartOn", stringFormat: "{0:ddd, MMM d 'at' h:mm tt}"));
            #endregion

            StackLayout nameLayout = new StackLayout
                                     {
                                         HorizontalOptions = LayoutOptions.StartAndExpand,
                                         Orientation = StackOrientation.Vertical,
                                         Children = { nameLabel, twitterLabel }
                                     };
            return nameLayout;
        }
Esempio n. 32
0
        public UcIHsLabelValueCell()
        {
            StackLayout layout = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal, Spacing = 5, Padding = new Thickness(5)
            };

            Label label = new Xamarin.Forms.Label()
            {
                FontSize = Device.GetNamedSize(NamedSize.Default, typeof(Label)), HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.End
            };

            label.SetBinding(Xamarin.Forms.Label.TextProperty, new Binding()
            {
                Source = IHsLabelValue, Path = "Label"
            });
            label.SetBinding(Xamarin.Forms.Label.TextColorProperty, new Binding()
            {
                Source = IHsLabelValue, Path = "LabelColor"
            });

            Label value = new Xamarin.Forms.Label()
            {
                FontSize          = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                FontAttributes    = FontAttributes.Italic,
                HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.End
            };

            value.SetBinding(Xamarin.Forms.Label.TextProperty, new Binding()
            {
                Source = IHsLabelValue, Path = "Value"
            });
            value.SetBinding(Xamarin.Forms.Label.TextColorProperty, new Binding()
            {
                Source = IHsLabelValue, Path = "ValueColor"
            });

            layout.Children.Add(label);
            layout.Children.Add(value);

            View = layout;
        }
            public TimeEntryCell()
            {
                int rowindex = 1;

                if (!Application.Current.Properties.ContainsKey("timerowindex"))
                {
                    Application.Current.Properties["timerowindex"] = rowindex;
                }
                rowindex = Convert.ToInt32(Application.Current.Properties["timerowindex"]);
                Color rowcolor = Color.FromHex("#FFFFFF");

                if (rowindex % 2 == 0)
                {
                    rowcolor = Color.FromHex("#ECF0F1");
                }
                else
                {
                    rowcolor = Color.FromHex("#FFFFFF");
                }
                rowindex = rowindex + 1;
                Application.Current.Properties["timerowindex"] = rowindex;
                Color textColor = Color.FromHex("#95A5A6");

                // schedule date/time
                Xamarin.Forms.Label labelTransactionDate = new Xamarin.Forms.Label();
                labelTransactionDate.FontFamily = Device.OnPlatform("OpenSans-Regular", null, null);
                labelTransactionDate.TextColor  = textColor;
                labelTransactionDate.SetBinding(Xamarin.Forms.Label.TextProperty, "TransactionDate", stringFormat: "{0:MM/dd/yyyy}");

                // name/location/phone
                Xamarin.Forms.Label labelStartTime = new Xamarin.Forms.Label();
                labelStartTime.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
                labelStartTime.TextColor  = textColor;
                labelStartTime.SetBinding(Xamarin.Forms.Label.TextProperty, "StartTime");

                Xamarin.Forms.Label labelEndTime = new Xamarin.Forms.Label();
                labelEndTime.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
                labelEndTime.TextColor  = textColor;
                labelEndTime.SetBinding(Xamarin.Forms.Label.TextProperty, "EndTime");

                View = new StackLayout()
                {
                    Orientation     = StackOrientation.Horizontal,
                    Spacing         = 10,
                    BackgroundColor = rowcolor,
                    Children        =
                    {
                        labelTransactionDate,
                        labelStartTime,
                        labelEndTime
                    }
                };
            }
Esempio n. 34
0
        void Construct()
        {
            BindingContext = new RefreshViewModel();

            var refreshView = new Xamarin.Forms.RefreshView
            {
                BackgroundColor = Color.Red,
                RefreshColor    = Color.Yellow
            };

            refreshView.SetBinding(Xamarin.Forms.RefreshView.CommandProperty, "RefreshCommand");
            refreshView.SetBinding(Xamarin.Forms.RefreshView.IsRefreshingProperty, "IsRefreshing");

            refreshView.On <WindowsOS>().SetRefreshPullDirection(RefreshPullDirection.BottomToTop);

            var listView = new Xamarin.Forms.ListView
            {
                ItemTemplate = new DataTemplate(() =>
                {
                    var stackLayout = new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal
                    };

                    var boxView = new BoxView {
                        WidthRequest = 40
                    };
                    var infoLabel = new Xamarin.Forms.Label();

                    boxView.SetBinding(BoxView.ColorProperty, "Color");
                    infoLabel.SetBinding(Xamarin.Forms.Label.TextProperty, "Name");

                    stackLayout.Children.Add(boxView);
                    stackLayout.Children.Add(infoLabel);

                    return(new ViewCell {
                        View = stackLayout
                    });
                })
            };

            listView.SetBinding(Xamarin.Forms.ListView.ItemsSourceProperty, "Items");

            refreshView.Content = listView;

            Content = refreshView;
        }
            public GroupHeaderCell()
            {
                // need a spot to hold the group key for display
                Xamarin.Forms.Label labelKey = new Xamarin.Forms.Label();
                labelKey.TextColor       = Color.White;
                labelKey.VerticalOptions = LayoutOptions.Center;
                labelKey.SetBinding(Xamarin.Forms.Label.TextProperty, "Key");

                View = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    BackgroundColor = Color.FromHex("#2980b9"),
                    Children        =
                    {
                        labelKey
                    }
                };
            }
Esempio n. 36
0
        public CustomerContactViewCell()
        {
            Color asbestos = Color.FromHex("#7f8c8d");

            Xamarin.Forms.Label labelContactCode = new Xamarin.Forms.Label();
            labelContactCode.SetBinding(Xamarin.Forms.Label.TextProperty, "ContactCode");
            labelContactCode.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
            labelContactCode.TextColor  = asbestos;

            Xamarin.Forms.Label labelContactName = new Xamarin.Forms.Label();
            labelContactName.SetBinding(Xamarin.Forms.Label.TextProperty, "ContactName");
            labelContactName.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
            labelContactName.TextColor  = asbestos;

            View = new StackLayout()
            {
                Children =
                {
                    labelContactCode,
                    labelContactName
                }
            };
        }
Esempio n. 37
0
            public WorkTicketDataCell()
            {
                // need a spot for the work ticket number
                Xamarin.Forms.Label labelWTNumber = new Xamarin.Forms.Label();
                labelWTNumber.FontSize = 10;
                labelWTNumber.SetBinding(Xamarin.Forms.Label.TextProperty, "FormattedTicketNo");

                // need a spot for the description
                Xamarin.Forms.Label labelDescription = new Xamarin.Forms.Label();
                labelDescription.FontSize       = 14;
                labelDescription.FontAttributes = FontAttributes.Bold;
                labelDescription.SetBinding(Xamarin.Forms.Label.TextProperty, "Description");

                View = new StackLayout()
                {
                    Padding  = 10,
                    Children =
                    {
                        labelWTNumber,
                        labelDescription
                    }
                };
            }
Esempio n. 38
0
        public WindowsRefreshViewPageCS()
        {
            WindowsRefreshViewPageViewModel viewModel = new WindowsRefreshViewPageViewModel();

            // Define DataTemplate.
            DataTemplate colorItemTemplate = new DataTemplate(() =>
            {
                Grid grid = new Grid
                {
                    Margin        = new Thickness(5),
                    HeightRequest = 120,
                    WidthRequest  = 105
                };

                BoxView boxView = new BoxView();
                boxView.SetBinding(BoxView.ColorProperty, "Color");

                Label label = new Label
                {
                    HorizontalOptions = LayoutOptions.Center,
                    VerticalOptions   = LayoutOptions.Center
                };
                label.SetBinding(Label.TextProperty, "Name");

                grid.Children.Add(boxView);
                grid.Children.Add(label);
                return(grid);
            });

            Label pullDirection = new Label
            {
                Text = "Pull Direction:",
                VerticalTextAlignment = TextAlignment.Center
            };

            EnumPicker enumPicker = new EnumPicker
            {
                EnumType      = typeof(Xamarin.Forms.PlatformConfiguration.WindowsSpecific.RefreshView.RefreshPullDirection),
                SelectedIndex = 0
            };

            Label numberOfItems = new Label
            {
                HorizontalOptions = LayoutOptions.Center
            };

            numberOfItems.SetBinding(Xamarin.Forms.Label.TextProperty, "Items.Count", stringFormat: "Number of items: {0}");

            StackLayout controlsLayout = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    pullDirection,
                    enumPicker
                }
            };

            FlexLayout flexLayout = new FlexLayout
            {
                Direction    = FlexDirection.Row,
                Wrap         = FlexWrap.Wrap,
                AlignItems   = FlexAlignItems.Center,
                AlignContent = FlexAlignContent.Center
            };

            BindableLayout.SetItemsSource(flexLayout, viewModel.Items);
            BindableLayout.SetItemTemplate(flexLayout, colorItemTemplate);

            // Set the FlexLayout as the child of the ScrollView.
            ScrollView scrollView = new ScrollView
            {
                Content = flexLayout
            };

            // Set the ScrollView as the child of the RefreshView.
            RefreshView refreshView = new RefreshView
            {
                Content      = scrollView,
                RefreshColor = Color.Teal
            };

            refreshView.SetBinding(RefreshView.IsRefreshingProperty, "IsRefreshing");
            refreshView.SetBinding(RefreshView.CommandProperty, "RefreshCommand");
            refreshView.On <Windows>().SetRefreshPullDirection(RefreshPullDirection.LeftToRight);

            enumPicker.SelectedIndexChanged += (s, e) =>
            {
                refreshView.On <Windows>().SetRefreshPullDirection((RefreshPullDirection)enumPicker.SelectedItem);
            };

            // Build the page.
            Title          = "RefreshView Demo";
            BindingContext = viewModel;
            Content        = new StackLayout
            {
                Margin   = new Thickness(10),
                Children =
                {
                    controlsLayout,
                    numberOfItems,
                    refreshView
                }
            };
        }
Esempio n. 39
0
        public EmbeddingControls()
        {
            var iconTapCommand = new AsyncValueCommand(async() =>
            {
                if (BindingContext is not MediaPlayer player)
                {
                    throw new InvalidOperationException($"{nameof(BindingContext)} must be {nameof(MediaPlayer)}");
                }

                if (player.State == PlaybackState.Playing)
                {
                    player.Pause();
                }
                else
                {
                    await player.Start();
                }
            });

            PlayIcon = new Grid
            {
                Children =
                {
                    new ShapesPath
                    {
                        Scale             = 0.7,
                        Data              = (ShapesPathGeometry) new Forms.Shapes.PathGeometryConverter().ConvertFromInvariantString("M93.5 52.4019C95.5 53.5566 95.5 56.4434 93.5 57.5981L5 108.694C3 109.848 0.499996 108.405 0.499996 106.096V3.9045C0.499996 1.5951 3 0.151723 5 1.30642L93.5 52.4019Z"),
                        Fill              = Brush.White,
                        Opacity           = 0.4,
                        Aspect            = Stretch.Uniform,
                        HorizontalOptions = LayoutOptions.Center
                    }
                }
            };

            PlayIcon.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = iconTapCommand
            });
            AbsoluteLayout.SetLayoutFlags(PlayIcon, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(PlayIcon, new Rectangle(0.5, 0.5, 0.25, 0.25));

            PauseIcon = new Grid
            {
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    new ShapesPath
                    {
                        Scale             = 0.7,
                        Data              = (ShapesPathGeometry) new Forms.Shapes.PathGeometryConverter().ConvertFromInvariantString("M1 1H36V131H1V1Z"),
                        Fill              = Brush.White,
                        Opacity           = 0.4,
                        Aspect            = Stretch.Uniform,
                        HorizontalOptions = LayoutOptions.Start
                    },
                    new ShapesPath
                    {
                        Scale             = 0.7,
                        Data              = (ShapesPathGeometry) new Forms.Shapes.PathGeometryConverter().ConvertFromInvariantString("M71 1H106V131H71V1Z"),
                        Fill              = Brush.White,
                        Opacity           = 0.4,
                        Aspect            = Stretch.Uniform,
                        HorizontalOptions = LayoutOptions.Start
                    }
                }
            };

            PauseIcon.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = iconTapCommand
            });
            AbsoluteLayout.SetLayoutFlags(PauseIcon, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(PauseIcon, new Rectangle(0.5, 0.5, 0.25, 0.25));

            var bufferingLabel = new XLabel
            {
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label), false),
                HorizontalTextAlignment = XTextAlignment.Center,
                TextColor = Color.FromHex("#eeeeeeee")
            };

            bufferingLabel.SetBinding(XLabel.TextProperty, new Binding
            {
                Path         = "BufferingProgress",
                StringFormat = "{0:0%}"
            });
            bufferingLabel.SetBinding(IsVisibleProperty, new Binding
            {
                Path = "IsBuffering",
            });
            AbsoluteLayout.SetLayoutFlags(bufferingLabel, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(bufferingLabel, new Rectangle(0.5, 0.5, 0.25, 0.25));

            var progressBoxView = new BoxView
            {
                Color = Color.FromHex($"#4286f4")
            };

            progressBoxView.SetBinding(AbsoluteLayout.LayoutBoundsProperty, new Binding
            {
                Path      = "Progress",
                Converter = new ProgressToBoundTextConverter()
            });
            AbsoluteLayout.SetLayoutFlags(progressBoxView, AbsoluteLayoutFlags.All);

            var posLabel = new XLabel
            {
                Margin   = new Thickness(10, 0, 0, 0),
                FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(XLabel)),
                HorizontalTextAlignment = XTextAlignment.Start
            };

            posLabel.SetBinding(XLabel.TextProperty, new Binding
            {
                Path      = "Position",
                Converter = new MillisecondToTextConverter()
            });
            AbsoluteLayout.SetLayoutFlags(posLabel, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(posLabel, new Rectangle(0, 0, 1, 1));

            var durationLabel = new XLabel
            {
                Margin   = new Thickness(0, 0, 10, 0),
                FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(XLabel)),
                HorizontalTextAlignment = XTextAlignment.End
            };

            durationLabel.SetBinding(XLabel.TextProperty, new Binding
            {
                Path      = "Duration",
                Converter = new MillisecondToTextConverter()
            });
            AbsoluteLayout.SetLayoutFlags(durationLabel, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(durationLabel, new Rectangle(0, 0, 1, 1));

            var progressInnerLayout = new AbsoluteLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HeightRequest     = 23,
                BackgroundColor   = Color.FromHex("#80000000"),
                Children          =
                {
                    progressBoxView,
                    posLabel,
                    durationLabel
                }
            };

            var progressLayout = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        VerticalOptions = LayoutOptions.FillAndExpand
                    },
                    new StackLayout
                    {
                        Margin            = Device.Idiom == TargetIdiom.Watch ? new Thickness(80, 0, 80, 0) : 20,
                        VerticalOptions   = LayoutOptions.End,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        BackgroundColor   = Color.FromHex("#50000000"),
                        Children          = { progressInnerLayout }
                    }
                }
            };

            AbsoluteLayout.SetLayoutFlags(progressLayout, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(progressLayout, new Rectangle(0, 0, 1, 1));

            Content = new AbsoluteLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          =
                {
                    progressLayout,
                    PlayIcon,
                    PauseIcon,
                    bufferingLabel
                }
            };
        }
        public EventbriteViewPage()
        {
            Title           = "Eventbrite";
            BackgroundColor = Color.White;

            var foursquareViewModel = new EventbriteViewModel();

            BindingContext = foursquareViewModel;

            var pageTitleLabel = new Label
            {
                Text      = "Eventbrite",
                TextColor = Color.Gray,
                FontSize  = 24
            };

            var dataTemplate = new DataTemplate(() =>
            {
                var eventNameLabel = new Label
                {
                    TextColor = Color.FromHex("#FF8832"),
                    FontSize  = 20
                };
                eventNameLabel.SetBinding(Label.TextProperty, new Binding("Name.Text"));

                var eventStartLabel = new Label
                {
                    TextColor = Color.Gray,
                    FontSize  = 14
                };
                eventStartLabel.SetBinding(Label.TextProperty, new Binding("Start.Utc"));

                var eventEndLabel = new Label
                {
                    TextColor = Color.Gray,
                    FontSize  = 14
                };
                eventEndLabel.SetBinding(Label.TextProperty, new Binding("End.Utc"));

                var eventDescriptionLabel = new Label
                {
                    FontSize      = 14,
                    TextColor     = Color.Black,
                    HeightRequest = 100,
                };
                eventDescriptionLabel.SetBinding(Label.TextProperty, new Binding("Description.Text"));

                var eventAddressLabel = new Label
                {
                    FontSize  = 14,
                    TextColor = Color.Gray,
                };
                eventAddressLabel.SetBinding(Label.TextProperty,
                                             new Binding("Venue.Address.Localized_Address_Display"));

                var logoImage = new Image
                {
                    WidthRequest    = 120,
                    HeightRequest   = 65,
                    VerticalOptions = LayoutOptions.Start,
                };
                logoImage.SetBinding(Image.SourceProperty, new Binding("Logo.Url"));

                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Orientation = StackOrientation.Vertical,
                        Padding = new Thickness(0, 5, 0, 10),
                        Children =
                        {
                            new StackLayout
                            {
                                Orientation = StackOrientation.Horizontal,
                                Children =
                                {
                                    logoImage,
                                    eventNameLabel,
                                }
                            },
                            eventAddressLabel,
                            new StackLayout
                            {
                                Orientation = StackOrientation.Horizontal,
                                Children =
                                {
                                    eventStartLabel,
                                    eventEndLabel
                                }
                            },
                            eventDescriptionLabel,
                        }
                    }
                });
            });

            var listView = new ListView
            {
                HasUnevenRows = true
            };

            listView.SetBinding(ListView.ItemsSourceProperty, "EventbriteEvents.Events");

            listView.ItemTemplate = dataTemplate;

            Content = new StackLayout
            {
                Padding  = new Thickness(5, 10),
                Children =
                {
                    pageTitleLabel,
                    listView
                }
            };
        }
        public WindowsListViewPageCS()
        {
            var personDataTemplate = new DataTemplate(() =>
            {
                var grid = new Grid();
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(0.7, GridUnitType.Star)
                });
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(0.3, GridUnitType.Star)
                });

                var nameLabel = new Xamarin.Forms.Label();
                var ageLabel  = new Xamarin.Forms.Label {
                    HorizontalOptions = LayoutOptions.Center
                };

                nameLabel.SetBinding(Xamarin.Forms.Label.TextProperty, "Name");
                ageLabel.SetBinding(Xamarin.Forms.Label.TextProperty, "Age");

                var tapGestureRecognizer     = new TapGestureRecognizer();
                tapGestureRecognizer.Tapped += async(sender, e) =>
                {
                    await DisplayAlert("Tap Gesture Recognizer", "Tapped event fired.", "OK");
                };
                nameLabel.GestureRecognizers.Add(tapGestureRecognizer);

                grid.Children.Add(nameLabel);
                grid.Children.Add(ageLabel, 1, 0);

                return(new ViewCell {
                    View = grid
                });
            });

            _listView = new Xamarin.Forms.ListView {
                IsGroupingEnabled = true, ItemTemplate = personDataTemplate
            };
            _listView.SetBinding(ItemsView <Cell> .ItemsSourceProperty, "GroupedEmployees");
            _listView.GroupDisplayBinding = new Binding("Key");
            _listView.ItemTapped         += async(sender, e) =>
            {
                await DisplayAlert("Item Tapped", "ItemTapped event fired.", "OK");
            };
            _listView.On <Windows>().SetSelectionMode(ListViewSelectionMode.Inaccessible);

            var button = new Button {
                Text = "Toggle SelectionMode"
            };

            button.Clicked += (sender, e) =>
            {
                switch (_listView.On <Windows>().GetSelectionMode())
                {
                case ListViewSelectionMode.Accessible:
                    _listView.On <Windows>().SetSelectionMode(ListViewSelectionMode.Inaccessible);
                    break;

                case ListViewSelectionMode.Inaccessible:
                    _listView.On <Windows>().SetSelectionMode(ListViewSelectionMode.Accessible);
                    break;
                }
                UpdateLabel();
            };

            _label = new Xamarin.Forms.Label {
                HorizontalOptions = LayoutOptions.Center
            };

            Title   = "ListView Selection Mode";
            Content = new StackLayout
            {
                Margin   = new Thickness(20),
                Children = { _listView, button, _label }
            };
            BindingContext = new ListViewViewModel();
            UpdateLabel();
        }
        ContentPage CreateMasterPage()
        {
            var items = new List <NavigationItem>
            {
                new NavigationItem("Save", "\uE105", new Command(async() => await DisplayAlert("Save", "Fake save dialog", "OK"))),
                new NavigationItem("Delete", "\uE107", new Command(async() => await DisplayAlert("Delete", "Fake delete dialog", "OK"))),
                new NavigationItem("Set Detail to Navigation Page", "\uE16F", new Command(() => Detail = new NavigationPage(CreateContentPageTwo()))),
                new NavigationItem("Set Detail to Content Page", "\uE160", new Command(() => Detail    = detailPage)),
                new NavigationItem("Back", "\uE106", _returnToPlatformSpecificsPage)
            };

            var listView = new Xamarin.Forms.ListView
            {
                ItemsSource  = items,
                ItemTemplate = new DataTemplate(() =>
                {
                    var grid = new Grid {
                        Margin = new Thickness(0, 10, 0, 10), WidthRequest = 40
                    };
                    grid.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = 48
                    });
                    grid.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = 200
                    });

                    var iconLabel = new Xamarin.Forms.Label
                    {
                        FontFamily = "Segoe MDL2 Assets",
                        FontSize   = 24,
                        HorizontalTextAlignment = TextAlignment.Center
                    };
                    iconLabel.SetBinding(Xamarin.Forms.Label.TextProperty, "Icon");

                    var textLabel = new Xamarin.Forms.Label();
                    textLabel.SetBinding(Xamarin.Forms.Label.TextProperty, "Text");

                    grid.Children.Add(iconLabel);
                    grid.Children.Add(textLabel);
                    Grid.SetColumn(iconLabel, 0);
                    Grid.SetColumn(textLabel, 1);

                    var cell = new ViewCell {
                        View = grid
                    };
                    return(cell);
                })
            };

            listView.ItemTapped += (sender, e) => (e.Item as NavigationItem).Command.Execute(null);

            return(new ContentPage
            {
                Title = "Master Page",
                Content = new StackLayout
                {
                    Margin = new Thickness(0, 10, 5, 0),
                    Spacing = 10,
                    Children = { listView }
                }
            });
        }
            public PartsListDataCell()
            {
                // Alternating row colors in list
                int rowindex = 1;

                if (!Application.Current.Properties.ContainsKey("rowindex"))
                {
                    Application.Current.Properties["rowindex"] = rowindex;
                }
                rowindex = Convert.ToInt32(Application.Current.Properties["rowindex"]);
                Color rowcolor = Color.FromHex("#FFFFFF");

                if (rowindex % 2 == 0)
                {
                    rowcolor = Color.FromHex("#ECF0F1");
                }
                else
                {
                    rowcolor = Color.FromHex("#FFFFFF");
                }
                rowindex = rowindex + 1;
                Application.Current.Properties["rowindex"] = rowindex;
                Color forecolor = Color.FromHex("#95A5A6");

                Color asbestos = Color.FromHex("#7f8C8d");

                // need a spot for the work ticket number
                Xamarin.Forms.Label labelPartItemCode = new Xamarin.Forms.Label();
                labelPartItemCode.FontSize   = 14;
                labelPartItemCode.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelPartItemCode.TextColor  = forecolor;
                labelPartItemCode.SetBinding(Xamarin.Forms.Label.TextProperty, "PartItemCode");

                // need a spot for the description
                Xamarin.Forms.Label labelItemCode = new Xamarin.Forms.Label();
                labelItemCode.FontSize   = 14;
                labelItemCode.TextColor  = forecolor;
                labelItemCode.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                //labelItemCode.FontAttributes = FontAttributes.Bold;
                labelItemCode.SetBinding(Xamarin.Forms.Label.TextProperty, "PartItemCodeDescription");

                // warehouse
                Xamarin.Forms.Label labelWarehouseHdg = new Xamarin.Forms.Label();
                labelWarehouseHdg.FontSize   = 14;
                labelWarehouseHdg.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelWarehouseHdg.TextColor  = forecolor;
                labelWarehouseHdg.Text       = "Warehouse";

                Xamarin.Forms.Label labelWarehouse = new Xamarin.Forms.Label();
                labelWarehouse.FontSize   = 14;
                labelWarehouse.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
                labelWarehouse.TextColor  = forecolor;
                labelWarehouse.SetBinding(Xamarin.Forms.Label.TextProperty, "Warehouse");

                // quantity
                Xamarin.Forms.Label labelQuantityHdg = new Xamarin.Forms.Label();
                labelQuantityHdg.FontSize   = 14;
                labelQuantityHdg.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelQuantityHdg.TextColor  = forecolor;
                labelQuantityHdg.Text       = "Quantity";

                Xamarin.Forms.Label labelQuantity = new Xamarin.Forms.Label();
                labelQuantity.FontSize   = 14;
                labelQuantity.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
                labelQuantity.TextColor  = forecolor;
                labelQuantity.SetBinding(Xamarin.Forms.Label.TextProperty, "Quantity");

                // unit cost
                Xamarin.Forms.Label labelCostHdg = new Xamarin.Forms.Label();
                labelCostHdg.FontSize   = 14;
                labelCostHdg.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelCostHdg.TextColor  = forecolor;
                labelCostHdg.Text       = "Unit Cost";

                Xamarin.Forms.Label labelCost = new Xamarin.Forms.Label();
                labelCost.FontSize   = 14;
                labelCost.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
                labelCost.TextColor  = forecolor;
                labelCost.SetBinding(Xamarin.Forms.Label.TextProperty, new Binding("UnitCost", stringFormat: "{0:C}"));

                // unit price
                Xamarin.Forms.Label labelPriceHdg = new Xamarin.Forms.Label();
                labelPriceHdg.FontSize   = 14;
                labelPriceHdg.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelPriceHdg.TextColor  = forecolor;
                labelPriceHdg.Text       = "Unit Price";

                Xamarin.Forms.Label labelPrice = new Xamarin.Forms.Label();
                labelPrice.FontSize   = 14;
                labelPrice.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
                labelPrice.TextColor  = forecolor;
                labelPrice.SetBinding(Xamarin.Forms.Label.TextProperty, new Binding("UnitPrice", stringFormat: "{0:C}"));

                // extd price
                Xamarin.Forms.Label labelExtdPriceHdg = new Xamarin.Forms.Label();
                labelExtdPriceHdg.FontSize   = 14;
                labelExtdPriceHdg.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelExtdPriceHdg.TextColor  = forecolor;
                labelExtdPriceHdg.Text       = "Extended Price";

                Xamarin.Forms.Label labelExtdPrice = new Xamarin.Forms.Label();
                labelExtdPrice.FontSize   = 14;
                labelExtdPrice.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
                labelExtdPrice.TextColor  = forecolor;
                labelExtdPrice.SetBinding(Xamarin.Forms.Label.TextProperty, new Binding("ExtdPrice", stringFormat: "{0:C}"));

                View = new StackLayout()
                {
                    Padding         = 5,
                    Orientation     = StackOrientation.Vertical,
                    BackgroundColor = rowcolor,
                    Children        =
                    {
                        new StackLayout()
                        {
                            Padding     = 1,
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                labelPartItemCode,
                                labelItemCode
                            }
                        },
                        new StackLayout()
                        {
                            Padding     = 1,
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                labelWarehouseHdg,
                                labelWarehouse
                            }
                        },
                        new StackLayout()
                        {
                            Padding     = 1,
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                labelCostHdg,
                                labelCost
                            }
                        },
                        new StackLayout()
                        {
                            Padding     = 1,
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                labelQuantityHdg,
                                labelQuantity,
                                labelPriceHdg,
                                labelPrice,
                                labelExtdPriceHdg,
                                labelExtdPrice
                            }
                        }
                    }
                };
            }
Esempio n. 44
0
        public Page_GoodRedacting(Good locGoodItem, ObservableCollection<Good> locLv_Goods, Document locDocument)
        {
            GoodItemRef = locGoodItem;
            RefLv_Goods = locLv_Goods;
            refDocument = locDocument;
            for (int cur = 0; cur < locGoodItem.Count; cur++)
            {
                GoodItem[cur] = locGoodItem[cur];
            }

            StackLayout stack = new StackLayout
            {
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            CommonProcs CP = new CommonProcs();

            //========== GoodName
            if (CP.GetProperty("ext_GoodListView_GoodName_IsVivsible") == "True")
            {
                AddCluster(stack, "ТМЦ: ", new ItemsRequestStructure { Intent = "Good", VarName = "nGood", Metadata = GoodItem.Metadata });
            }

            //========== Description
            if (CP.GetProperty("ext_GoodListView_GoodDescription_IsVivsible") == "True")
            {
                AddCluster(stack, "Хар-ка: ", new ItemsRequestStructure { Intent = "GoodDescription", Metadata = GoodItem.mGoodDescription, VarName = "nGoodDescription", ParentMetadata = GoodItem.Metadata });
            }
            //========== S/N
            if (CP.GetProperty("ext_GoodListView_GoodSerial_IsVivsible") == "True")
            {
                AddCluster(stack, "С/Н: ", new ItemsRequestStructure { Intent = "Serial", Metadata = GoodItem.mSerial, VarName = "nSerial", ParentMetadata = GoodItem.Metadata });
            }
            //========== UnitName
            if (CP.GetProperty("ext_GoodListView_UnitName_IsVivsible") == "True")
            {
                AddCluster(stack, "Ед.: ", new ItemsRequestStructure { Intent = "Unit", Metadata = GoodItem.mUnit, VarName = "nUnit", ParentMetadata = GoodItem.Metadata });
            }
            //========== Quality
            if (CP.GetProperty("ext_GoodListView_GoodQuality_IsVivsible") == "True")
            {
                AddCluster(stack, "Кач-во: ", new ItemsRequestStructure { Intent = "Quality", VarName = "nQuality", Metadata = GoodItem.mQuality });
            }
            //========== Amount
            if (CP.GetProperty("ext_GoodListView_GoodAmount_IsVivsible") == "True")
            {
                AddCluster(stack, "Кол.: ", new ItemsRequestStructure { Intent = "Amount", VarName = "Amount" });
            }
            //========== AmountAquired
            if (CP.GetProperty("ext_GoodListView_GoodAmountAquired_IsVivsible") == "True")
            {
                AddCluster(stack, "Набрано: ", new ItemsRequestStructure { Intent = "AmountAquired", VarName = "AmountAquired" });
            }
            //========== Value0
            if (CP.GetProperty("ext_GoodListView_Value0_IsVivsible") == "True")
            {
                AddCluster(stack, "Д/З_0: ", new ItemsRequestStructure { Intent = "Value0", VarName = "Value0" });
            }
            //========== Value1
            if (CP.GetProperty("ext_GoodListView_Value1_IsVivsible") == "true")
            {
                AddCluster(stack, "Д/З_1: ", new ItemsRequestStructure { Intent = "Value1", VarName = "Value1" });
            }
            //========== Value2
            if (CP.GetProperty("ext_GoodListView_Value2_IsVivsible") == "True")
            {
                AddCluster(stack, "Д/З_2: ", new ItemsRequestStructure { Intent = "Value2", VarName = "Value2" });
            }

            Xamarin.Forms.Label l = new Xamarin.Forms.Label
            {
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                TextColor = Color.Cyan,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment = TextAlignment.Center,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.End,
                FontSize = 14,
                Text = "Штрих-коды товара:"
            };

            stack.Children.Add(l);

            ListView lv_barcodes = new ListView
            {
                ItemsSource = os_barcodes,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.End,
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                ItemTemplate = new DataTemplate(() =>
                {
                    StackLayout s = new StackLayout
                    {
                        BackgroundColor = (Color)App.Current.Resources["textColor"],
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        //VerticalOptions = LayoutOptions.FillAndExpand,
                    };

                    l = new Xamarin.Forms.Label
                    {
                        BackgroundColor = (Color)App.Current.Resources["backColor"],
                        TextColor = Color.LightYellow,
                        HorizontalTextAlignment = TextAlignment.Start,
                        VerticalTextAlignment = TextAlignment.Center,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions = LayoutOptions.FillAndExpand,
                        FontSize = 14,
                    };

                    s.Children.Add(l);

                    l.SetBinding(Xamarin.Forms.Label.TextProperty, "Barcode");

                    return new ViewCell { View = s };
                })

            };

            lv_barcodes.ItemSelected += Lv_barcodes_ItemSelected;

            stack.Children.Add(lv_barcodes);

            Button B;
            if (new CommonProcs().GetProperty("ext_ScanHardWare") == "1")
            {
                B = new Button
                {
                    Text = "Сканировать",
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions = LayoutOptions.End
                };
                B.Clicked += Scan_Clicked;
                stack.Children.Add(B);
            }

            B = new Button
            {
                Text = "Удалить",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.End,

            };

            B.Clicked += B_Clicked_Delete;

            stack.Children.Add(B);

            B = new Button
            {
                Text = "Ok",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.End
            };
            B.Clicked += Ok_Clicked;

            stack.Children.Add(B);

            this.Content = stack;

        }
Esempio n. 45
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DetailPageCS"/> class.
        /// </summary>
        public DetailPageCS()
        {
            // create items list
            var groupItems = new List <DetailGroup>();

            // add group 1 items data
            DetailGroup group1 = new DetailGroup {
                ShortName = "Group Index 1"
            };

            int i;

            for (i = 1; i < 10; i++)
            {
                group1.Add(new DetailPageItem {
                    Title = "[" + i + "]elm.text.Subject", Content = "Content text will be written here"
                });
            }

            // add group 2 items data
            DetailGroup group2 = new DetailGroup {
                ShortName = "Group Index 2"
            };

            for (i = 11; i < 20; i++)
            {
                group2.Add(new DetailPageItem {
                    Title = "[" + i + "]elm.text.Subject", Content = "Content text will be written here"
                });
            }

            groupItems.Add(group1);
            groupItems.Add(group2);

            // create list view
            this.listView = new ListView
            {
                // Set the list item row height
                RowHeight         = (int)(0.13 * App.screenHeight),
                HasUnevenRows     = true,
                IsGroupingEnabled = true,

                // Set the group item display name binding
                GroupDisplayBinding = new Binding("DisplayName"),

                // Set the group item short name binding
                GroupShortNameBinding = new Binding("ShortName"),

                ItemsSource = groupItems,

                ItemTemplate = new DataTemplate(() =>
                {
                    Label titleLabel = new Label
                    {
                        TextColor = Color.Black,
                        FontSize  = FONT_SIZE,
                    };

                    Label contentLabel = new Label
                    {
                        TextColor         = Color.Gray,
                        FontSize          = FONT_SIZE - 5,
                        HorizontalOptions = LayoutOptions.StartAndExpand,
                    };

                    Label countLabel = new Label
                    {
                        TextColor = Color.Gray,
                        HorizontalTextAlignment = TextAlignment.End,
                        FontSize = FONT_SIZE - 5,
                        Text     = "[7/14]",
                    };
                    titleLabel.SetBinding(Label.TextProperty, "Title");
                    contentLabel.SetBinding(Label.TextProperty, "Content");

                    var layout = new StackLayout
                    {
                        Padding     = new Thickness(20, 25),
                        Orientation = StackOrientation.Vertical,
                        Children    =
                        {
                            titleLabel,
                            new StackLayout
                            {
                                Spacing     = 30,
                                Orientation = StackOrientation.Horizontal,
                                Children    =
                                {
                                    contentLabel,
                                    countLabel
                                }
                            }
                        }
                    };
                    return(new ViewCell
                    {
                        View = layout
                    });
                }),
            };

            // The title of this page
            this.Title = "Email UI";

            // Content view of this page.
            this.Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    this.listView
                }
            };
        }
        /// <summary>
        /// To initialize UI Components of an application information page
        /// </summary>
        private void InitializeComponent()
        {
            Title = "ApplicationInfo";

            /// The mainLayout consists of several parts to display application information.
            var mainLayout = new RelativeLayout {
            };

            /// To display an image as the background
            var background = new Background
            {
                Image = new FileImageSource {
                    File = "background_app.png"
                },
                Option = BackgroundOptions.Stretch,
            };

            mainLayout.Children.Add(
                background,
                Constraint.RelativeToParent((parent) =>
            {
                return(0);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(0);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height);
            }));

            /// To display an application icon path
            var icon = new Image
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            mainLayout.Children.Add(
                icon,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0556);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0537);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.1319);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0774);
            }));

            /// To display an application name
            var applicationName = new Label {
            };

            applicationName.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                applicationName,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.2472);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0961);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.7389);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0293);
            }));

            /// To display an application ID
            var applicationID = new Label {
            };

            applicationID.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                applicationID,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0375);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.3014);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4486);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0319);
            }));

            /// To display an application version
            var applicationVersion = new Label {
            };

            applicationVersion.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                applicationVersion,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.5416);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.3014);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4486);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0319);
            }));

            /// To display the device memory status
            var memoryLED = new Image
            {
                Source = "led.png"
            };

            mainLayout.Children.Add(
                memoryLED,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0375);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.4661);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0236);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0152);
            }));

            /// To dispay the device battery status
            var batteryLED = new Image
            {
                Source = "led.png"
            };

            mainLayout.Children.Add(
                batteryLED,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.5416);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.4661);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0236);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0152);
            }));

            /// To display the language setting on the device
            var language = new Label {
            };

            language.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                language,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0375);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.7032);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4486);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0319);
            }));

            /// To display the region format setting on the device
            var regionFormat = new Label {
            };

            regionFormat.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                regionFormat,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.5416);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.7032);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4486);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0319);
            }));

            /// To display the orientation of the device
            var deviceOrienation = new Label {
            };

            deviceOrienation.Style = ApplicationInformationStyle.ContentStyle;

            mainLayout.Children.Add(
                deviceOrienation,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0375);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.9109);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4661);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.0321);
            }));

            /// To display the orientation degree of the device
            var rotationDegree = new Label {
            };

            rotationDegree.Style = ApplicationInformationStyle.LargerContentStyle;

            mainLayout.Children.Add(
                rotationDegree,
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.5416);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.8254);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.4486);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.1276);
            }));

            BindingContextChanged += (s, e) =>
            {
                if (BindingContext == null)
                {
                    return;
                }

                icon.Source             = ((ApplicationInformationViewModel)BindingContext).IconPath;
                applicationName.Text    = ((ApplicationInformationViewModel)BindingContext).Name;
                applicationID.Text      = ((ApplicationInformationViewModel)BindingContext).ID;
                applicationVersion.Text = ((ApplicationInformationViewModel)BindingContext).Version;

                memoryLED.BindingContext        = BindingContext;
                batteryLED.BindingContext       = BindingContext;
                language.BindingContext         = BindingContext;
                regionFormat.BindingContext     = BindingContext;
                deviceOrienation.BindingContext = BindingContext;
                rotationDegree.BindingContext   = BindingContext;

                language.SetBinding(Label.TextProperty, "Language");
                regionFormat.SetBinding(Label.TextProperty, "RegionFormat");
                deviceOrienation.SetBinding(Label.TextProperty, "DeviceOrientation");
                rotationDegree.SetBinding(Label.TextProperty, "RotationDegree");

                memoryLED.SetBinding(ImageAttributes.BlendColorProperty, "LowMemoryLEDColor");
                batteryLED.SetBinding(ImageAttributes.BlendColorProperty, "LowBatteryLEDColor");
            };

            /// Set mainLayou as Content of the page
            Content = mainLayout;
        }
Esempio n. 47
0
        public Page GetUserRootPage()
        {
            var masterMenuAbsLayout = new AbsoluteLayout();

            App.HardwareBackPressed = () => Task.FromResult <bool?>(false);

            _userDetailPageData.FirstName    = "loading...";
            _userDetailPageData.LastName     = "Last Name : loading...";
            _userDetailPageData.Reputation   = "Reputation : loading...";
            _userDetailPageData.TotalEarning = "TotalEarning : loading...";
            _userDetailPageData.UserProfilePicImageSource = "";
            FetchUserDetailFromServer();
            var userImage = new Image
            {
                BindingContext = _userDetailPageData,
                WidthRequest   = 60,
                HeightRequest  = 60,
            };

            userImage.SetBinding(Image.SourceProperty, "UserProfilePicImageSource");
            //userImage.Source = ImageSource.FromUri(new Uri("http://i.imgur.com/Y5DauNCm.jpg"));

            var firstName = new Label
            {
                BindingContext = _userDetailPageData,
                TextColor      = Color.White
            };

            firstName.SetBinding(Label.TextProperty, "FirstName");
            var lastName = new Label
            {
                BindingContext = _userDetailPageData,
                TextColor      = Color.White
            };

            lastName.SetBinding(Label.TextProperty, "LastName");

            masterMenuAbsLayout.Children.Add(userImage, new Point(20, 5));
            masterMenuAbsLayout.Children.Add(firstName, new Point(90, 30));
            masterMenuAbsLayout.Children.Add(lastName, new Point(90, 45));

            return(MDPage = new MasterDetailPage
            {
                Master = new ContentPage
                {
                    Title = "Master",
                    BackgroundColor = Color.FromRgb(5, 99, 172),
                    Icon = Device.OS == TargetPlatform.iOS ? "menu.png" : null,
                    Content = new StackLayout
                    {
                        Padding = new Thickness(5, 50),
                        Children =
                        {
                            masterMenuAbsLayout,
                            Link(Constants.pageName_Tasks),
                            Link(Constants.pageName_ActiveTasks),
                            Link(Constants.pageName_CompletedTasks),
                            Link(Constants.pageName_FacebookLike),
                            Link(Constants.pageName_Referrals),
                            Link(Constants.logoutButtonText)
                        }
                    },
                },
                Detail = new NavigationPage(new ContentPage
                {
                    Content = new Label
                    {
                        Text = "Loading please wait...",
                        VerticalOptions = LayoutOptions.CenterAndExpand,
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                    }
                })
                ,
            });
        }
Esempio n. 48
0
        View CreateView()
        {
            var layout = new RelativeLayout {
            };

            var backgroundImage = new Image
            {
                Source = new FileImageSource {
                    File = "list_item_bg.png"
                },
                Aspect = Aspect.Fill,
            };

            layout.Children.Add(
                backgroundImage,
                Constraint.RelativeToParent((parent) =>
            {
                return(0);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(0);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height);
            }));

            var descriptionLabel = new Label
            {
                Text = "Description",
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.EndAndExpand,
                FontSize          = 30,
                FontAttributes    = FontAttributes.Bold,
            };

            descriptionLabel.SetBinding(Label.TextProperty, "Title");

            var pathLabel = new Label
            {
                Text = "Path",
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                FontSize          = 25,
                TextColor         = Color.FromRgb(146, 146, 146),
                LineBreakMode     = LineBreakMode.CharacterWrap
            };

            pathLabel.SetBinding(Label.TextProperty, "Path");

            layout.Children.Add(descriptionLabel,
                                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0431);
            }),
                                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.3084);
            }));

            layout.Children.Add(pathLabel,
                                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0431);
            }),
                                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.5198);
            }),
                                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * (1 - 2 * 0.0431));
            }));

            var gestureRecognizer = new LongTapGestureRecognizer();

            gestureRecognizer.TapStarted += (s, e) =>
            {
                //change foreground blend color of image
                ImageAttributes.SetBlendColor(backgroundImage, Color.FromRgb(213, 228, 240));
            };

            gestureRecognizer.TapCanceled += (s, e) =>
            {
                //revert foreground blend color of image
                ImageAttributes.SetBlendColor(backgroundImage, Color.Default);
            };

            gestureRecognizer.TapCompleted += (s, e) =>
            {
                //revert foreground blend color of image
                ImageAttributes.SetBlendColor(backgroundImage, Color.Default);
            };
            layout.GestureRecognizers.Add(gestureRecognizer);

            return(layout);
        }
Esempio n. 49
0
        public ItemList(Good reflocGood, string locFilter, ItemsRequestStructure locParent, ContentPage locContext, string locMode)
        {
            refGood = reflocGood;
            Filter  = locFilter;
            Parent  = locParent;
            Context = locContext;
            Mode    = locMode;

            StackLayout stack = new StackLayout
            {
                BackgroundColor   = (Color)App.Current.Resources["backColor"],
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            //1.Get Element list from server (if this is a good, then fill additional info, like serial, description, Units)


            switch (locMode)
            {
            case "RequestServerForItems":
                Title = "Найденные объекты";
                Device.BeginInvokeOnMainThread(MethodInvoker);
                break;

            case "DisplayItemListForSelection":
                Title = "Выберите 1 из дублей ШК";
                break;

            case "OnlyDisplayItemList":
                Title = "Товары по отбору";
                break;

            default:
                break;
            }


            lv_Items.Add(new TablePart
            {
                Value0 = "Good",
                Value1 = "Unit",
                Value3 = "Description",
                Value5 = "Serial",
                Value7 = "Quality",
            });

            //2.Build page layout
            ListView lv_Main = new ListView
            {
                ItemsSource  = lv_Items,
                ItemTemplate = new DataTemplate(() =>

                {
                    Grid G = new Grid
                    {
                        ColumnSpacing     = 1,
                        BackgroundColor   = (Color)App.Current.Resources["textColor"],
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        ColumnDefinitions =
                        {
                            //new ColumnDefinition { Width = new GridLength(4, GridUnitType.Star) },
                            //new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                            //new ColumnDefinition { Width = new GridLength(3, 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)
                            },
                        },
                        RowDefinitions =
                        {
                            new RowDefinition {
                                Height = new GridLength(42, GridUnitType.Absolute)
                            }
                        },
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    };

                    //======== Field 0

                    Xamarin.Forms.Label l = new Xamarin.Forms.Label
                    {
                        BackgroundColor   = (Color)App.Current.Resources["backColor"],
                        TextColor         = (Color)App.Current.Resources["textColor"],
                        FontSize          = 13,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                    };

                    TapGestureRecognizer tgr = new TapGestureRecognizer
                    {
                        NumberOfTapsRequired = 1,
                        CommandParameter     = lv_Items.Count - 1
                    };
                    tgr.Tapped += Tgr_Tapped;

                    l.GestureRecognizers.Add(tgr);

                    l.SetBinding(Xamarin.Forms.Label.TextProperty, "Value0");
                    //f.Content = l;
                    G.Children.Add(l, 0, 0);


                    ////======== Field 1

                    //Label l1 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,

                    //};
                    //l1.SetBinding(Label.TextProperty, "Value1");

                    //TapGestureRecognizer tgr1 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr1.Tapped += Tgr_Tapped;

                    //l.GestureRecognizers.Add(tgr1);

                    ////f1.Content = l1;
                    //G.Children.Add(l1, 1, 0);

                    ////======== Field 2

                    //Label l2 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,

                    //};
                    //l2.SetBinding(Label.TextProperty, "Value3");
                    //TapGestureRecognizer tgr2 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr2.Tapped += Tgr_Tapped;

                    //l.GestureRecognizers.Add(tgr2);

                    ////f2.Content = l2;
                    //G.Children.Add(l2, 2, 0);

                    ////======== Field 3

                    //Label l3 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,

                    //};
                    //l3.SetBinding(Label.TextProperty, "Value5");
                    //TapGestureRecognizer tgr3 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr3.Tapped += Tgr_Tapped;

                    //l.GestureRecognizers.Add(tgr3);
                    ////f3.Content = l3;
                    //G.Children.Add(l3, 3, 0);

                    ////======== Field 4

                    //Label l4 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,
                    //};

                    //TapGestureRecognizer tgr4 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr4.Tapped += Tgr_Tapped;

                    //l4.GestureRecognizers.Add(tgr4);

                    //l4.SetBinding(Label.TextProperty, "Value7");
                    ////f4.Content = l4;
                    //G.Children.Add(l4, 4, 0);


                    StackLayout s = new StackLayout
                    {
                        Orientation     = StackOrientation.Vertical,
                        BackgroundColor = (Color)App.Current.Resources["textColor"],
                        VerticalOptions = LayoutOptions.FillAndExpand
                    };
                    s.Children.Add(G);

                    return(new ViewCell {
                        View = s
                    });
                })
            };

            stack.Children.Add(lv_Main);
            Content = stack;
        }
Esempio n. 50
0
            public ScheduledAppointmentDataCell()
            {
                int rowindex = 1;

                if (!Application.Current.Properties.ContainsKey("srowindex"))
                {
                    Application.Current.Properties["srowindex"] = rowindex;
                }
                rowindex = Convert.ToInt32(Application.Current.Properties["srowindex"]);
                Color rowcolor = Color.FromHex("#FFFFFF");

                if (rowindex % 2 == 0)
                {
                    rowcolor = Color.FromHex("#ECF0F1");
                }
                else
                {
                    rowcolor = Color.FromHex("#FFFFFF");
                }
                rowindex = rowindex + 1;
                Application.Current.Properties["srowindex"] = rowindex;
                Color textColor = Color.FromHex("#95A5A6");

                // ticket number
                Xamarin.Forms.Label labelServiceTicketNumber = new Xamarin.Forms.Label();
                labelServiceTicketNumber.FontSize   = 20;
                labelServiceTicketNumber.FontFamily = Device.OnPlatform("OpenSans-Bold", null, null);
                labelServiceTicketNumber.TextColor  = textColor;
                labelServiceTicketNumber.SetBinding(Xamarin.Forms.Label.TextProperty, "ServiceTicketNumber");

                // schedule date/time
                Xamarin.Forms.Label labelScheduleDateTime = new Xamarin.Forms.Label();
                labelScheduleDateTime.FontSize   = 20;
                labelScheduleDateTime.FontFamily = Device.OnPlatform("OpenSans-Regular", null, null);
                labelScheduleDateTime.TextColor  = textColor;
                labelScheduleDateTime.SetBinding(Xamarin.Forms.Label.TextProperty, "SchedDateStartTime", stringFormat: "{0:MM/dd/yyyy}");

                // name/location/phone
                Xamarin.Forms.Label labelNameLocPhone = new Xamarin.Forms.Label();
                labelNameLocPhone.FontSize   = 20;
                labelNameLocPhone.TextColor  = textColor;
                labelNameLocPhone.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
                labelNameLocPhone.SetBinding(Xamarin.Forms.Label.TextProperty, "NameLocPhone");

                // need a spot for the currently-clocked-into annotation
                Xamarin.Forms.Image imageClockedInCheckMark = new Image();
                imageClockedInCheckMark.SetBinding(Xamarin.Forms.Image.SourceProperty, "CurrentImageFileName");

                View = new StackLayout()
                {
                    Padding         = 30,
                    Orientation     = StackOrientation.Horizontal,
                    BackgroundColor = rowcolor,
                    Children        =
                    {
                        new StackLayout()
                        {
                            Children =
                            {
                                labelServiceTicketNumber,
                                new StackLayout()
                                {
                                    Orientation = StackOrientation.Vertical,
                                    Children    =
                                    {
                                        labelScheduleDateTime,
                                        labelNameLocPhone
                                    }
                                }
                            }
                        },
                        imageClockedInCheckMark
                    }
                };
            }
Esempio n. 51
0
        public void AddCluster(StackLayout stack, string ClusterName, ItemsRequestStructure locParent)
        {
            Grid grid = CreateGrid(90);
            Frame f = new Frame
            {
                OutlineColor = Color.White,
                Padding = new Thickness(1),
                BackgroundColor = Color.White,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            f.Content = new Xamarin.Forms.Label
            {
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                TextColor = Color.Gray,
                FontSize = 16,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment = TextAlignment.Center,
                Text = ClusterName,
            };

            grid.Children.Add(f, 0, 0);

            Xamarin.Forms.Label l = new Xamarin.Forms.Label
            {
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                TextColor = (Color)App.Current.Resources["textColor"],
                FontSize = 14,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment = TextAlignment.Center,
                BindingContext = GoodItem,

            };
            l.SetBinding(Xamarin.Forms.Label.TextProperty, locParent.VarName);
            TapGestureRecognizer tgr = new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                CommandParameter = locParent
            };
            tgr.Tapped += Tgr_Tapped;
            l.GestureRecognizers.Add(tgr);

            Frame f1 = new Frame
            {
                OutlineColor = Color.White,
                Padding = new Thickness(1),
                BackgroundColor = Color.White,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };
            f1.Content = l;

            grid.Children.Add(f1, 1, 0);

            Image I1 = new Image
            {
                Source = "loop_72_72.PNG"
            };
            TapGestureRecognizer tgr1 = new TapGestureRecognizer { NumberOfTapsRequired = 1, CommandParameter = locParent };
            tgr1.Tapped += Tgr1_Tapped;
            I1.GestureRecognizers.Add(tgr1);

            grid.Children.Add(I1, 2, 0);

            stack.Children.Add(grid);
        }
        View CreateView()
        {
            var layout = new RelativeLayout {
            };

            var backgroundImage = new Image
            {
                Source = new FileImageSource {
                    File = "list_item_bg.png"
                },
                Aspect = Aspect.Fill,
            };

            layout.Children.Add(
                backgroundImage,
                Constraint.RelativeToParent((parent) =>
            {
                return(0);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(0);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width);
            }),
                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height);
            }));

            var descriptionLabel = new Label
            {
                Text = "Description",
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.EndAndExpand,
                FontSize          = 30 * 72 * 2.6 / 316,
                FontAttributes    = FontAttributes.Bold,
            };

            descriptionLabel.SetBinding(Label.TextProperty, "Title");

            var pathLabel = new Label
            {
                Text = "Path",
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                FontSize          = 25 * 72 * 2.6 / 316,
                TextColor         = Color.FromRgb(146, 146, 146),
            };

            pathLabel.SetBinding(Label.TextProperty, "Path");

            layout.Children.Add(descriptionLabel,
                                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0431);
            }),
                                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.3084);
            }));

            layout.Children.Add(pathLabel,
                                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width * 0.0431);
            }),
                                Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height * 0.5198);
            }));

            return(layout);
        }
Esempio n. 53
0
        public MenuPage(RootPage rootPage)
        {
            RootPage = rootPage;
            VM       = new MenuPageViewModel();
            Title    = "Menu";

            var image = new Image
            {
                HorizontalOptions = LayoutOptions.Start
            };

            var name = new Label
            {
                TextColor             = Color.White,
                VerticalOptions       = LayoutOptions.StartAndExpand,
                VerticalTextAlignment = TextAlignment.Center
            };

            var email = new Label
            {
                TextColor             = Color.White,
                VerticalOptions       = LayoutOptions.StartAndExpand,
                VerticalTextAlignment = TextAlignment.Center
            };

            var header = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(10),
                BackgroundColor = Color.FromHex("#2196F3"),
                Children        =
                {
                    image,
                    new StackLayout
                    {
                        Orientation       = StackOrientation.Vertical,
                        HorizontalOptions = LayoutOptions.StartAndExpand,
                        Padding           = new Thickness(20),
                        Children          =
                        {
                            name,
                            email
                        }
                    }
                }
            };

            image.SetBinding(Image.SourceProperty, "Image");
            name.SetBinding(Label.TextProperty, "Name");
            email.SetBinding(Label.TextProperty, "Email");
            header.BindingContext = VM.User;

            ListView menuList = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = VM.MenuItems,
                ItemTemplate  = new DataTemplate(() =>
                {
                    var icon  = new Image();
                    var title = new Label
                    {
                        VerticalOptions       = LayoutOptions.CenterAndExpand,
                        VerticalTextAlignment = TextAlignment.Center
                    };

                    icon.HeightRequest = 48;

                    icon.SetBinding(Image.SourceProperty, "Icon");
                    title.SetBinding(Label.TextProperty, "Title");

                    return(new ViewCell
                    {
                        Height = 60,
                        View = new StackLayout
                        {
                            Orientation = StackOrientation.Horizontal,
                            Spacing = 10,
                            Padding = new Thickness(10),
                            Children =
                            {
                                icon,
                                title
                            }
                        }
                    });
                }),
                Header = header
            };

            menuList.ItemSelected += OnItemSelected;

            Content = new StackLayout {
                Children =
                {
                    menuList
                }
            };
        }
Esempio n. 54
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MasterPageCS"/> class.
        /// </summary>
        public MasterPageCS()
        {
            Title = "MasterPage";
            //create masterPage items
            var masterPageItems = new List <MasterPageItem>();

            //add masterPage item in Box
            masterPageItems.Add(new MasterPageItem {
                Name = "In Box"
            });
            //add masterPage item out Box
            masterPageItems.Add(new MasterPageItem {
                Name = "Out Box"
            });

            //create list view
            this.listView = new ListView
            {
                // Set the list item row height
                RowHeight    = (int)(0.09 * App.screenHeight),
                ItemsSource  = masterPageItems,
                ItemTemplate = new DataTemplate(() =>
                {
                    //Create the label
                    Label label = new Label
                    {
                        TextColor             = Color.Black,
                        FontSize              = 24,
                        VerticalTextAlignment = TextAlignment.Center,
                        HeightRequest         = 200,
                        Margin = 20,
                    };

                    // Set the label text binding
                    label.SetBinding(Label.TextProperty, "Name");
                    var layout = new StackLayout
                    {
                        Orientation       = StackOrientation.Vertical,
                        HorizontalOptions = LayoutOptions.StartAndExpand,
                        VerticalOptions   = LayoutOptions.StartAndExpand,
                        Children          =
                        {
                            label,
                        }
                    };
                    return(new ViewCell
                    {
                        View = layout
                    });
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None
            };

            //set the content of this page
            this.Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    this.listView
                }
            };
        }
Esempio n. 55
0
        public ListViewDemoPage()
        {
            Xamarin.Forms.Label header = new Xamarin.Forms.Label
            {
                Text              = "ListView",
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Xamarin.Forms.Label)),
                HorizontalOptions = LayoutOptions.Center
            };

            // Define some data.
            List <Person> people = new List <Person>
            {
                new Person("Abigail", new DateTime(1975, 1, 15), Color.Aqua),
                new Person("Bob", new DateTime(1976, 2, 20), Color.Black),
                // ...etc.,...
                new Person("Yvonne", new DateTime(1987, 1, 10), Color.Purple),
                new Person("Zachary", new DateTime(1988, 2, 5), Color.Red)
            };

            // Create the ListView.
            ListView listView = new ListView
            {
                // Source of data items.
                ItemsSource = people,

                // Define template for displaying each item.
                // (Argument of DataTemplate constructor is called for
                //      each item; it must return a Cell derivative.)
                ItemTemplate = new DataTemplate(() =>
                {
                    // Create views with bindings for displaying each property.
                    Xamarin.Forms.Label nameLabel = new Xamarin.Forms.Label();
                    nameLabel.SetBinding(Xamarin.Forms.Label.TextProperty, "Name");

                    Xamarin.Forms.Label birthdayLabel = new Xamarin.Forms.Label();
                    birthdayLabel.SetBinding(Xamarin.Forms.Label.TextProperty,
                                             new Binding("Birthday", BindingMode.OneWay,
                                                         null, null, "Born {0:d}"));

                    BoxView boxView = new BoxView();
                    boxView.SetBinding(BoxView.ColorProperty, "FavoriteColor");

                    // Return an assembled ViewCell.
                    return(new ViewCell
                    {
                        View = new StackLayout
                        {
                            Padding = new Thickness(0, 5),
                            Orientation = StackOrientation.Horizontal,
                            Children =
                            {
                                boxView,
                                new StackLayout
                                {
                                    VerticalOptions = LayoutOptions.Center,
                                    Spacing = 0,
                                    Children =
                                    {
                                        nameLabel,
                                        birthdayLabel
                                    }
                                }
                            }
                        }
                    });
                })
            };

            // Accomodate iPhone status bar.
            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            Content = new StackLayout
            {
                Children =
                {
                    header,
                    listView
                }
            };
        }
Esempio n. 56
0
        public TeamsPage()
        {
            Title = "Teams";

            ItemsList.HasUnevenRows = true;
            ItemsList.ItemTemplate  = new DataTemplate(() =>
            {
                Image icon          = new Image();
                Label nameLabel     = new Label();
                Label projectsLabel = new Label();
                Label membersLabel  = new Label();

                icon.Source = "ic_team";

                nameLabel.SetBinding(Label.TextProperty, "Name");
                nameLabel.FontSize       = 18;
                nameLabel.FontAttributes = FontAttributes.Bold;

                projectsLabel.SetBinding(Label.TextProperty, "ProjectsCount");
                projectsLabel.FontSize = 14;

                membersLabel.SetBinding(Label.TextProperty, "MembersCount");
                membersLabel.FontSize = 14;

                var template = new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding     = new Thickness(10, 5),
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            icon,
                            new StackLayout
                            {
                                Padding         = new Thickness(10,                         0),
                                VerticalOptions = LayoutOptions.CenterAndExpand,
                                Children        =
                                {
                                    nameLabel,
                                    new StackLayout
                                    {
                                        Orientation = StackOrientation.Horizontal,
                                        Spacing     = 80,
                                        Children    =
                                        {
                                            membersLabel,
                                            projectsLabel
                                        }
                                    }
                                }
                            }
                        }
                    }
                };

                var editMenuItem = new MenuItem {
                    Text = "Edit", Command = EditCommand
                };
                var deleteMenuItem = new MenuItem {
                    Text = "Delete", Command = DeleteCommand, IsDestructive = true
                };

                deleteMenuItem.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
                editMenuItem.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));


                template.ContextActions.Add(editMenuItem);
                template.ContextActions.Add(deleteMenuItem);


                return(template);
            });
        }
            public ExpenseDataCell()
            {
                // Alternating row colors in list
                int rowindex = 1;

                if (!Application.Current.Properties.ContainsKey("rowindex"))
                {
                    Application.Current.Properties["rowindex"] = rowindex;
                }
                rowindex = Convert.ToInt32(Application.Current.Properties["rowindex"]);
                Color rowcolor = Color.FromHex("#FFFFFF");

                if (rowindex % 2 == 0)
                {
                    rowcolor = Color.FromHex("#ECF0F1");
                }
                else
                {
                    rowcolor = Color.FromHex("#FFFFFF");
                }
                rowindex = rowindex + 1;
                Application.Current.Properties["rowindex"] = rowindex;
                Color forecolor = Color.FromHex("#95A5A6");

                Color asbestos = Color.FromHex("#7f8C8d");

                // charge code
                //Xamarin.Forms.Label labelChargeCodeHdg = new Xamarin.Forms.Label();
                //labelChargeCodeHdg.FontSize = 14;
                //labelChargeCodeHdg.FontFamily = Device.OnPlatform("OpenSans-Bold","sans-serif-black", null);
                //labelChargeCodeHdg.TextColor = forecolor;
                //labelChargeCodeHdg.Text = "Charge Code";

                Xamarin.Forms.Label labelChargeCode = new Xamarin.Forms.Label();
                labelChargeCode.FontSize   = 14;
                labelChargeCode.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
                labelChargeCode.TextColor  = forecolor;
                labelChargeCode.SetBinding(Xamarin.Forms.Label.TextProperty, "ChargeCode");

                // item code
                //Xamarin.Forms.Label labelItemCodeHdg = new Xamarin.Forms.Label();
                //labelItemCodeHdg.FontSize = 14;
                //labelItemCodeHdg.FontFamily = Device.OnPlatform("OpenSans-Bold","sans-serif-black", null);
                //labelItemCodeHdg.TextColor = forecolor;
                //labelItemCodeHdg.Text = "Item Code";

                Xamarin.Forms.Label labelItemCode = new Xamarin.Forms.Label();
                labelItemCode.FontSize   = 14;
                labelItemCode.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
                labelItemCode.TextColor  = forecolor;
                labelItemCode.SetBinding(Xamarin.Forms.Label.TextProperty, "ItemCode");

                // quantity
                Xamarin.Forms.Label labelQuantityHdg = new Xamarin.Forms.Label();
                labelQuantityHdg.FontSize   = 14;
                labelQuantityHdg.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelQuantityHdg.TextColor  = forecolor;
                labelQuantityHdg.Text       = "Qty";

                Xamarin.Forms.Label labelQuantity = new Xamarin.Forms.Label();
                labelQuantity.FontSize   = 14;
                labelQuantity.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelQuantity.TextColor  = forecolor;
                labelQuantity.SetBinding(Xamarin.Forms.Label.TextProperty, "Quantity");

                // unit of measure
                Xamarin.Forms.Label labelUnitOfMeasure = new Xamarin.Forms.Label();
                labelUnitOfMeasure.FontSize   = 14;
                labelUnitOfMeasure.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelUnitOfMeasure.TextColor  = forecolor;
                labelUnitOfMeasure.SetBinding(Xamarin.Forms.Label.TextProperty, "UnitOfMeasure");

                // unit cost
                Xamarin.Forms.Label labelUnitCostHdg = new Xamarin.Forms.Label();
                labelUnitCostHdg.FontSize   = 14;
                labelUnitCostHdg.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelUnitCostHdg.TextColor  = forecolor;
                labelUnitCostHdg.Text       = "Unit Cost";

                Xamarin.Forms.Label labelUnitCost = new Xamarin.Forms.Label();
                labelUnitCost.FontSize   = 14;
                labelUnitCost.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelUnitCost.TextColor  = forecolor;
                labelUnitCost.SetBinding(Xamarin.Forms.Label.TextProperty, "UnitCost");

                // unit price
                Xamarin.Forms.Label labelUnitPriceHdg = new Xamarin.Forms.Label();
                labelUnitPriceHdg.FontSize   = 14;
                labelUnitPriceHdg.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelUnitPriceHdg.TextColor  = forecolor;
                labelUnitPriceHdg.Text       = "Unit Price";

                Xamarin.Forms.Label labelUnitPrice = new Xamarin.Forms.Label();
                labelUnitPrice.FontSize   = 14;
                labelUnitPrice.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelUnitPrice.TextColor  = forecolor;
                labelUnitPrice.SetBinding(Xamarin.Forms.Label.TextProperty, "UnitPrice");

                // extended price
                Xamarin.Forms.Label labelExtdPriceHdg = new Xamarin.Forms.Label();
                labelExtdPriceHdg.FontSize   = 14;
                labelExtdPriceHdg.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelExtdPriceHdg.TextColor  = forecolor;
                labelExtdPriceHdg.Text       = "Extd Price";

                Xamarin.Forms.Label labelExtdPrice = new Xamarin.Forms.Label();
                labelExtdPrice.FontSize   = 14;
                labelExtdPrice.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
                labelExtdPrice.TextColor  = forecolor;
                labelExtdPrice.SetBinding(Xamarin.Forms.Label.TextProperty, "ExtdPrice");


                // description
                Xamarin.Forms.Label labelDescription = new Xamarin.Forms.Label();
                labelDescription.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
                labelDescription.TextColor  = forecolor;
                labelDescription.SetBinding(Xamarin.Forms.Label.TextProperty, "BillingDescription");

                View = new StackLayout()
                {
                    Padding         = 10,
                    BackgroundColor = rowcolor,
                    Children        =
                    {
                        new StackLayout()
                        {
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                labelChargeCode,
                                labelItemCode
                            }
                        },
                        new StackLayout()
                        {
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                labelQuantityHdg,
                                labelQuantity,
                                labelUnitOfMeasure
                            }
                        },
                        new StackLayout()
                        {
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                labelUnitPriceHdg,
                                labelUnitPrice,
                                labelExtdPriceHdg,
                                labelExtdPrice
                            }
                        },
                        new StackLayout()
                        {
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                labelUnitCostHdg,
                                labelUnitCost,
                            }
                        },
                        labelDescription
                    }
                };
            }
            public TechnicialDataCell()
            {
                int rowindex = 1;

                if (!Application.Current.Properties.ContainsKey("rowindex"))
                {
                    Application.Current.Properties["rowindex"] = rowindex;
                }
                rowindex = Convert.ToInt32(Application.Current.Properties["rowindex"]);
                Color rowcolor = Color.FromHex("#FFFFFF");

                if (rowindex % 2 == 0)
                {
                    rowcolor = Color.FromHex("#ECF0F1");
                }
                else
                {
                    rowcolor = Color.FromHex("#FFFFFF");
                }
                rowindex = rowindex + 1;
                Application.Current.Properties["rowindex"] = rowindex;
                Color forecolor = Color.FromHex("#95A5A6");

                // need a spot for the technician number
                Xamarin.Forms.Label labelTechnicianNo = new Xamarin.Forms.Label();
                labelTechnicianNo.FontSize   = 22;
                labelTechnicianNo.TextColor  = forecolor;
                labelTechnicianNo.FontFamily = Device.OnPlatform("OpenSans-Bold", null, null);
                labelTechnicianNo.SetBinding(Xamarin.Forms.Label.TextProperty, "FormattedTechnicianNumber");

                // need a spot for the last name
                Xamarin.Forms.Label labelLastName = new Xamarin.Forms.Label();
                labelLastName.FontSize   = 22;
                labelLastName.TextColor  = forecolor;
                labelLastName.FontFamily = Device.OnPlatform("OpenSans-Regular", null, null);
                labelLastName.SetBinding(Xamarin.Forms.Label.TextProperty, "LastName");

                // need a spot for the first name
                Xamarin.Forms.Label labelFirstName = new Xamarin.Forms.Label();
                labelFirstName.FontSize   = 22;
                labelFirstName.TextColor  = forecolor;
                labelFirstName.FontFamily = Device.OnPlatform("OpenSans-Regular", null, null);
                labelFirstName.SetBinding(Xamarin.Forms.Label.TextProperty, "FirstName");

                View = new StackLayout()
                {
                    Padding         = 30,
                    BackgroundColor = rowcolor,
                    Children        =
                    {
                        labelTechnicianNo,
                        new StackLayout()
                        {
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                labelFirstName,
                                labelLastName
                            }
                        }
                    }
                };
            }