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;

        }
Exemplo n.º 2
0
        public FeedOverview()
        {
            var refreshButton = new Button {
            HorizontalOptions = LayoutOptions.FillAndExpand,
            VerticalOptions = LayoutOptions.Center,
            Text = "Refresh"
              };
              refreshButton.SetBinding(Button.CommandProperty, "RefreshCommand");

              var template = new DataTemplate(typeof(TextCell));
              // We can set data bindings to our supplied objects.
              template.SetBinding(TextCell.TextProperty, "Title");
              template.SetBinding(TextCell.DetailProperty, "Description");

              var listView = new ListView {ItemTemplate = template};
              listView.SetBinding(ListView.ItemsSourceProperty, "FeedItems");

              // Push the list view down below the status bar on iOS.
              Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);
              Content = new Grid {
            BindingContext = new FeedReaderViewModel(),

            RowDefinitions = new RowDefinitionCollection {
             new RowDefinition { Height = new GridLength (1, GridUnitType.Star) },
             new RowDefinition { Height = new GridLength (0, GridUnitType.Auto) },

               },
            Children = {
               new ViewWithGridPosition(listView, 0,0),
               new ViewWithGridPosition(refreshButton, 1,0)
             },
              };
        }
        public VerticalOptionsDemo()
        {
            Color[] colors = {Color.Yellow, Color.Blue,};
            var flipFlopper = 0;

            // Create Labels sorted by LayoutAlignment property.
            var labels = from field in typeof (LayoutOptions).GetRuntimeFields()
                where field.IsPublic && field.IsStatic
                orderby ((LayoutOptions) field.GetValue(null)).Alignment
                select new Label
                {
                    Text = "VerticalOptions = " + field.Name,
                    VerticalOptions = (LayoutOptions) field.GetValue(null),
                    XAlign = TextAlignment.Center,
                    FontSize = Device.GetNamedSize(NamedSize.Medium, typeof (Label)),
                    TextColor = colors[flipFlopper],
                    BackgroundColor = colors[flipFlopper = 1 - flipFlopper]
                };

            // Transfer to StackLayout.

            var stackLayout = new StackLayout();

            foreach (var label in labels)
            {
                stackLayout.Children.Add(label);
            }

            Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
            Content = stackLayout;
        }
        private async void UpdateElementSize()
        {
            await Task.Delay(50);

            var windowBound   = Window.Current.Bounds;
            var visibleBounds = ApplicationView.GetForCurrentView().VisibleBounds;

            var top    = visibleBounds.Top - windowBound.Top;
            var bottom = windowBound.Bottom - visibleBounds.Bottom;
            var left   = visibleBounds.Left - windowBound.Left;
            var right  = windowBound.Right - visibleBounds.Right;

            top    = Math.Max(0, top);
            bottom = Math.Max(0, bottom);
            left   = Math.Max(0, left);
            right  = Math.Max(0, right);

            if (_keyboardBounds != Rect.Empty)
            {
                bottom += _keyboardBounds.Height;
            }

            var systemPadding = new Xamarin.Forms.Thickness(left, top, right, bottom);

            CurrentElement.BatchBegin();

            CurrentElement.SetSystemPadding(systemPadding);
            CurrentElement.Layout(new Rectangle(windowBound.X, windowBound.Y, windowBound.Width, windowBound.Height));

            CurrentElement.BatchCommit();
        }
Exemplo n.º 5
0
        public TodoDetail(TodoItem todoItem)
        {
            BindingContext = todoItem;
            var titleLabel = new Label () {
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                Text = todoItem.Title
            };

            var descriptionLabel = new Label{
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                Text = todoItem.Description
            };
            Content = new StackLayout {
                Children = {
                    titleLabel,
                    descriptionLabel
                },
            };
            Padding = new Thickness (10, Device.OnPlatform (20, 0, 0));

            ToolbarItems.Add (new ToolbarItem {
                Text = todoItem.IsCompleted ? "Gjenåpne" : "Fullfør",
                Order = ToolbarItemOrder.Primary,
                Command = new Command(Complete)
            });

            Title = todoItem.Title;
        }
        private void UpdateElementSize()
        {
            var windowBound   = Application.Current.MainWindow.RestoreBounds;
            var visibleBounds = Application.Current.MainWindow.RestoreBounds;

            var top    = visibleBounds.Top - windowBound.Top;
            var bottom = windowBound.Bottom - visibleBounds.Bottom;
            var left   = visibleBounds.Left - windowBound.Left;
            var right  = windowBound.Right - visibleBounds.Right;

            top    = Math.Max(0, top);
            bottom = Math.Max(0, bottom);
            left   = Math.Max(0, left);
            right  = Math.Max(0, right);

            var systemPadding = new Xamarin.Forms.Thickness(left, top, right, bottom);

            CurrentElement.BatchBegin();

            CurrentElement.Padding = systemPadding;
            var rectangle = new Rectangle(windowBound.X, windowBound.Y, windowBound.Width, windowBound.Height);

            CurrentElement.Layout(rectangle);

            CurrentElement.BatchCommit();
            if (Container != null)
            {
                Container.VerticalOffset   = rectangle.Y;
                Container.HorizontalOffset = rectangle.X;
            }
        }
Exemplo n.º 7
0
        public StatePage()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            if (Device.OS == TargetPlatform.iOS)
                Padding = new Thickness(0, 20, 0, 0);

            var state = new Label
            {
                Text = "You are currently",
                FontSize = 18,
                TextColor = Color.Red
            };
            connected = new Label
            {
                Text = App.Self.IsConnected ? "Connected" : "Not Connected",
                FontSize = 18,
                TextColor = Color.Blue
            };

            Content = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Children = {
                    state, connected
                }
            };
        }
        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 SystemOffsetPage()
 {
     var bc = new VM();
     BindingContext = bc;
     InitializeComponent();
     Device.StartTimer(TimeSpan.FromMilliseconds(2000), () =>
     {
         bc.Padding = new Thickness(10,10,10,10);
         return false;
     });
     Device.StartTimer(TimeSpan.FromMilliseconds(4000), () =>
     {
         bc.IsSystemPadding = false;
         return false;
     });
     Device.StartTimer(TimeSpan.FromMilliseconds(6000), () =>
     {
         Padding = new Thickness();
         return false;
     });
     Device.StartTimer(TimeSpan.FromMilliseconds(8000), () =>
     {
         HasSystemPadding = true;
         return false;
     });
 }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
        public CoursePageDB()
        {
            Padding = new Thickness(10, Device.OnPlatform(20,0,0),10,0);
            BackgroundColor = Color.Gray;

            //this.Title = course.TitleShort;
            this.SetBinding(ContentPage.TitleProperty, "TitleShort");

            var titleLabel = new Label() {/*Text = course.Title,*/ Font = Font.SystemFontOfSize(NamedSize.Large)};
            titleLabel.SetBinding(Label.TextProperty,"Title");

            var authorLabel = new Label() {/*Text = course.Author,*/ Font = Font.SystemFontOfSize(NamedSize.Small)};
            authorLabel.SetBinding(Label.TextProperty,"Author");

            var descriptionLabel = new Label() {/*Text = course.Description,*/ Font = Font.SystemFontOfSize(NamedSize.Medium)};
            descriptionLabel.SetBinding(Label.TextProperty, "Description");

            Content = new ScrollView()
            {
                Content = new StackLayout()
                {
                    Spacing = 10,
                    Children = { titleLabel,authorLabel,descriptionLabel}
                }
            };

        }
		public NoStylesPageCS ()
		{
			Title = "No Styles";
			Icon = "csharp.png";
			Padding = new Thickness (0, 20, 0, 0);

			Content = new StackLayout { 
				Children = {
					new Label {
						Text = "These labels",
						HorizontalOptions = LayoutOptions.Center,
						VerticalOptions = LayoutOptions.CenterAndExpand,
						FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label))
					},
					new Label {
						Text = "are not",
						HorizontalOptions = LayoutOptions.Center,
						VerticalOptions = LayoutOptions.CenterAndExpand,
						FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label))
					},
					new Label {
						Text = "using styles",
						HorizontalOptions = LayoutOptions.Center,
						VerticalOptions = LayoutOptions.CenterAndExpand,
						FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label))
					} 
				}
			};
		}
        public StackLayoutExample2()
        {
            Padding = new Thickness(20);
            Label red = new Label
                        {
                            Text = "Stop",
                            BackgroundColor = Color.Red,
                            FontSize = 20
                        };
            Label yellow = new Label
                           {
                               Text = "Slow down",
                               BackgroundColor = Color.Yellow,
							   FontSize = 20
                           };
            Label green = new Label
                          {
                              Text = "Go",
                              BackgroundColor = Color.Green,
							  FontSize = 20
                          };

            Content = new StackLayout
                      {
                          Spacing = 10,
                          VerticalOptions = LayoutOptions.End,
                          Orientation = StackOrientation.Horizontal,
                          HorizontalOptions = LayoutOptions.Start,
                          Children = { red, yellow, green }
                      };
        }
Exemplo n.º 14
0
        private async void UpdateElementSize()
        {
            await Task.Delay(50);

            var windowBound    = Window.Current.Bounds;
            var visibleBounds  = ApplicationView.GetForCurrentView().VisibleBounds;
            var keyboardHeight = _keyboardBounds != Rect.Empty ? _keyboardBounds.Height : 0;

            var top    = visibleBounds.Top - windowBound.Top;
            var bottom = windowBound.Bottom - visibleBounds.Bottom;
            var left   = visibleBounds.Left - windowBound.Left;
            var right  = windowBound.Right - visibleBounds.Right;

            top    = Math.Max(0, top);
            bottom = Math.Max(0, bottom);
            left   = Math.Max(0, left);
            right  = Math.Max(0, right);

            var systemPadding = new Xamarin.Forms.Thickness(left, top, right, bottom);

            CurrentElement.SetValue(PopupPage.SystemPaddingProperty, systemPadding);
            CurrentElement.SetValue(PopupPage.KeyboardOffsetProperty, keyboardHeight);
            CurrentElement.Layout(new Rectangle(windowBound.X, windowBound.Y, windowBound.Width, windowBound.Height));
            CurrentElement.ForceLayout();
        }
		public DeviceStylesPageCS ()
		{
			var myBodyStyle = new Style (typeof(Label)) {
				BaseResourceKey = Device.Styles.BodyStyleKey,
				Setters = {
					new Setter {
						Property = Label.TextColorProperty,
						Value = Color.Accent
					} 
				}
			};

			Title = "Device";
			Icon = "csharp.png";
			Padding = new Thickness (0, 20, 0, 0);

			Content = new StackLayout { 
				Children = {
					new Label { Text = "Title style", Style = Device.Styles.TitleStyle },
					new Label { Text = "Subtitle style", Style = Device.Styles.SubtitleStyle },
					new Label { Text = "Body style", Style = Device.Styles.BodyStyle }, 
					new Label { Text = "Caption style", Style = Device.Styles.CaptionStyle },
					new Label { Text = "List item detail text style", Style = Device.Styles.ListItemDetailTextStyle },
					new Label { Text = "List item text style", Style = Device.Styles.ListItemTextStyle },
					new Label { Text = "No style" }, 
					new Label { Text = "My body style", Style = myBodyStyle }
				}
			};
		}
		public LoadingPlaceholder ()
		{
			Padding = new Thickness (20);
			Title = "Image Loading Gallery";

			var source = new UriImageSource {
				Uri = new Uri ("http://www.nasa.gov/sites/default/files/styles/1600x1200_autoletterbox/public/images/298773main_EC02-0282-3_full.jpg"),
				CachingEnabled = false
			};

			var image = new Image {
				Source = source,
				WidthRequest = 200,
				HeightRequest = 200,
			};

			var indicator = new ActivityIndicator {Color = new Color (.5),};
			indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading");
			indicator.BindingContext = image;

			var grid = new Grid();
			grid.RowDefinitions.Add (new RowDefinition());


			grid.Children.Add (image);
			grid.Children.Add (indicator);


			Content = grid;
		}
Exemplo n.º 17
0
        public ListPreviousContact(Opdracht opdracht,String CompanyName)
        {
            Title = CompanyName;
            Padding = new Thickness(10, 10, 10, 10);
            BackgroundColor = Color.White;

            layout = new StackLayout();

            lstvPreviousContact = new ListView
            {
                HasUnevenRows = true,
                ItemTemplate = new DataTemplate(typeof(PreviousCell)),
                ItemsSource = PreviousData.GetData(opdracht),
                SeparatorColor = Color.FromHex("ddd"),
                BackgroundColor = Color.White,
            };

            lstvPreviousContact.ItemSelected += (sender, e) => {
                if (e.SelectedItem != null){
                    Previous pre = e.SelectedItem as Previous;
                    List<Opdracht> lijstopdracht = DataController.Instance.GetAssessmentsByID(pre.OpdrachtID);
                    Navigation.PushAsync(new AssessmentDetailPage(lijstopdracht[0]));

                }

                ((ListView)sender).SelectedItem = null;

            };

            layout.Children.Add(lstvPreviousContact);
        }
		public SportsCategoryPage ()
		{
			Title = "Sports";

			Padding = new Thickness (10, 20);

			var places = new List<Place> () 
			{
				new Place("The Gulf Bowl", "gulfBowl.jpg", "2881 S Juniper St, Foley, AL"),
				new Place("Foley Sports Complex", "foleySportsComplex.jpg", "998 W Section Ave, Foley, AL"),
				new Place("Swatters Sports Complex", "swattersSportsComplex.jpg", "21431 Co Rd 12 S Foley, AL")
			};

			var imageTemplate = new DataTemplate (typeof(ImageCell));
			imageTemplate.SetBinding (ImageCell.TextProperty, "Name");
			imageTemplate.SetBinding (ImageCell.ImageSourceProperty, "Icon");
			imageTemplate.SetBinding (ImageCell.DetailProperty, "Address");

			var listView = new ListView () 
			{
				ItemsSource = places,
				ItemTemplate = imageTemplate
			};

			Content = listView;
		}
Exemplo n.º 19
0
        /// <summary>
        /// Initializes the component.
        /// </summary>
        void InitializeComponent()
        {
            var layout = new StackLayout
            {
                VerticalOptions = LayoutOptions.Center
            };

            var label = new Label
            {
                Text = "T-Shirt shop",
                FontSize = 36.0,
                TextColor = Color.FromRgb(52, 152, 219),
                HorizontalOptions = LayoutOptions.Center
            };

            var tableView = new TableView
            {
                Intent = TableIntent.Menu,
                Root = new TableRoot
                {
                    GetTableSection("C# T-Shirt", MockData.GetCsharp()),
                    GetTableSection("F# T-Shirt", MockData.GetFsharp())
                }
            };

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

            Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);
            Content = layout;
        }
Exemplo n.º 20
0
		public MenuPage ()
		{
			Title = "Menu";
			Icon = "menu.png";

			Padding = new Thickness (10, 20);

			var categories = new List<Category> () {
				new Category("Food", () => new FoodCategoryPage()),
				new Category("Shopping", () => new ShoppingCategoryPage()),
				new Category("Sports", () => new SportsCategoryPage())
			};

			var dataTemplate = new DataTemplate (typeof(TextCell));
			dataTemplate.SetBinding (TextCell.TextProperty, "Name");

			var listView = new ListView () {
				ItemsSource = categories,
				ItemTemplate = dataTemplate
			};

			listView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => {
				if (OnMenuSelect != null)
				{
					var category = (Category) e.SelectedItem;
					var categoryPage = category.PageFn();
					OnMenuSelect(categoryPage);
				}				
			};


			Content = listView;
		}
Exemplo n.º 21
0
 public MarginFrame(int margin)
 {
     Padding = new Thickness(margin);
     OutlineColor = Theme.BackgroundColor;
     BackgroundColor = Theme.BackgroundColor;
     HasShadow = false;
 }
Exemplo n.º 22
0
        public AboutPage()
        {
            Title = "About";

            Content = new StackLayout
            {
                Children =
                {
                    new Label
                    {
                        FontSize = 24,
                        Text     = "C# Sample: MvvM Basics\n\n" +
                                   "Basic Model View ViewModel functionality:\n\n" +
                                   "* Binding a View (page) to a ViewModel, two-way binding, View -updates-> ViewModel, ViewModel -update-> View\n\n" +
                                   "* MvvMCross Framework locates ViewModel for View via naming convention, loads and binds them\n\n" +
                                   "* Navigation to View via MvvMCros IoC container, all you need is the view Type\n\n" +
                                   "* Buttons etc. use the ICommand pattern; this interface has a 'CanExecute' property the can enable / disable the button\n" +
                                   "     via standard property binding to visual element properties; and an Execute function called when the button is clicked\n\n" +
                                   "* MvvMCross.Forms same App simulteanously targeting multiple supported platforms.\n"
                    }
                }
            };
            if (Device.RuntimePlatform == Device.Windows || Device.RuntimePlatform == Device.WinPhone)
            {
                Padding = new Xamarin.Forms.Thickness(this.Padding.Left, this.Padding.Top, this.Padding.Right, 95);
            }
        }
        private void UpdateElementSize()
        {
            if (CurrentElement != null)
            {
                var capturedElement = CurrentElement;

                var windowBound    = Window.Current.Bounds;
                var visibleBounds  = ApplicationView.GetForCurrentView().VisibleBounds;
                var keyboardHeight = _keyboardBounds != Rect.Empty ? _keyboardBounds.Height : 0;

                var top    = Math.Max(0, visibleBounds.Top - windowBound.Top);
                var bottom = Math.Max(0, windowBound.Bottom - visibleBounds.Bottom);
                var left   = Math.Max(0, visibleBounds.Left - windowBound.Left);
                var right  = Math.Max(0, windowBound.Right - visibleBounds.Right);

                var systemPadding = new Xamarin.Forms.Thickness(left, top, right, bottom);

                capturedElement.SetValue(PopupPage.SystemPaddingProperty, systemPadding);
                capturedElement.SetValue(PopupPage.KeyboardOffsetProperty, keyboardHeight);
                //if its not invoked on MainThread when the popup is showed it will be blank until the user manually resizes of owner window
                Device.BeginInvokeOnMainThread(() =>
                {
                    capturedElement.Layout(new Rectangle(windowBound.X, windowBound.Y, windowBound.Width, windowBound.Height));
                    capturedElement.ForceLayout();
                });
            }
        }
        public FacebookLoginPage(FacebookConnection connection)
        {
            this.Title = "FacebookLoginPage";

         //   Connection = new FacebookConnection(key, secret, scope);
         //   connection.SignInCompleted += Connection_SignInCompleted;
            
            this._Connection = connection;

            this._Browser = new WebView();
			//_Browser.Source = new UrlWebViewSource() { Url = _Connection.LoginUri().AbsoluteUri };
            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;
        }
Exemplo n.º 25
0
        public FieldPage()
        {
            InitializeComponent ();
            Padding = new Thickness (0, Device.OnPlatform (20, 0, 0), 0, 0);

            GameModel = DependencyService.Get<IGameModel> ();
        }
Exemplo n.º 26
0
		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,
				}
			};
		}
Exemplo n.º 27
0
        public AboutPage()
        {
            Title = "About";

            Content = new StackLayout
            {
                Children =
                {
                    new Label
                    {
                        FontSize = 24,
                        Text =  "C# Sample: MvvM Basics\n\n" +
                                "Basic Model View ViewModel functionality:\n\n" +
                                "* Binding a View (page) to a ViewModel, two-way binding, View -updates-> ViewModel, ViewModel -update-> View\n\n" +
                                "* MvvMCross Framework locates ViewModel for View via naming convention, loads and binds them\n\n" +
                                "* Navigation to View via MvvMCros IoC container, all you need is the view Type\n\n" +
                                "* Buttons etc. use the ICommand pattern; this interface has a 'CanExecute' property the can enable / disable the button\n" +
                                "     via standard property binding to visual element properties; and an Execute function called when the button is clicked\n\n" +
                                "* MvvMCross.Forms same App simulteanously targeting multiple supported platforms.\n"
                    }
                }
            };
            if (Device.OS == TargetPlatform.Windows)
                Padding = new Xamarin.Forms.Thickness(this.Padding.Left, this.Padding.Top, this.Padding.Right, 95);
        }
        public HomePageOLD()
        {
            Padding = new Thickness (5, Device.OnPlatform (20, 0, 0), 5, 5);
            Title = "ITDevConnections Demo1";

            var greetingLabel = new Label {
                Text = "Welcome to this Proof of Concept for IT Dev Connections 2015, " +
                    "SQL Azure, Azure Mobile Services and Xamarin Crosss Platform Mobile Development",
                Font = Font.SystemFontOfSize(NamedSize.Small)
            };

            var CustomersButton = new Button {
                Text = "Load Customers"
            };

            var OrdersButton = new Button {
                Text = "Show Orders"
            };

            CustomersButton.Clicked += (sender, e) => {
                Navigation.PushAsync(new DisplayCustomrPageOLD());
            };
            OrdersButton.Clicked += (sender, e) => {
                Navigation.PushAsync(new DisplayOrderPageOld());
            };
            Content = new StackLayout {
                Children = {
                    greetingLabel,
                    CustomersButton,
                    OrdersButton
                }
            };
        }
Exemplo n.º 29
0
		public GridPage5 ()
		{
			Padding = new Thickness (0, Device.OnPlatform (20, 0, 0), 0, 0);
			var grid = new Grid ();

			grid.Children.Add (
				new Image() {
					Source= Device.OnPlatform("*****@*****.**", "icon.png", "")
				}, 0, 0);

			grid.Children.Add (new Label () { Text = "40", BackgroundColor = Color.Yellow}, 0, 1);
			grid.Children.Add (new Label () { Text = "Remainder", BackgroundColor = Color.Pink}, 0, 2);

			grid.RowDefinitions.Add (new RowDefinition () 
				{
					Height = new GridLength(1, GridUnitType.Auto)
				});

			grid.RowDefinitions.Add (new RowDefinition () 
				{
					Height = new GridLength(40, GridUnitType.Absolute)
				});

			grid.RowDefinitions.Add (new RowDefinition () 
				{
					Height = new GridLength(1, GridUnitType.Star)
				});

			Content = grid;
		}
Exemplo n.º 30
0
        public ListViewEx()
        {
            var classNames = new[]
            {
                "Building Cross Platform Apps with Xamarin Part1",
                "Building Cross Platform Apps with Xamarin Part2",
                "Building Cross Platform Apps with Xamarin Part3"
            };

            //TODO: Translate into XAML
            Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
            var listView = new ListView();
            //listView.ItemsSource = classNames;
            listView.ItemsSource = PluralsightCourse.GetCourseList();

            var cell = new DataTemplate(typeof(TextCell));
            //cell.SetBinding(TextCell.TextProperty, new Binding("."));
            cell.SetBinding(TextCell.TextProperty, new Binding("Title"));
            cell.SetBinding(TextCell.DetailProperty, new Binding("Author"));
            cell.SetValue(TextCell.TextColorProperty, Color.Red);
            cell.SetValue(TextCell.DetailColorProperty,Color.Yellow);

            listView.ItemTemplate = cell;
            Content = listView;
        }
        public LabelledSectionPage()
        {
			Padding = new Thickness (0, 20, 0, 0);

            var list = new ListView
            {
                ItemTemplate = new DataTemplate(typeof(TextCell))
                {
                    Bindings = {
							{ TextCell.TextProperty, new Binding ("Name") }
						}
                },

				GroupDisplayBinding = new Binding("LongTitle"),
				GroupShortNameBinding = new Binding("Title"),
				Header = "HEADER",
				Footer = "FOOTER",
                IsGroupingEnabled = true,
                ItemsSource = SetupList(),
            };

            list.ItemTapped += (sender, e) =>
            {
                var listItem = (ListItemValue)e.Item;
                DisplayAlert(listItem.Name, "You tapped " + listItem.Name, "OK", "Cancel");
            };

            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children = { list }
            };
        }
Exemplo n.º 32
0
 public MarginFrame(int marginLeft, int marginTop, int marginRight, int marginBottom, Color backgroundColor)
 {
     Padding = new Thickness(marginLeft, marginTop, marginRight, marginBottom);
     OutlineColor = backgroundColor;
     BackgroundColor = backgroundColor;
     HasShadow = false;
 }
Exemplo n.º 33
0
        public ListContacts(List<Persoon> Contactpersonen)
        {
            Title = "Contactpersonen";
            Padding = new Thickness(10, 10, 10, 10);
            BackgroundColor = Color.White;

            layout = new StackLayout();

            lstvwContacts = new ListView
            {
                HasUnevenRows = true,
                ItemTemplate = new DataTemplate(typeof(ContactCell)),
                SeparatorColor = Color.FromHex("ddd"),
                BackgroundColor = Color.White,
                ItemsSource = ContactData.GetData(Contactpersonen),
                HeightRequest = 140
            };

            lstvwContacts.ItemSelected += (sender, e) => {
                if (e.SelectedItem != null)
                    Navigation.PushAsync(new ContactDetails(e.SelectedItem as Contact));

                ((ListView)sender).SelectedItem = null;
            };

            layout.Children.Add(lstvwContacts);
        }
Exemplo n.º 34
0
 public Page2()
 {
     var label = new Label { Text = "Hello ContentPage 2" };
     Device.OnPlatform(
         iOS: () => {
             var parentTabbedPage = this.ParentTabbedPage() as MainTabbedPage;
             if (parentTabbedPage != null) {
                 // HACK: get content out from under status bar if a navigation bar isn't doing that for us already.
                 Padding = new Thickness(Padding.Left, Padding.Top + 25f, Padding.Right, Padding.Bottom);
             }
         }
     );
     var button = new Button() {
         Text = "Switch to Tab 1; add a Page 2 there",
     };
     button.Clicked += async (sender, e) => {
         var tabbedPage = this.ParentTabbedPage() as MainTabbedPage;
         var partPage = new Page2() { Title = "Added page 2" };
         await tabbedPage.SwitchToTab1(partPage, resetToRootFirst: false);
     };
     Content = new StackLayout {
         Children = {
             button,
             label,
         }
     };
 }
Exemplo n.º 35
0
        public MyToolBar(string labelText, string leftIconText, string rightIconText)
        {
            _toolbarInfoLabel = new Label {
                Text = labelText,
                TextColor = Color.White,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions = LayoutOptions.Center,
            };

            LeftIcon = new Label {
                Text = leftIconText,
                TextColor = Color.White,
                HorizontalOptions = LayoutOptions.EndAndExpand,
            };
            LeftIconGestureRecognizer = new TapGestureRecognizer ();

            RightIcon = new Label {
                Text = rightIconText,
                TextColor = Color.White,
                HorizontalOptions = LayoutOptions.End
            };
            RightIconGestureRecognizer = new TapGestureRecognizer ();

            Children.Add (_toolbarInfoLabel);
            Children.Add (LeftIcon);
            Children.Add (RightIcon);

            BackgroundColor = Color.Silver;
            HeightRequest = 20;
            Orientation = StackOrientation.Horizontal;
            Padding = new Thickness (12, 12, 12, 12);
        }
Exemplo n.º 36
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sleepingSpans"></param>
        /// <param name="downSpans"></param>
        public SleepDiagramView(List <Tuple <double, double> > sleepingSpans, List <Tuple <double, double> > downSpans)
        {
            sleepingSpansTuple = sleepingSpans;
            downSpansTuple     = downSpans;

            Margin = new Xamarin.Forms.Thickness(0, 0);

            PaintSurface += SleepDiagramView_PaintSurface;
        }
Exemplo n.º 37
0
        public FirstPage()
        {
            Padding = new Thickness(10);

            if (Device.OS == TargetPlatform.Windows)
            {
                Padding = new Xamarin.Forms.Thickness(Padding.Left, this.Padding.Top, this.Padding.Right, 95);
            }

            ForceLayout();

            Title = " First Page";

            var entryBox = new Entry
            {
                Placeholder  = "Who are you?",
                TextColor    = Color.Aqua,
                WidthRequest = 30
            };

            var helloResponse = new Label
            {
                Text     = string.Empty,
                FontSize = 24
            };
            var loginBtn = new Button
            {
                Text            = "Login",
                BackgroundColor = Color.Orange
            };

            Content = new StackLayout
            {
                Spacing     = 10,
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    new Label
                    {
                        Text     = "Enter your nickname in the box below",
                        FontSize = 24
                    },
                    entryBox,
                    helloResponse,
                    loginBtn
                }
            };

            entryBox.SetBinding(Entry.TextProperty, new Binding("YourNickname"));
            helloResponse.SetBinding(Label.TextProperty, new Binding("Hello"));
            loginBtn.SetBinding(Button.IsVisibleProperty, new Binding("IsVisible"));
        }
Exemplo n.º 38
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sleepingSpans"></param>
        /// <param name="downSpans"></param>
        public SleepDiagramView(List <SleepInstanceView> sleepingSpans, List <SleepInstanceView> downSpans)
        {
            SleepingSpans = sleepingSpans.ToList();
            DownSpans     = downSpans.ToList();

            Margin = new Xamarin.Forms.Thickness(0, 0);

            PaintSurface += CanvasView_ReDraw;

            SetBinding(ContentView.BackgroundColorProperty, new Binding("BackgroundColor"));
            BindingContext = new
            {
                BackgroundColor = StyledBackground
            };
        }
Exemplo n.º 39
0
        public FirstPage()
        {
            Padding = new Thickness(10);

            // see https://forums.xamarin.com/discussion/45111/has-anybody-managed-to-get-a-toolbar-working-on-winrt-windows-using-xf
            if (Device.OS == TargetPlatform.Windows)
            {
                Padding = new Xamarin.Forms.Thickness(Padding.Left, this.Padding.Top, this.Padding.Right, 95);
            }

            ForceLayout();

            Title = " First Page";

            var entryBox = new Entry
            {
                Placeholder  = "Who are you?",
                TextColor    = Color.Aqua,
                WidthRequest = 30
            };

            var helloResponse = new Label
            {
                Text     = string.Empty,
                FontSize = 24
            };

            Content = new StackLayout
            {
                Spacing     = 10,
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    new Label
                    {
                        Text     = "Enter your nickname in the box below",
                        FontSize = 24
                    },
                    entryBox,
                    helloResponse
                }
            };

            entryBox.SetBinding(Entry.TextProperty, new Binding("YourNickname"));
            helloResponse.SetBinding(Label.TextProperty, new Binding("Hello"));
        }
Exemplo n.º 40
0
        public FirstPage()
        {
            Padding = new Thickness(10);

            // see https://forums.xamarin.com/discussion/45111/has-anybody-managed-to-get-a-toolbar-working-on-winrt-windows-using-xf
            if (Device.RuntimePlatform == Device.Windows || Device.RuntimePlatform == Device.WinPhone)
            {
                Padding = new Xamarin.Forms.Thickness(Padding.Left, this.Padding.Top, this.Padding.Right, 95);
            }

            ForceLayout();

            Title = " First Page";

            var entryBox = new Entry
            {
                Placeholder  = "Who are you?",
                TextColor    = Color.Aqua,
                WidthRequest = 30
            };

            var helloResponse = new Label
            {
                Text     = string.Empty,
                FontSize = 24
            };

            var image = new MvxImageView
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Margin            = new Thickness(20),
                HeightRequest     = 100,
                ImageUri          = "https://www.mvvmcross.com/img/MvvmCross-logo.png",
            };

            switch (Device.RuntimePlatform)
            {
            case Device.Android:
            {
                image.DefaultImagePath = "res:fallback";
                image.ErrorImagePath   = "res:error";
                break;
            }

            case Device.iOS:
            {
                image.DefaultImagePath = "res:Fallback.png";
                image.ErrorImagePath   = "res:Error.png";
                break;
            }
            }

            Content = new StackLayout
            {
                Spacing     = 10,
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    image,
                    new Label
                    {
                        Text     = "Enter your nickname in the box below",
                        FontSize = 24
                    },
                    entryBox,
                    helloResponse
                }
            };

            entryBox.SetBinding(Entry.TextProperty, new Binding("YourNickname"));
            helloResponse.SetBinding(Label.TextProperty, new Binding("Hello"));
        }
Exemplo n.º 41
0
 void IPaddingElement.OnPaddingPropertyChanged(Thickness oldValue, Thickness newValue)
 {
     UpdateChildrenLayout();
 }
Exemplo n.º 42
0
 Windows.UI.Xaml.Thickness AddMargin(Thickness original, double left, double top, double right, double bottom)
 {
     return(new Windows.UI.Xaml.Thickness(original.Left + left, original.Top + top, original.Right + right, original.Bottom + bottom));
 }
Exemplo n.º 43
0
 private bool Equals(Thickness other)
 {
     return(Left.Equals(other.Left) && Top.Equals(other.Top) && Right.Equals(other.Right) && Bottom.Equals(other.Bottom));
 }
Exemplo n.º 44
0
 public static Thickness ToWinPhone(this XF.Thickness t)
 {
     return(new Thickness(t.Left, t.Top, t.Right, t.Bottom));
 }
Exemplo n.º 45
0
 void IPaddingElement.OnPaddingPropertyChanged(Thickness oldValue, Thickness newValue)
 {
     InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
 }