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;
        }
Example #2
0
        public MenuImageCell()
            : base()
        {
            Label Text = new Label {
                TextColor = Color.FromHex ("DCDCDC"),
                XAlign = TextAlignment.Start,
                YAlign = TextAlignment.Center
            };
            Text.SetBinding (Label.TextProperty, "Title");

            Label pad = new Label {
                Text = " "
            };

            Image image = new Image {
                // Backup: Default icon to set
                //Source = "info.png",
                HeightRequest = 30,
            };

            image.SetBinding (Image.SourceProperty, "Icon");

            var layout = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions = LayoutOptions.Center,
                Children = { pad, image, pad, Text }
            };
            layout.SetBinding (Layout.BackgroundColorProperty, new Binding ("BackgroundColor"));

            if (Device.OS == TargetPlatform.WinPhone)
                layout.HeightRequest = 50;

            View = layout;
        }
Example #3
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;
    }
        public JobHeaderView()
        {
            var number = new Label();
            number.TextColor = Color.White;
            number.WidthRequest = 30;
            number.Font = AppStyle.DefaultFont.WithSize(NamedSize.Large).WithAttributes(FontAttributes.Bold);
            number.SetBinding<Job>(Label.TextProperty, job => job.JobNumber);

            var eta = new Label();
            eta.VerticalOptions = LayoutOptions.FillAndExpand;
            eta.HorizontalOptions = LayoutOptions.FillAndExpand;
            eta.YAlign = TextAlignment.Center;
            eta.TextColor = Color.White;
            eta.Font = AppStyle.DefaultFont;
            eta.SetBinding<Job>(Label.TextProperty, job => job.EtaTime);

            var rootLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding = 5,
                Children = { number, eta }
            };
            rootLayout.SetBinding<Job>(StackLayout.BackgroundColorProperty, job => job.Status, converter: new JobStatusToColorConverter());

            this.Content = rootLayout;
        }
        public JobHeaderView()
        {
            var number = new Label();
            number.TextColor = Color.White;
            number.WidthRequest = 60;
            number.FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label));
            number.FontAttributes = FontAttributes.Bold;
            number.SetBinding<Job>(Label.TextProperty, job => job.JobNumber);

            var eta = new Label();
            eta.VerticalOptions = LayoutOptions.FillAndExpand;
            eta.HorizontalOptions = LayoutOptions.FillAndExpand;
            eta.YAlign = TextAlignment.Center;
            eta.TextColor = Color.White;
            //eta.Font = AppStyle.DefaultFont;
            eta.SetBinding<Job>(Label.TextProperty, job => job.StartTime);

            var name = new Label();
            name.VerticalOptions = LayoutOptions.FillAndExpand;
            name.HorizontalOptions = LayoutOptions.FillAndExpand;
            name.YAlign = TextAlignment.Center;
            name.TextColor = Color.White;
            //name.Font = AppStyle.DefaultFont;
            name.SetBinding<Job>(Label.TextProperty, job => job.CustomerName);

            var rootLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding = 5,
                Children = { number, eta, name }
            };
            rootLayout.SetBinding<Job>(StackLayout.BackgroundColorProperty, job => job.Status, converter: new JobStatusToColorConverter());

            this.Content = rootLayout;
        }
Example #6
0
        public MenuViewCell()
        {
            var img = new Image
            {
                VerticalOptions = LayoutOptions.Start
            };
            img.SetBinding(Image.SourceProperty, "Icone");

            var lblMenu = new Label
            {
                Style = Estilos._estiloFonteMenu
            };
            lblMenu.SetBinding(Label.TextProperty, "Titulo");

            var mainLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children = { img, lblMenu },
                Padding = 10
            };

            mainLayout.SetBinding(StackLayout.BackgroundColorProperty, "Color");

            this.View = mainLayout;
        }
        public ActiveChatsPage(ViewModelBase viewModel)
            : base(viewModel)
        {
            var listView = new BindableListView
            {
                ItemTemplate = new DataTemplate(() =>
                    {
                        var imageCell = new ImageCell();
                        imageCell.SetBinding(ImageCell.TextProperty, new Binding("Name"));
                        imageCell.SetBinding(ImageCell.DetailProperty, new Binding("DescriptionText"));
                        imageCell.SetBinding(ImageCell.ImageSourceProperty, new Binding("Image"));
                        imageCell.TextColor = Styling.CellTitleColor;
                        imageCell.DetailColor = Styling.CellDetailColor;
                        return imageCell;
                    }),
                SeparatorVisibility = SeparatorVisibility.None
            };

            listView.SetBinding(ListView.ItemsSourceProperty, new Binding("ActiveChats"));
            listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectActiveChatCommand"));
            listView.SetBinding(ListView.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay));

            var noItemsLabel = new Label {
                Text = "Start a conversation or open a room!",
                HorizontalOptions = LayoutOptions.Center,
                FontSize = 16,
                TextColor = Color.Gray
            };
            var noItemsLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children =
                {
                    new BoxView{HeightRequest = 20},
                    noItemsLabel
                }
            };
            noItemsLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay, converter: new InverterConverter()));

            var loadingIndicator = new ActivityIndicator ();
            loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));
            loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy"));

            Content = new StackLayout
            {
                Children =
                {
                    loadingIndicator,
                    listView,
                    noItemsLayout
                }
            };
        }
		static StackLayout CreateNoSessionStack ()
        {
			var noSessionStack = new StackLayout 
			{
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.StartAndExpand,
				VerticalOptions = LayoutOptions.EndAndExpand,
				Spacing = 10
			};
			noSessionStack.SetBinding (Frame.IsVisibleProperty, "IsBooked", converter: new NegateValueConverter ());
			noSessionStack.Children.Add (CreateAddIcon ());
			noSessionStack.Children.Add (CreateNoSessionLabel ());
			return noSessionStack;
        }
Example #9
0
		public MainPage ()
		{
			Title = "TripLog";

			var itemTemplate = new DataTemplate (typeof(TextCell));
			itemTemplate.SetBinding (TextCell.TextProperty, "Title");
			itemTemplate.SetBinding (TextCell.DetailProperty, "Notes");

			var entries = new ListView {
				ItemTemplate = itemTemplate
			};
			entries.SetBinding (ListView.ItemsSourceProperty, "LogEntries");
			entries.SetBinding (ListView.IsVisibleProperty, "IsBusy", converter: new ReverseBooleanConverter());

			entries.ItemTapped += (sender, e) => 
			{
				var item = (TripLogEntry) e.Item;
				vm.ViewCommand.Execute (item);
			};

			var newButton = new ToolbarItem { Text = "New" };
			newButton.SetBinding (ToolbarItem.CommandProperty, "NewCommand");
			ToolbarItems.Add (newButton);

			var loading = new StackLayout {
				Orientation = StackOrientation.Vertical,
				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.Center,
				Children = {
					new ActivityIndicator {
						IsRunning = true
					},
					new Label {
						Text = "Loading Entries..."
					}
				}
			};

			loading.SetBinding (StackLayout.IsVisibleProperty, "IsBusy");

			var mainLayout = new Grid {
				Children = {
					entries, 
					loading
				}
			};

			Content = mainLayout;
		}
        View CreateRootStack ()
        {
            var stack = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                Padding = 12,
                Children =  {
                    new SessionItem (),
                    CreateSelectionIndicator ()
                }
            };
            stack.SetBinding (StackLayout.BackgroundColorProperty, "Track",
                converter: new TrackBackgroundColorConverter ());

            return stack;
        }
Example #11
0
        public JobCell()
        {
            var jobHeader = new JobHeaderView();

            var title = new Label();
            //title.Font = AppStyle.DefaultFont;
            title.SetBinding<Job>(Label.TextProperty, job => job.Title);

            var customer = new Label();
            //customer.Font = AppStyle.DefaultFont;
            customer.SetBinding<Job>(Label.TextProperty, job => job.CustomerName);

            var jobDetails = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding = 5,
                Children =
                {
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            new Label { Text = "Customer:", FontAttributes = FontAttributes.Bold },
                            customer
                        }
                    },
                    new Label { Text = "Description:", FontAttributes = FontAttributes.Bold },
                    title
                }
            };
            jobDetails.SetBinding<Job>(StackLayout.BackgroundColorProperty, job => job.Status, converter: new JobStatusToColorConverter(useLightTheme: true));

            var rootLayout = new StackLayout()
            {
                Orientation = StackOrientation.Vertical,
                Spacing = 0,
                Children =
                {
                    jobHeader,
                    jobDetails
                }
            };

            this.Height = 130;
            this.View = rootLayout;
        }
        static View CreateTopRow ()
        {

			var profile = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				Spacing = 18,
				HeightRequest = 50,
				Padding = new Thickness (20, 40, 10, 10),
				//BackgroundColor = Color.Green,
				Children = {
					CreateQRBox (),
					CreateNameStack ()
				}
			};
			profile.SetBinding(StackLayout.IsVisibleProperty, "HasProfile");
			var profileTapGesture = new TapGestureRecognizer();
			profileTapGesture.SetBinding (TapGestureRecognizer.CommandProperty, "AddContactCommand");
			profile.GestureRecognizers.Add (profileTapGesture);

			var noProfile = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
				Spacing = 18,
				HeightRequest = 50,
				Padding = new Thickness (20, 40, 10, 10),
				//BackgroundColor = Color.Red,
				Children = {
					CreateNoProfileView ()
				}
			};
			noProfile.SetBinding(StackLayout.IsVisibleProperty, "HasProfile", converter: new NegateValueConverter());
			var noProfileTapGesture = new TapGestureRecognizer();
			noProfileTapGesture.SetBinding<MenuViewModel> (TapGestureRecognizer.CommandProperty, vm => vm.CreateProfileCommand);
			noProfile.GestureRecognizers.Add (noProfileTapGesture);

			var grid = new Grid {
				Children = {
					profile,
					noProfile
				}
			};

			return grid;
        }
        public JobHeaderView(double leftPadding, bool colorBackground = false)
        {
            var eta = new Label();
            eta.VerticalOptions = LayoutOptions.FillAndExpand;
            eta.HorizontalOptions = LayoutOptions.FillAndExpand;
            eta.VerticalTextAlignment = TextAlignment.Start;
            eta.SetBinding<Job>(Label.TextProperty, job => job.StartTime, stringFormat: "Start time: {0}");

            var rootLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                Padding = new Thickness(leftPadding, 5, 0, 5),
                Children = { eta }
            };

            if (colorBackground) {
                eta.TextColor = Color.White;
                rootLayout.SetBinding<Job>(StackLayout.BackgroundColorProperty, job => job.Status, converter: new JobStatusToColorConverter());
            }

            this.Content = rootLayout;
        }
        public JobGroupingHeaderCell()
        {
            var title = new Label
            {
                Font = AppStyle.DefaultFont.WithSize(NamedSize.Medium).WithAttributes(FontAttributes.Bold),
                TextColor = Color.White,
                VerticalOptions = LayoutOptions.Center
            };

            title.SetBinding(Label.TextProperty, new Binding("Key", stringFormat: "Job Status: {0}"));

            var layout = new StackLayout
            {
                Padding = 5,
                Orientation = StackOrientation.Horizontal,
                Children = { title }
            };
            layout.SetBinding(StackLayout.BackgroundColorProperty, "Key", converter: new JobStatusToColorConverter());

            this.Height = 35;
            this.View = layout;
        }
Example #15
0
        public MenuCell()
        {
            //instantiate each of our views
            StackLayout stckMenuWrapper = new StackLayout ();
            StackLayout stckHorizontalMenuWrapper = new StackLayout ();
            StackLayout stckVerticalWrapper = new StackLayout ();
            Image imagem = new Image ();
            BoxView separador = new BoxView ();
            Label title = new Label ();
            Label descrption = new Label ();

            //set bindings
            imagem.SetBinding (Image.SourceProperty, "Image");
            title.SetBinding (Label.TextProperty, "DisplayName");
            descrption.SetBinding (Label.TextProperty, "Description");
            stckHorizontalMenuWrapper.SetBinding (StackLayout.BackgroundColorProperty, "BackgroundColor");

            //set properties
            stckMenuWrapper.Orientation = StackOrientation.Vertical;
            stckHorizontalMenuWrapper.Orientation = StackOrientation.Horizontal;
            stckVerticalWrapper.Orientation = StackOrientation.Vertical;
            stckHorizontalMenuWrapper.Padding = new Thickness (10);
            separador.BackgroundColor = Color.Transparent;
            separador.IsEnabled = false;
            title.TextColor = Color.White;
            descrption.TextColor = Color.White;
            title.FontSize = 21;
            descrption.FontSize = 12;

            //add views to the view hierarchy
            stckVerticalWrapper.Children.Add(title);
            stckVerticalWrapper.Children.Add(descrption);
            stckHorizontalMenuWrapper.Children.Add(imagem);
            stckHorizontalMenuWrapper.Children.Add(stckVerticalWrapper);
            stckMenuWrapper.Children.Add (stckHorizontalMenuWrapper);
            stckMenuWrapper.Children.Add (separador);

            View = stckMenuWrapper;
        }
        public JobGroupingHeaderCell()
        {
            var title = new Label
            {
                FontAttributes = FontAttributes.Bold,
                TextColor = Color.White,
                VerticalOptions = LayoutOptions.Center
            };

            title.SetBinding(Label.TextProperty, new Binding("Key", stringFormat: "Status: {0}"));

            var layout = new StackLayout
            {
                Padding = new Thickness(5, 5, 5, 0),
                Orientation = StackOrientation.Horizontal,
                Children = { title }
            };

            layout.SetBinding(StackLayout.BackgroundColorProperty, "Key", converter: new JobStatusToColorConverter());

            this.View = layout;
        }
		public ChatHistoryListCell()
		{
			StackLayout mainLayout = new StackLayout ();
			//mainLayout.Orientation = StackOrientation.Horizontal;
			mainLayout.WidthRequest = App.screenWidth;

			mainLayout.BackgroundColor = Color.FromRgb(54, 79, 120);// Color.FromRgb(54, 79, 120);
			mainLayout.Padding = new Thickness (10, 10, 10, 10);
			mainLayout.Spacing = 0;


			StackLayout tipContainer = new StackLayout ();
			//tipContainer.BackgroundColor =  Color.tr  Color.FromRgb(54, 79, 120);
			tipContainer.HorizontalOptions = LayoutOptions.Center;
			tipContainer.VerticalOptions = LayoutOptions.Center;
			tipContainer.SetBinding ( StackLayout.HorizontalOptionsProperty, "BubblePos" );
			//tipContainer.SetBinding ( StackLayout.BackgroundColorProperty, "BubbleColor" );



			StackLayout labelContainer = new StackLayout ();
			labelContainer.Orientation = StackOrientation.Horizontal;
			labelContainer.Padding = new Thickness ( 5, 15, 5, 15 );
			labelContainer.SetBinding ( StackLayout.HorizontalOptionsProperty, "BubblePos" );
			labelContainer.SetBinding ( StackLayout.BackgroundColorProperty, "BubbleColor" );


			Label chat = new Label ();
			chat.TextColor = Color.Black;
			chat.XAlign = TextAlignment.End;
			chat.YAlign = TextAlignment.Center;
			chat.VerticalOptions = LayoutOptions.Start;
			chat.FontSize = 15;
			chat.HorizontalOptions = LayoutOptions.End;
			chat.SetBinding ( Label.TextProperty, "Message" );

			Image imgTip = new Image ();
			imgTip.Aspect = Aspect.Fill;
			imgTip.WidthRequest = 25;
			imgTip.HeightRequest = 15;
			imgTip.HorizontalOptions = LayoutOptions.Start;
			imgTip.VerticalOptions = LayoutOptions.End;
			imgTip.SetBinding ( Image.SourceProperty, "ImageTip" );

			tipContainer.Children.Add ( imgTip );
			labelContainer.Children.Add ( chat );



			mainLayout.Children.Add ( labelContainer );
			mainLayout.Children.Add ( tipContainer );



			View = mainLayout;
			//this.View.BackgroundColor =  Color.FromRgb(54, 79, 120);
		}
        public UnseenCell(Action<IBoat> pressAction)
        {
            var sw = new Stopwatch();
            sw.Start();
            var label = new Label
            {
                Font = Font.SystemFontOfSize(NamedSize.Large),
                LineBreakMode = LineBreakMode.TailTruncation,
            };
            label.SetBinding(Label.TextProperty, "PrettyName");

            var button = new Button { Text = "Actions" , BackgroundColor = Color.Silver};
            SetBinding(FooProperty, new Binding("."));

            button.Clicked += (sender, e) => {
                pressAction(Foo);
            };

            BindingContextChanged += (object sender, EventArgs e) => {
                if(Foo.Number < 0)
                    button.IsVisible = false;
                };

            var seen = new Label
            {
                Font = Font.SystemFontOfSize(NamedSize.Medium),
                LineBreakMode = LineBreakMode.TailTruncation,
                TextColor = Color.Purple
            };
            seen.SetBinding(Label.TextProperty, new Binding( "Seen", BindingMode.Default, new BoolToStringConverter("Seen")));

            var sent = new Label
            {
                Font = Font.SystemFontOfSize(NamedSize.Medium),
                LineBreakMode = LineBreakMode.TailTruncation,
                TextColor = Color.Purple
            };
            sent.SetBinding(Label.TextProperty, new Binding( "End", BindingMode.Default, new BoolToStringConverter("Relegated")));

            var layout = new StackLayout {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.Center,
                Children = {
                    label, button, seen, sent
                },
            };
            layout.SetBinding( Layout.BackgroundColorProperty, new Binding( "BackgroundColour" ) );

            sw.Stop();
            ReportStopwatch(sw, "cell");
            View = layout;
        }
        public AlertListItemCell()
        {
            Label messageSubject = new Label {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                FontSize = 18,
                FontAttributes = FontAttributes.Bold
            };
            messageSubject.SetBinding (Label.TextProperty, "Title");
            messageSubject.SetBinding (Label.TextColorProperty, "TitleColor");

            Label messageContent = new Label {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                FontSize = 12
            };
            messageContent.SetBinding (Label.TextProperty, "Content");

            Label messageDate = new Label {
                HorizontalOptions = LayoutOptions.End,
                FontSize = 12,
                VerticalOptions = LayoutOptions.Center,
                MinimumWidthRequest = 80
            };
            messageDate.SetBinding (Label.TextProperty, "DateTimeFormat");
            messageDate.SetBinding (Label.TextColorProperty, "DateTimeColor");

            StackLayout viewLayout = new StackLayout {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Orientation = StackOrientation.Vertical,
                Children = { messageSubject, messageContent }
            };

            StackLayout stackLayout = new StackLayout () {
                //BackgroundColor = Color.FromHex("#34495E"),
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Orientation = StackOrientation.Horizontal,
                Padding = new Thickness(10, 10, 10, 10),
                Children = { viewLayout, messageDate }
            };
            stackLayout.SetBinding (VisualElement.BackgroundColorProperty, "BackgroundColor");

            MenuItem markAsRead = new MenuItem { Text = "Mark as read"};
            markAsRead.SetBinding (MenuItem.CommandParameterProperty, new Binding ("."));
            markAsRead.Clicked += async (sender, e) => {
                MenuItem mi = ((MenuItem)sender);
                AlertListItem item = (AlertListItem)mi.CommandParameter;
                await OnlineDataLoader.markAlertMessageAsRead(new List<int>{item.AlertID});
                item.TitleColor = Color.Gray;
                item.DateTimeColor = Color.Gray;
                // Also need to grey out the alert in other pages
                StackLayout sl = (StackLayout)viewLayout.ParentView;
                ListView lv = (ListView)sl.ParentView;
                AlertListPage listPage = (AlertListPage)lv.ParentView;
                if (String.Equals(listPage.getPageType(), AlertListPage.ALERTS_UNREAD)) {
                    listPage.removeAlertFromList(item);
                }
            };

            MenuItem markAsUnread = new MenuItem { Text = "Mark as unread" };
            markAsUnread.SetBinding (MenuItem.CommandParameterProperty, new Binding ("."));
            markAsUnread.Clicked += async (sender, e) => {
                MenuItem mi = ((MenuItem)sender);
                AlertListItem item = (AlertListItem)mi.CommandParameter;
                await OnlineDataLoader.markAlertMessageAsUnread(new List<int>{item.AlertID});
                item.TitleColor = Colours.ALERTS_MEDIUM;
                item.DateTimeColor = Color.Black;
                StackLayout sl = (StackLayout)viewLayout.ParentView;
                ListView lv = (ListView)sl.ParentView;
                AlertListPage alp = (AlertListPage)lv.ParentView;
                TabbedPage tp = (TabbedPage) alp.ParentView;
                foreach (AlertListPage a in tp.Children) {
                    if (a.getPageType().Equals(AlertListPage.ALERTS_UNREAD)) {
                        a.addAlertToList(item);
                    }
                }

            };

            MenuItem delete = new MenuItem { Text = "Delete", IsDestructive = true };
            delete.SetBinding (MenuItem.CommandParameterProperty, new Binding ("."));
            delete.Clicked += async (sender, e) => {
                MenuItem mi = ((MenuItem)sender);
                AlertListItem item = (AlertListItem)mi.CommandParameter;
                await OnlineDataLoader.markAlertMessageAsDeleted(new List<int>{item.AlertID});
                StackLayout sl = (StackLayout)viewLayout.ParentView;
                ListView lv = (ListView)sl.ParentView;
                AlertListPage listPage = (AlertListPage)lv.ParentView;
                TabbedPage tp = (TabbedPage) listPage.ParentView;
                foreach (AlertListPage a in tp.Children) {
                    a.removeAlertFromList(item);
                }
            };

            ContextActions.Add (markAsRead);
            ContextActions.Add (markAsUnread);
            ContextActions.Add (delete);

            View = stackLayout;
        }
        private void InitLoadingLayout()
        {
            loadingLayout = new StackLayout
            {
                BackgroundColor = new Color(0, 0, 0, 0.8)
            };
            loadingLayout.SetBinding(IsVisibleProperty, "IsLoadActivity");

            var activityIndicator = new ActivityIndicator
            {
                Color = Device.OnPlatform(Color.White, Color.Default, Color.Default),
                VerticalOptions = LayoutOptions.EndAndExpand
            };
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoadActivity");
            if (Device.OS == TargetPlatform.Android)
                activityIndicator.HorizontalOptions = LayoutOptions.CenterAndExpand;

            var activityText = new Label
            {
                TextColor = Device.OnPlatform(Color.White, Color.Default, Color.Default),
                Text = contentUI.TxtLoading,
                VerticalOptions = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            loadingLayout.Children.Add(activityIndicator);
            loadingLayout.Children.Add(activityText);

            baseLayout.Children.Add(loadingLayout, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(parent => { return parent.Width; }), Constraint.RelativeToParent(parent => { return parent.Height; }));        
        }
		View CreateGettingStartedView() {

			var header = new FontLabel {
				Text = "Getting Started",
				Font = Font.OfSize (Fonts.OpenSansBold, 18),
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};

			var details = new FontLabel {
				Text = "Looks like your contact list is empty. " +
					"Get out there and make some connections! " +
					"\n(Tap the + sign to add contacts)",
				Font = Font.OfSize (Fonts.OpenSansLight, 14),
				XAlign = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.CenterAndExpand
			};

			var view = new StackLayout {
				Orientation = StackOrientation.Vertical,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				Padding = new Thickness(30, 5, 30, 5),
//				BackgroundColor = Color.Default,
				IsVisible = false,
				Children = {
					header,
					details
				}
			};
			view.SetBinding (StackLayout.IsVisibleProperty, "IsEmpty");

			return view;
		}
            public DiscountTemplate(ListViewAnimation parentListView, int rowHeight)
            {
                SelectColor = (Color)App.Current.Resources[MainStyles.ListSelectColor];

                Grid gridDiscountItem = new Grid
                {
                    Padding = new Thickness (10),
                    BackgroundColor = (Color)App.Current.Resources[MainStyles.ListBackgroundColor],
                    RowDefinitions = 
                    {
                        new RowDefinition { Height = new GridLength(1, GridUnitType.Star)  },
                        new RowDefinition { Height = new GridLength(2, GridUnitType.Star)  }
                    },
                    ColumnDefinitions = 
                    {
                        new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star)},
                        new ColumnDefinition { Width = new GridLength(4, GridUnitType.Star)}
                    }
                };

                var fileNameConverter = new FileNameToImageConverter();

                // Company logo
                var imgCompanyLogo = new ImageExtended
                {
                    WidthRequest = Device.OnPlatform(64, 64, 64),
                    HeightRequest = Device.OnPlatform(64, 64, 64),
                    Aspect = Aspect.AspectFit,
                    
                };
                imgCompanyLogo.SetBinding(Image.SourceProperty, new Binding("LogoFileName", BindingMode.Default, fileNameConverter));


                var stackCompanyLogo = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children = { imgCompanyLogo }
                };
                gridDiscountItem.Children.Add(stackCompanyLogo, 0, 1, 0, 2);

                // Header
                Grid headerLayout = new Grid
                {
                    Padding = new Thickness(2, 0, 0, 0),
                    RowDefinitions = 
                    {
                        new RowDefinition { Height = GridLength.Auto }
                    },
                    ColumnDefinitions = 
                    {
                        new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star)},
                        new ColumnDefinition { Width = GridLength.Auto }//new GridLength(1, GridUnitType.Star)},
                    }
                };
                
                // Title
                var txtTitle = new Label
                {
                    VerticalOptions = LayoutOptions.End,
                    Style = (Style)App.Current.Resources[LabelStyles.ListTitleStyle]
                };
                txtTitle.SetBinding(Label.TextProperty, "Name");

                headerLayout.Children.Add(txtTitle, 0, 0);
                
                #region Percent label
                var txtPercent = new Label
                {
                    Style = (Style)App.Current.Resources[LabelStyles.ListPercentStyle],
                    VerticalOptions = LayoutOptions.End
                };
                txtPercent.SetBinding(Label.TextProperty, "DiscountPercent");

                var percentLayout = new StackLayout
                {
                    Spacing = 0,
                    Orientation = StackOrientation.Horizontal,
                    Children =
                    {
                        txtPercent,
                        new Label
                        { 
                            Style = (Style)App.Current.Resources[LabelStyles.ListPercentSymbolStyle],
                            VerticalOptions = LayoutOptions.End
                        }
                    }
                };
                #endregion

                #region Category layout
                var txtCategory = new Label
                {
                    Style = (Style)App.Current.Resources[LabelStyles.CategoryStyle],
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                };
                txtCategory.SetBinding(Label.TextProperty, "FirstCategoryName");
                txtCategory.SetBinding(BackgroundColorProperty, "FirstCategoryColor");

                var categoryLayout = new StackLayout
                {
                    Padding = Device.OnPlatform(new Thickness(4), new Thickness(4), new Thickness(6)),
                    VerticalOptions = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.Center,
                    Children =
                    {
                        txtCategory
                    }
                };
                categoryLayout.SetBinding(BackgroundColorProperty, "FirstCategoryColor");

                var txtCategoryMore = new Label
                {
                    Text = "...",
                    Style = (Style)App.Current.Resources[LabelStyles.CategoryStyle],
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                };
                txtCategory.SetBinding(BackgroundColorProperty, "FirstCategoryColor");

                var stackCategoryMore = new StackLayout
                {
                    Padding = Device.OnPlatform(new Thickness(4), new Thickness(4), new Thickness(6)),
                    VerticalOptions = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.Center,
                    Children =
                    {
                        txtCategoryMore
                    }
                };
                stackCategoryMore.SetBinding(BackgroundColorProperty, "FirstCategoryColor");
                stackCategoryMore.SetBinding(IsVisibleProperty, "IsCategoryMore");
                #endregion

                var infoDiscountLayout = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    
                    Children =
                    {
                        percentLayout,
                        categoryLayout,
                        stackCategoryMore
                    }
                };

                headerLayout.Children.Add(infoDiscountLayout, 1, 0);
                gridDiscountItem.Children.Add(headerLayout, 1, 2, 0, 1);
                
                #region Description
                var txtDescription = new LabelExtended 
                { 
                    IsWrapped = true,
                    Style = (Style)App.Current.Resources[LabelStyles.DescriptionStyle],
                };
                txtDescription.GestureRecognizers.Clear();
                txtDescription.SetBinding(LabelExtended.TextProperty, new Binding("Description", BindingMode.Default, new TextHeightLimitation()));

                var layoutDescription = new RelativeLayout();
                layoutDescription.Children.Add(txtDescription,
                    Constraint.Constant(2),
                    Constraint.Constant(0),
                    Constraint.RelativeToParent(parent => { return parent.Width - 2; }),
                    Constraint.RelativeToParent(parent => { return parent.Height; }));

                gridDiscountItem.Children.Add(layoutDescription, 1, 2, 1, 2);
                #endregion

                var boxBorder = new BorderBox
                {
                    Padding = new Thickness(8, 4),
                    HeightRequest = rowHeight - 16,
                };
                boxBorder.BorderColor = (Color)App.Current.Resources[MainStyles.ListBorderColor];
                boxBorder.BorderWidth = 1;
                boxBorder.Content = gridDiscountItem;
                
                var layout = new AbsoluteLayout
                {
                    Padding = new Thickness (8, 4),
                };
                parentListView.AnimationListAdd(layout);
                
                AbsoluteLayout.SetLayoutFlags(boxBorder, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(boxBorder, new Rectangle(0f, 0f, 1f, 1f));
                layout.Children.Add(boxBorder);

                View = layout;
            }
        /// <summary>
        /// Method that creates the error stack
        /// The stacks visibility is binded to the viewmodel
        /// </summary>
        private StackLayout ErrorStack()
        {
            var text = new Label
            {
                TextColor = Color.FromHex(Definitions.DefaultTextColor),
                FontSize = Definitions.LoginLabelText,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                YAlign = TextAlignment.Center,
                XAlign = TextAlignment.Center
            };
            text.SetBinding(Label.TextProperty, UploadingViewModel.ErrorTextProperty);

            var TryAgainButton = new ButtomButton("Prøv Igen", SendUploadMessage);
            var SaveButton = new ButtomButton("Gem", SendStoreMessage);
            TryAgainButton.Height = Definitions.GpsButtonHeight;
            SaveButton.Height = Definitions.GpsButtonHeight;

            var layout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                BackgroundColor = Color.FromHex(Definitions.BackgroundColor),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding = new Thickness(50, 70, 50, 70),
                Spacing = 30,
                Children =
                {
                    text,
                    TryAgainButton,
                    SaveButton
                }
            };
            layout.SetBinding(StackLayout.IsVisibleProperty, UploadingViewModel.ErrorVisibilityProperty);

            return layout;
        }
        /// <summary>
        /// Method that creates the page content
        /// </summary>
        /// <returns>View of the content to be displayed</returns>
        public View SetContent()
        {
            var header = new Label
            {
                Text = "Ny Kørsel",
                TextColor = Color.FromHex(Definitions.TextColor),
                FontSize = Definitions.HeaderFontSize,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                YAlign = TextAlignment.Center,
            };
            var vertButton = new VertsButton(SendViewStoredMessage, Definitions.storedReportsCount.ToString());
            var exitButton = new LogoutButton(ShowLogoutPopup);

            vertButton.WidthRequest = 100;
            vertButton.HeightRequest = 60;
            exitButton.WidthRequest = 100;
            exitButton.HeightRequest = 60;

            _header = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                HeightRequest = Definitions.HeaderHeight,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding = 5,
                Children =
                {
                    exitButton,
                    header,
                    vertButton,
                }
            };
            _header.SetBinding(StackLayout.BackgroundColorProperty, MainViewModel.PrimaryHexProperty);

            Definitions.DateToView = DateTime.Now.ToString("d/M/yyyy");
            Definitions.DateToApi = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            var date = new Label
            {
                Text = Definitions.DateToView,
                TextColor = Color.FromHex(Definitions.DefaultTextColor),
                BackgroundColor = Color.FromHex(Definitions.BackgroundColor),
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize = Definitions.LoginLabelText,
                HeightRequest = 40,
            };

            List = new ListView
            {
                ItemTemplate = new DataTemplate(typeof(DriveReportCell)),
                SeparatorColor = Color.FromHex("#EE2D2D"),
                SeparatorVisibility = SeparatorVisibility.Default,
                VerticalOptions = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            List.SetBinding(ListView.ItemsSourceProperty, MainViewModel.DriveProperty);
            
            List.ItemSelected += async (sender, e) =>
            {
                if (e.SelectedItem == null) return;
                var selectedItem = (DriveReportCellModel)e.SelectedItem;
                SendSelectedMessage();
            };

            var startButton = new ButtomButton("Start Kørsel", StartDrive);
            
            var buttomStack = new StackLayout
            {
                VerticalOptions = LayoutOptions.End,
                Padding = Definitions.Padding,
                HeightRequest = Definitions.ButtonHeight,

                Children = {startButton}
            };
            
            var layout = new StackLayout
            {
                Spacing = 2,
                Children =
                {
                    _header,
                    date,
                    List,
                    CheckStack(),
                    buttomStack
                },
                BackgroundColor = Color.FromHex(Definitions.BackgroundColor),
            };
            
            _popUpLayout = new PopupLayout();
            _popUpLayout.Content = layout;
            return _popUpLayout;
        }
Example #25
0
        public ChatPage(ViewModelBase viewModel)
            : base(viewModel)
        {
            SetBinding (ContentPage.TitleProperty, new Binding("RoomName"));
            Icon = Styling.ChatIcon;

            var toolbarItem = new ToolbarItem {
                Text = "Actions",
                Icon = Styling.ToolbarIcon,
                Order = ToolbarItemOrder.Primary
            };
            toolbarItem.SetBinding(ToolbarItem.CommandProperty, new Binding("ContextOptionsCommand"));
            ToolbarItems.Add(toolbarItem);

            var headerLabel = new SquawkLabel();
            headerLabel.FontSize = Styling.Sized(24);
            headerLabel.TextColor = Device.OnPlatform(Color.Green, Color.Yellow, Color.Yellow);
            headerLabel.SetBinding(Label.TextProperty, new Binding("Subject", stringFormat:"  {0}"));

            var sendButton = new Button();
            sendButton.Text = " Send ";
            sendButton.VerticalOptions = LayoutOptions.EndAndExpand;
            sendButton.SetBinding(Button.CommandProperty, new Binding("SendMessageCommand"));
            sendButton.SetBinding(Button.IsEnabledProperty, new Binding("IsInConnectedMode", BindingMode.OneWay));
            if (Device.OS == TargetPlatform.WinPhone)
            {
                sendButton.BackgroundColor = Color.Green;
                sendButton.BorderColor = Color.Green;
                sendButton.TextColor = Color.White;
            }

            var inputBox = new SquawkEntry();
            inputBox.HorizontalOptions = LayoutOptions.FillAndExpand;
            inputBox.Keyboard = Keyboard.Chat;
            inputBox.Placeholder = "Type a message...";
            inputBox.HeightRequest = 30;
            inputBox.SetBinding(Entry.TextProperty, new Binding("InputText", BindingMode.TwoWay));
            inputBox.SetBinding(Entry.IsEnabledProperty, new Binding("IsInConnectedMode", BindingMode.OneWay));

            _messageList = new ChatListView();
            _messageList.VerticalOptions = LayoutOptions.FillAndExpand;
            _messageList.SetBinding(ChatListView.ItemsSourceProperty, new Binding("MessageEvents"));
            _messageList.ItemTemplate = new DataTemplate(CreateMessageCell);
            _messageList.ItemTapped += ItemTapped;
            _messageList.HasUnevenRows = true;
            _messageList.SeparatorVisibility = SeparatorVisibility.None;
            _messageList.SetBinding(Entry.IsEnabledProperty, new Binding("IsInRequestMode", BindingMode.OneWay, converter: new InverterConverter()));

            var typingLabel = new SquawkLabel();
            typingLabel.FontSize = Styling.Sized(11);
            typingLabel.TextColor = Color.Gray;
            typingLabel.SetBinding(Label.TextProperty, new Binding("TypingEventsString", stringFormat:"  {0}"));
            //typingLabel.SetBinding(Label.IsVisibleProperty, new Binding("AreTypingEvents"));

            #region Error Message UI
            var chatStatusLabel = new SquawkLabel {
                HorizontalOptions = LayoutOptions.Center,
                FontSize = 16,
                TextColor = Color.Gray
            };

            chatStatusLabel.SetBinding(Label.TextProperty, new Binding("StatusText", BindingMode.OneWay));
            var chatStatusLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children =
                {
                    chatStatusLabel
                }
            };
            chatStatusLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding("IsInMessageMode", BindingMode.OneWay));
            #endregion

            #region Request UI
            var requestLabel = new SquawkLabel {
                HorizontalOptions = LayoutOptions.Center,
                FontSize = Styling.Sized(16),
                Text = "This user wants to chat!  What would you like to do?"
            };

            var acceptButton = new Button(){
                FontSize = Styling.Sized(14)
            };
            acceptButton.Text = "Accept";
            acceptButton.SetBinding(Button.CommandProperty, new Binding("AcceptChatCommand"));
            if (Device.OS == TargetPlatform.WinPhone)
            {
                acceptButton.BackgroundColor = Color.Green;
                acceptButton.BorderColor = Color.Green;
                acceptButton.TextColor = Color.White;
            }

            var declineButton = new Button(){
                FontSize = Styling.Sized(14)
            };
            declineButton.Text = "Decline";
            declineButton.SetBinding(Button.CommandProperty, new Binding("DeclineChatCommand"));
            if (Device.OS == TargetPlatform.WinPhone)
            {
                declineButton.BackgroundColor = Color.Green;
                declineButton.BorderColor = Color.Green;
                declineButton.TextColor = Color.White;
            }

            var ignoreButton = new Button();
            {
                ignoreButton.FontSize = Styling.Sized(14);
                ignoreButton.Text = "Ignore";
                ignoreButton.SetBinding(Button.CommandProperty, new Binding("LeaveRoomCommand"));
                if (Device.OS == TargetPlatform.WinPhone)
                {
                    ignoreButton.BackgroundColor = Color.Green;
                    ignoreButton.BorderColor = Color.Green;
                    ignoreButton.TextColor = Color.White;
                }
            }

            var requestLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Spacing = 15,
                Children =
                {
                    requestLabel,
                    acceptButton,
                    declineButton,
                    ignoreButton
                }
            };
            requestLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding("IsInRequestMode", BindingMode.OneWay));
            #endregion

            Content  = new StackLayout
            {
                Padding = Device.OnPlatform(new Thickness(6,6,6,6), new Thickness(0), new Thickness(0)),
                Children =
                {
                    _messageList,
                    chatStatusLayout,
                    requestLayout,
                    typingLabel,
                    new StackLayout
                    {

                        Children = {inputBox, sendButton},
                        Orientation = StackOrientation.Horizontal,
                        Padding = new Thickness(0, Device.OnPlatform(0, 20, 0),0,0),
                        //VerticalOptions = LayoutOptions.End
                    }
                }
            };
        }
Example #26
0
        public CommentViewCell()
        {
            dropletPressedCount = 0;
            dropletTGR = new TapGestureRecognizer();
            dropletTGR.Tapped += DropletTGR_Tapped;
            ch = new ColorHandler();
            reportUserTgr = new TapGestureRecognizer();
            reportUserTgr.Tapped += ReportUserTgr_Tapped;
            Image userEmoji = new Image
            {
                Aspect = Aspect.AspectFit,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions = LayoutOptions.Center,
                Scale = 1,
                HeightRequest = 30

            };
            userEmoji.SetBinding(Image.SourceProperty, "UserEmoji");
            Label lUserId = new Label
            {
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.Center

            };
            lUserId.SetBinding(Label.TextProperty, "AuthorUsername");
            lUserId.SetBinding(Label.TextColorProperty, "AuthorAccountColor", converter: new ColorConverter());
            Label lDropletNumber = new Label
            {
                TextColor = ch.fromStringToColor("black"),
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center

            };
            lDropletNumber.SetBinding(Label.TextProperty, "NumDroplets");

            Image dropletImage = new Image
            {
                Source = FileImageSource.FromFile("DropletFull_WhiteB.png"),
                Aspect = Aspect.AspectFit,
                HeightRequest = 25,

                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center

            };
            dropletImage.GestureRecognizers.Add(dropletTGR);

            Label lCommentText = new Label
            {
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                TextColor = ch.fromStringToColor("black"),


            };
            lCommentText.SetBinding(Label.TextProperty, "Text");

            Label lReportUser = new Label
            {
                Text = "Report User",
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                TextColor = ch.fromStringToColor("gray"),
                HorizontalOptions = LayoutOptions.Center
            };
            lReportUser.SetBinding(Label.IsVisibleProperty, "ShowReport");
            lReportUser.GestureRecognizers.Add(reportUserTgr);

            //lCommentText.SetBinding(Label.TextColorProperty, "TextColor", converter: new ColorConverter());
            StackLayout headerLayout = new StackLayout
            {
                Children =
                {
                    userEmoji,
                    lUserId,
                    lDropletNumber,
                    dropletImage
                },
                Orientation = StackOrientation.Horizontal,
                Spacing = 11,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Fill
            };

            var commentSLayout = new StackLayout
            {
                Children =
               {
                   headerLayout,
                   new StackLayout
                   {
                       Children =
                       {
                           lCommentText,
                           lReportUser
                       },
                       Spacing = 6,
                       Padding = new Thickness(5,0,0,0)

                   }
                },
                BackgroundColor = ch.fromStringToColor("white"),
                Spacing = 11,
                Padding = new Thickness(12, 10, 10, 10),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand

            };
            commentSLayout.SetBinding(StackLayout.IsVisibleProperty, "ClubRequestBool", converter: new InvertBoolConverter());

            Label clubRequestHeader = new Label
            {
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.Center,
                TextColor = ch.fromStringToColor("yellow")

            };
            clubRequestHeader.SetBinding(Label.TextProperty, "ClubRequestUsername");
            Label clubRequestText = new Label
            {
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                TextColor = ch.fromStringToColor("black"),
            };
            clubRequestText.SetBinding(Label.TextProperty, "ClubRequestText");

            var bReject = new Button
            {
                BackgroundColor = ch.fromStringToColor("red"),
                Text = "Reject",
                TextColor = ch.fromStringToColor("white"),
                FontAttributes = FontAttributes.Bold,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                FontSize = 16,


            };
            bReject.SetBinding(Button.IsEnabledProperty, "IsMember");
            bReject.Clicked += BReject_Clicked;

            var bAccept = new Button
            {
                BackgroundColor = ch.fromStringToColor("green"),
                Text = "Accept",
                TextColor = ch.fromStringToColor("white"),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                FontAttributes = FontAttributes.Bold,
                FontSize = 16
            };
            bAccept.SetBinding(Button.IsEnabledProperty, "IsMember");
            bAccept.Clicked += BAccept_Clicked;
            lVoted = new Label
            {
                Text = "Thanks for voting!",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions = LayoutOptions.Center,
                TextColor = ch.fromStringToColor("black"),
                IsVisible = false
            };
            decidingButtons = new StackLayout
            {
                Children =
                {
                    bReject,
                    bAccept
                },
                Orientation = StackOrientation.Horizontal,
                Spacing = 5,
            };



            var clubRequestSLayout = new StackLayout
            {
                Children =
                {
                    clubRequestHeader,
                    clubRequestText,
                    decidingButtons,
                    lVoted
                },

                BackgroundColor = ch.fromStringToColor("white"),
                Spacing = 11,
                Padding = new Thickness(12, 10, 10, 10),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            clubRequestSLayout.SetBinding(StackLayout.IsVisibleProperty, "ClubRequestBool");

            View = new StackLayout
            {
                Children =
                {
                    commentSLayout,
                    clubRequestSLayout
                }
            };

        }
Example #27
0
		public TabbedPageDemoPageCS ()
		{
			var booleanConverter = new NonNullToBooleanConverter ();

			ItemTemplate = new DataTemplate (() => {
				var nameLabel = new Label {
					FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
					FontAttributes = FontAttributes.Bold,
					HorizontalOptions = LayoutOptions.Center
				};
				nameLabel.SetBinding (Label.TextProperty, "Name");

				var image = new Image { WidthRequest = 200, HeightRequest = 200 };
				image.SetBinding (Image.SourceProperty, "PhotoUrl");

				var familyLabel = new Label {
					FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
					FontAttributes = FontAttributes.Bold
				};
				familyLabel.SetBinding (Label.TextProperty, "Family");

				var subFamilyLabel = new Label {
					FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
					FontAttributes = FontAttributes.Bold
				};
				subFamilyLabel.SetBinding (Label.TextProperty, "Subfamily");

				var tribeLabel = new Label {
					FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
					FontAttributes = FontAttributes.Bold
				};
				tribeLabel.SetBinding (Label.TextProperty, "Tribe");

				var genusLabel = new Label {
					FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
					FontAttributes = FontAttributes.Bold
				};
				genusLabel.SetBinding (Label.TextProperty, "Genus");

				var subFamilyStackLayout = new StackLayout {
					Orientation = StackOrientation.Horizontal,
					Children = {
						new Label { Text = "Subfamily:", HorizontalOptions = LayoutOptions.FillAndExpand }, 
						subFamilyLabel
					}
				};				
				subFamilyStackLayout.SetBinding (VisualElement.IsVisibleProperty, new Binding ("Subfamily", BindingMode.Default, booleanConverter));

				var tribeStackLayout = new StackLayout { 
					Orientation = StackOrientation.Horizontal,
					Children = {
						new Label { Text = "Tribe:", HorizontalOptions = LayoutOptions.FillAndExpand },
						tribeLabel
					}	
				};
				tribeStackLayout.SetBinding (VisualElement.IsVisibleProperty, new Binding ("Tribe", BindingMode.Default, booleanConverter));

				var contentPage = new ContentPage {
					Icon = "monkeyicon.png",
					Content = new StackLayout {
						Padding = new Thickness (5, 25),
						Children = {
							nameLabel,
							image,
							new StackLayout {
								Padding = new Thickness (50, 10),
								Children = {
									new StackLayout { 
										Orientation = StackOrientation.Horizontal,
										Children = {
											new Label { Text = "Family:", HorizontalOptions = LayoutOptions.FillAndExpand },
											familyLabel
										}
									},
									subFamilyStackLayout,
									tribeStackLayout,
									new StackLayout {
										Orientation = StackOrientation.Horizontal,
										Children = {
											new Label { Text = "Genus:", HorizontalOptions = LayoutOptions.FillAndExpand },
											genusLabel
										}
									} 
								}
							} 

						}
					}
				};
				contentPage.SetBinding (TitleProperty, "Name");

				return contentPage;
			});

			ItemsSource = MonkeyDataModel.All;
		}
		View CreateSmallImage() {

			var image = new RoundedImageView {
				Source = "camera_small.png",
				WidthRequest = 40,
				HeightRequest = 40,
			};

			var view = new StackLayout 
			{
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.EndAndExpand,
				VerticalOptions = LayoutOptions.EndAndExpand,
				TranslationX = 15,
				Children = 
				{
					image
				}
			};
			view.GestureRecognizers.Add (CreateTapGestureRecognizer ());
			view.SetBinding (StackLayout.IsVisibleProperty, "IsCaptured");

			return view;
		}
        public NotificationViewCell()
        {
            var EmpImage = new CircleImage()
             {
                 HorizontalOptions = LayoutOptions.Start,
                 BorderThickness = 5,
                 Source = "NainaSharma.png",
                 BorderColor = Color.White,
                 Aspect = Aspect.Fill,
             };
           // EmpImage.SetBinding(Image.SourceProperty, new Binding("ImageUri"));
            var nameLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Start,
                FontSize=15,
                TextColor=Xamarin.Forms.Color.White
            };

            nameLabel.SetBinding(Label.TextProperty, "FullName");
            var daysLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Start,
                TextColor = Xamarin.Forms.Color.White
            };

            daysLabel.SetBinding(Label.TextProperty, "ApprovedDays");
            var subjectLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Start,
                TextColor = Xamarin.Forms.Color.White
            };

            subjectLabel.SetBinding(Label.TextProperty, "Notes");
            EmpImage.WidthRequest = EmpImage.HeightRequest = 70;

            var toDate = new Label
            {
                HorizontalOptions = LayoutOptions.Start,
                TextColor = Xamarin.Forms.Color.White
            };
            toDate.SetBinding(Label.TextProperty, "LeaveDate");

            var fromDate = new Label
            {
                HorizontalOptions = LayoutOptions.Start,
                TextColor = Xamarin.Forms.Color.White
            };
            fromDate.SetBinding(Label.TextProperty, new Binding("FromDate") { StringFormat = "{0:dd-MMM-yyyy}" });

            Button btnApproved = new Button { 
                Text="Approved",
                BackgroundColor=Color.Green,
                FontSize = 10,
            };

            Button btnRejected = new Button
            {
                Text = "Reject",
                BackgroundColor = Color.Red,
                FontSize=10,
            };
            View flagView = new StackLayout {  };

            //TODO: Have to add pending color
            flagView.SetBinding(View.BackgroundColorProperty, new Binding("IsApproved", BindingMode.Default, LeaveFlagColorConverter.OneWay<bool, Color>((status) => status ? InsideInning.Helper.Color.LightGreen.ToFormsColor() : InsideInning.Helper.Color.LightRed.ToFormsColor())));

            #region Adding Context Actions To List view Cell

            var actionApproved = new MenuItem { Text = "Approved" };
            actionApproved.Clicked += async (sender, e) =>
            {
                
                flagView.BackgroundColor = Color.Green;
            };
            var actionReject = new MenuItem { Text = "Reject",IsDestructive=true };
            actionReject.Clicked += async (sender, e) =>
            {
               
                flagView.BackgroundColor = Color.Red;
            };
            ContextActions.Add(actionApproved);
            ContextActions.Add(actionReject);

            #endregion
            
            RelativeLayout MainView = new RelativeLayout
            {
                HorizontalOptions = LayoutOptions.Start,
                Padding = new Thickness(20, 10, 5, 5),
            };

            MainView.Children.Add(EmpImage, Constraint.Constant(5), Constraint.Constant(10),
                 Constraint.Constant(60),
                 Constraint.Constant(60));
            MainView.Children.Add(subjectLabel, Constraint.Constant(80), Constraint.Constant(50), Constraint.RelativeToParent(parent => { return parent.Width; }), Constraint.Constant(40));
            MainView.Children.Add(nameLabel, Constraint.Constant(80), Constraint.Constant(5), Constraint.RelativeToParent(parent => { return parent.Width; }), Constraint.Constant(20));

            MainView.Children.Add(toDate, Constraint.Constant(80), Constraint.Constant(27), Constraint.RelativeToParent(parent => { return parent.Width- daysLabel.Width; }), Constraint.Constant(40));
            //MainView.Children.Add(fromDate, Constraint.Constant(180), Constraint.Constant(27), Constraint.Constant(100), Constraint.Constant(40));
            MainView.Children.Add(daysLabel, Constraint.Constant(290), Constraint.Constant(27), Constraint.Constant(50), Constraint.Constant(20));
            //MainView.Children.Add(btnApproved, Constraint.Constant(290), Constraint.Constant(5), Constraint.Constant(60), Constraint.Constant(30));
            //MainView.Children.Add(btnRejected, Constraint.Constant(290), Constraint.Constant(40), Constraint.Constant(60), Constraint.Constant(30));
            MainView.Children.Add(flagView, Constraint.RelativeToParent(parent => { return parent.Width-7; }), Constraint.Constant(2), Constraint.Constant(7), Constraint.Constant(76));

            View = MainView;
        }
		View CreateTimeOutView ()
		{
			var header = new FontLabel {
				Text = "Unfortunate",
				Font = Font.OfSize (Fonts.OpenSans, 16),
				XAlign = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};

			var timeout = new FontLabel {
				Text = "We're sorry. We were unable to retrieve any Tweets at this time.",
				Font = Font.OfSize(Fonts.OpenSansLight, 14),
				XAlign = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};

			var content = new StackLayout {

				HorizontalOptions = LayoutOptions.CenterAndExpand,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				TranslationY = -20,
				Children = {
					header,
					timeout
				}
			};

			var timeOutView = new StackLayout {
				HorizontalOptions = LayoutOptions.CenterAndExpand,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				Padding = new Thickness(40, 0, 40, 0),
				BackgroundColor = Color.Default,
				Children = {
					content
				}
			};

			timeOutView.SetBinding(Label.IsVisibleProperty, "TimedOut");

			return timeOutView;
		}