상속: View
예제 #1
1
        public MenuCell()
        {
            image = new Image {
                HeightRequest = 20,
                WidthRequest = 20,
            };

            image.Opacity = 0.5;
               // image.SetBinding(Image.SourceProperty, ImageSrc);

            label = new Label
            {

                YAlign = TextAlignment.Center,
                TextColor = Color.Gray,
            };

            var layout = new StackLayout
            {
               // BackgroundColor = Color.FromHex("2C3E50"),
                BackgroundColor = Color.White,

                Padding = new Thickness(20, 0, 0, 0),
                Orientation = StackOrientation.Horizontal,
                Spacing = 20,
                //HorizontalOptions = LayoutOptions.StartAndExpand,
                Children = { image,label }
            };
            View = layout;
        }
		public ListItemTemplate ()
		{
			var photo = new Image { HeightRequest = 44, WidthRequest = 44 };
			photo.SetBinding (Image.SourceProperty, "Photo");

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

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

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

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

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

			View = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				Children = { photo, information }
			};
		}
		public RequiredFieldTriggerPage ()
		{
			var l = new Label {
				Text = "Entry requires length>0 before button is enabled",
			};
			l.FontSize = Device.GetNamedSize (NamedSize.Small, l); 

			var e = new Entry { Placeholder = "enter name" };

			var b = new Button { Text = "Save",

				HorizontalOptions = LayoutOptions.Center
			};
			b.FontSize = Device.GetNamedSize (NamedSize.Large ,b);

			var dt = new DataTrigger (typeof(Button));
			dt.Binding = new Binding ("Text.Length", BindingMode.Default, source: e);
			dt.Value = 0;
			dt.Setters.Add (new Setter { Property = Button.IsEnabledProperty, Value = false });
			b.Triggers.Add (dt);

			Content = new StackLayout { 
				Padding = new Thickness(0,20,0,0),
				Children = {
					l,
					e,
					b
				}
			};
		}
		public CardDetailsView (Card card)
		{
			BackgroundColor = Color.White;

			Label TitleText = new Label () {
				FormattedText = card.Title,
				FontSize = 18,
				TextColor = StyleKit.LightTextColor
			};

			Label DescriptionText = new Label () {
				FormattedText = card.Description,
				FontSize = 12,
				TextColor = StyleKit.LightTextColor
			};

			var stack = new StackLayout () {
				Spacing = 0,
				Padding = new Thickness (10, 0, 0, 0),
				VerticalOptions = LayoutOptions.CenterAndExpand,
				Children = {
					TitleText,
					DescriptionText,
					new DateTimeView (card)
				}
			};

			Content = stack;
		}
예제 #5
0
        public MenuListTemplate()
        {
            List<MenuItem> data = new MenuListData();
            this.ItemsSource = data;
            this.VerticalOptions = LayoutOptions.FillAndExpand;
            this.BackgroundColor = Theme.NavBackgroundColor;
            this.SeparatorColor = Color.Black;
            this.Margin = new Thickness(5);

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

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

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

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

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



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


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

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

              var viewLayout = new StackLayout()
              {
            Orientation = StackOrientation.Horizontal,
            Spacing = 10,
            Padding = 15,
            Children = { image, nameLabel }
              };
              View = viewLayout;
        }
예제 #7
0
파일: Spike.cs 프로젝트: adbk/spikes
        private void Foo()
        {

            Page p = new Page
            {
                //BackgroundColor = "white",
            };

            var l = new Label
            {
                Font = Font.SystemFontOfSize(NamedSize.Micro),
            };

            var e = new Entry()
            {

                Keyboard = Keyboard.Numeric,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };


            var c = new ContentView()
            {
                Padding = new Thickness(5),
            };

            var sl = new StackLayout
            {
                Padding = new Thickness(5),
            };
        }
		public TodoItemCell ()
		{
			StyleId = "Cell";

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

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

			var layout = new StackLayout {
				Padding = new Thickness(20, 0, 20, 0),
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Children = {label, tick}
			};
			View = layout;
		}
예제 #9
0
		public XuzzleSquare (char winChar, int index)
		{
			this.Index = index;
			this.normText = (index + 1).ToString ();
			this.winText = winChar.ToString ();

			// A Frame surrounding two Labels.
			label = new Label {
				Text = this.normText,
				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.CenterAndExpand
			};


			this.Padding = new Thickness (3);
			this.Content = new Frame {
				OutlineColor = Color.Accent,
				Padding = new Thickness (5, 10, 5, 0),
				Content = new StackLayout {
					Spacing = 0,
					Children = {
						label,
					}
				}
			};

			// Don't let touch pass us by.
			this.BackgroundColor = Color.Transparent;
		}
 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(MatrixControlPrototype));
     cnvTitle = this.FindByName<ContentView>("cnvTitle");
     lblTitle = this.FindByName<Label>("lblTitle");
     rootCanvas = this.FindByName<AbsoluteLayout>("rootCanvas");
 }
            public CustomCell()
            {
                //instantiate each of our views
                var image = new Image();
                StackLayout cellWrapper = new StackLayout();
                StackLayout horizontalLayout = new StackLayout();
                Label left = new Label();
                Label right = new Label();

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

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

                //add views to the view hierarchy
                horizontalLayout.Children.Add(image);
                horizontalLayout.Children.Add(left);
                horizontalLayout.Children.Add(right);
                cellWrapper.Children.Add(horizontalLayout);
                View = cellWrapper;
            }
		static StackLayout CreateMiddleLayout()
		{

			//			var preBlank = new Label {
			//				Text = "",
			//				FontSize = 11
			//			};
			var preAbv = new Label {
				Text = "Abv",
				FontSize = 11,
				FontAttributes = FontAttributes.Bold
			};

			var preIbu = new Label {
				Text = "Ibu",
				FontSize = 11,
				FontAttributes = FontAttributes.Bold
			};


			var ctrlayout = new StackLayout()
			{
				//HorizontalOptions = LayoutOptions.Start,
				VerticalOptions = LayoutOptions.Center,
				Orientation = StackOrientation.Vertical,
				Children = {preIbu, preAbv }
			};

			return ctrlayout;
		}
예제 #13
0
		public SessionCell ()
		{
			title = new Label {
				YAlign = TextAlignment.Center
			};
			title.SetBinding (Label.TextProperty, "Title");

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

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

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

			layout = new StackLayout {
				Padding = new Thickness(20, 0, 0, 0),
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.StartAndExpand,
				Children = {text, fav}
			};
			View = layout;
		}
        public FrameDemoPage()
        {
            Label header = new Label
            {
                Text = "Frame",
				FontSize = 50,
				FontAttributes = FontAttributes.Bold,
                HorizontalOptions = LayoutOptions.Center
            };

            Frame frame = new Frame
            {
                OutlineColor = Color.Accent,
                HasShadow = true,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Content = new Label
                {
                    Text = "I've been framed!"
                }
            };

            // Build the page.
            this.Content = new StackLayout
            {
                Children = 
                {
                    header,
                    frame
                }
            };
        }
        public NetworkStatusPage()
        {
            var networkLabel = new Label {
                Text = "Network Status",
                YAlign = TextAlignment.Center
            };
            var networkBox = new BoxView {
                Color = Color.White,
                HeightRequest = 25,
                WidthRequest = 25
            };

            var networkStack = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                Padding = 15,
                Spacing = 25,
                Children = { networkLabel, networkBox }
            };

            var button = new Button {
                Text = "Update Status",
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            button.Clicked += (sender, e) => {
                var service = DependencyService.Get<INetworkService>();
                var isConnected = service.IsConnected();

                networkBox.Color = isConnected ? Color.Green : Color.Red;
            };

            Content = new StackLayout {
                Children = { networkStack, button }
            };
        }
예제 #16
0
        public LeadListHeaderView(Command newLeadTappedCommand)
        {
            _NewLeadTappedCommand = newLeadTappedCommand;

            #region title label
            Label headerTitleLabel = new Label()
            {
                Text = TextResources.Leads_LeadListHeaderTitle.ToUpperInvariant(),
                TextColor = Palette._003,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                FontAttributes = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment = TextAlignment.Center
            };
            #endregion

            #region new lead image "button"
            var newLeadImage = new Image
            {
                Source = new FileImageSource { File = Device.OnPlatform("add_ios_gray", "add_android_gray", null) },
                Aspect = Aspect.AspectFit, 
                HorizontalOptions = LayoutOptions.EndAndExpand,
            };
            //Going to use FAB
            newLeadImage.IsVisible = false;
            newLeadImage.GestureRecognizers.Add(new TapGestureRecognizer()
                {
                    Command = _NewLeadTappedCommand,
                    NumberOfTapsRequired = 1
                });
            #endregion

            #region absolutLayout
            AbsoluteLayout absolutLayout = new AbsoluteLayout();

            absolutLayout.Children.Add(
                headerTitleLabel, 
                new Rectangle(0, .5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize), 
                AbsoluteLayoutFlags.PositionProportional);

            absolutLayout.Children.Add(
                newLeadImage, 
                new Rectangle(1, .5, AbsoluteLayout.AutoSize, .5), 
                AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.HeightProportional);
            #endregion

            #region setup contentView
            ContentView contentView = new ContentView()
            {
                Padding = new Thickness(10, 0), // give the content some padding on the left and right
                HeightRequest = RowSizes.MediumRowHeightDouble, // set the height of the content view
            };
            #endregion

            #region compose the view hierarchy
            contentView.Content = absolutLayout;
            #endregion

            Content = contentView;
        }
예제 #17
0
        public MyMasterDetail()
        {
            Label header = new Label
            {
                Text = "MasterDetailPage",
                FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center
            };
            string[] myList = new string[10];
            myList[0] = "Content Demo";
            //myList [1] = "Tabbed Demo";
            //myList[2] = "Carousel Demo";
            ListView listView = new ListView
            {
                ItemsSource = myList
            };
            this.Master = new ContentPage
            {
                Title = header.Text,
                Content = new StackLayout
                {
                    Children =
                    {
                        header,
                        listView

                    }
                    }
            };
            this.Detail = new NavigationPage(new HomePage());
        }
        public StackLayout CreateNewCountLayout()
        {
            var lblCount = new Label()
            {
                HorizontalOptions = LayoutOptions.Start,
                FontSize = 24,
            };
            lblCount.SetBinding(Label.TextProperty, new Binding("Count" , stringFormat: "#{0}"));

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

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

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

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

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

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

            container.Children.Add(label);

            // Return...
            return container;
        }
        public SwitchCellDemoPage()
        {
            Label header = new Label
            {
                Text = "SwitchCell",
                Font = Font.SystemFontOfSize(50, FontAttributes.Bold),
                HorizontalOptions = LayoutOptions.Center
            };

            TableView tableView = new TableView
            {
                Intent = TableIntent.Form,
                Root = new TableRoot
                {
                    new TableSection
                    {
                        new SwitchCell
                        {
                            Text = "SwitchCell:"
                        }
                    }
                }
            };

            // Build the page.
            this.Content = new StackLayout
            {
                Children = 
                {
                    header,
                    tableView
                }
            };
        }
        public DatePickerDemoPage()
        {
            Label header = new Label
            {
                Text = "DatePicker",
                Font = Font.BoldSystemFontOfSize(50),
                HorizontalOptions = LayoutOptions.Center
            };

            DatePicker datePicker = new DatePicker
            {
                Format = "D",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

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

            // Build the page.
            this.Content = new StackLayout
            {
                Children = 
                {
                    header,
                    datePicker
                }
            };
        }
예제 #22
0
 public XFormsPortableRunner(Label mainLabel, Label testsLabel, Action<Action> uiRunner)
     : base()
 {
     _mainLabel = mainLabel;
     _testsLabel = testsLabel;
     _uiRunner = uiRunner;
 }
		public ListOfBeerCell2 ()
		{
			var preBlank = new Label {
				Text = "",
				FontSize = 11
			};

			var image = new Image
			{
				Aspect = Aspect.AspectFill,
				//WidthRequest = 150,

				HorizontalOptions = LayoutOptions.Start,
				VerticalOptions = LayoutOptions.Center
			};
			image.SetBinding(Image.SourceProperty, new Binding("ProName"));

			var rslayout = CreateRightSideLayout ();

			var ctrlayout = CreateMiddleLayout ();

			var ctrrghtlayout = CreateMiddleRightLayout ();

			var leftImageLayout = new StackLayout()
			{
				Spacing = 2,
				Padding = new Thickness (5, 5, 0, 5),
				VerticalOptions = LayoutOptions.Center,
				Orientation = StackOrientation.Horizontal,
				Children = {image, ctrlayout, ctrrghtlayout, rslayout}
			};
			View = leftImageLayout;
		}
		static StackLayout CreateMiddleRightLayout()
		{
			var ibuLabel = new Label
			{
				HorizontalOptions= LayoutOptions.StartAndExpand,
				FontSize = 11
			};
			ibuLabel.SetBinding(Label.TextProperty, "Ibu");

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

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

			return ctrrghtlayout;
		}
예제 #25
0
        private void InitializeComponents()
        {
            StackLayout layout = new StackLayout ();

            nameLabel = new Label () {
                Text = client.Name,
                FontSize = 18,
                XAlign = TextAlignment.Center
            };

            layout.Children.Add ( nameLabel );

            profileImage = new Image () {
                Source = client.PictureUrl,
                Aspect = Aspect.AspectFit
            };

            layout.Children.Add ( profileImage );

            phoneLabel = new Label () {
                Text = client.Phone,
                FontSize = 14,
                XAlign = TextAlignment.Center
            };

            layout.Children.Add ( phoneLabel );

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

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

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

            return infoLayout;
        }
예제 #27
0
        public GamePage()
        {
            var message = new Label {
                Text = "Click the unicorn!"
            };

            UpdateTimeLabel ();

            var unicorn = new ImageCell {
                ImageSource = ImageSource.FromFile ("Unicorn.png"),
            };

            unicorn.Tapped += (sender, e) => {
                if(_playing){
                    _clickCount++;
                    message.Text = string.Format ("Clicked {0} times", _clickCount);
                }
            };

            Content = new StackLayout {
                VerticalOptions = LayoutOptions.Center,
                Children = {
                    new TableView {
                        Intent = TableIntent.Form,
                        RowHeight = 300,
                        Root = new TableRoot { new TableSection { unicorn } }
                    },
                    message,
                    _timeLabel
                }
            };

            Device.StartTimer (TimeSpan.FromSeconds (1), HandleSecondTick);
        }
        public WebViewDemoPage()
        {
            Label header = new Label
            {
                Text = "WebView",
				FontSize = 50,
				FontAttributes = FontAttributes.Bold,
                HorizontalOptions = LayoutOptions.Center
            };

            WebView webView = new WebView
            {
                Source = new UrlWebViewSource
                {
                    Url = "https://blog.xamarin.com/",
                },
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            // Build the page.
            this.Content = new StackLayout
            {
                Children = 
                {
                    header,
                    webView
                }
            };
        }
예제 #29
0
        public Pagina1()
        {
            Label texto = new Label {
                Text = "Página 1",
                TextColor = Color.Blue
            };

            Button boton = new Button
            {
                Text = "Click para navegar a la página DOS"
            };

            boton.Clicked += (sender, e) => {
                this.Navigation.PushAsync(new Pagina2());
            };

            //Stacklayout permite apilar los controles verticalmente
            StackLayout stackLayout = new StackLayout
            {
                Children =
                {
                    texto,
                    boton
                }
            };

            //Como esta clase hereda de ContentPage, podemos usar estas propiedades directamente
            this.Content = stackLayout;
            this.Padding = new Thickness (5, Device.OnPlatform (20, 5, 5), 5, 5);
        }
예제 #30
0
        public Setting()
        {
            var stack = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Spacing = 10
            };

            var stack2 = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing = 10,
                Padding = 10
            };

            var about = new Label
            {
                Font = Font.SystemFontOfSize(NamedSize.Medium),
                Text = "Setting",
                LineBreakMode = LineBreakMode.WordWrap
            };

            stack2.Children.Add(about);
            stack.Children.Add(new ScrollView { VerticalOptions = LayoutOptions.FillAndExpand, Content = stack2 });
            Content = stack;

        }
예제 #31
0
        private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
        {
            if (currentlySelectedCell != null)
            {
                currentlySelectedCell.FontSize  = 14;
                currentlySelectedCell.TextColor = Color.Black;
            }

            currentlySelectedCell = sender as Xamarin.Forms.Label;

            //highlight the cell?  - popup modal?
            currentlySelectedCell.FontSize  = 32;
            currentlySelectedCell.TextColor = Color.Blue;
        }
        public override IDisposable Confirm(ConfirmConfig config)
        {
            XButton positive = new XButton()
            {
                Text = config.OkText
            };
            XButton negative = new XButton()
            {
                Text = config.CancelText
            };
            XLable content = new XLable()
            {
                Text = config.Message
            };
            var layout = new StackLayout
            {
                Children =
                {
                    content,
                },
                Padding = 30
            };
            var dialog = new Dialog()
            {
                Title = config.Title,
                //Subtitle = config.Message,
                Content          = layout,
                HorizontalOption = LayoutOptions.Center,
                VerticalOption   = LayoutOptions.Center,
                Negative         = negative,
                Positive         = positive
            };

            dialog.OutsideClicked += (s, e) =>
            {
                dialog.Hide();
            };
            positive.Clicked += (s, e) =>
            {
                dialog.Hide();
                config.OnAction?.Invoke(true);
            };
            negative.Clicked += (s, e) =>
            {
                dialog.Hide();
                config.OnAction?.Invoke(false);
            };
            return(Show(dialog));
        }
예제 #33
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            var label = new Xamarin.Forms.Label();

            // await label.On<Xamarin.Forms.PlatformConfiguration.Android>().AndroidAsync()
            // Xamarin.Forms.View view = (Xamarin.Forms.View)label; // indeed no ´On´

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
예제 #34
0
        public Goui.Html.Element CreateElement()
        {
            var panel = new StackLayout();

            var titleLabel = new Xamarin.Forms.Label
            {
                Text           = "Picker",
                FontSize       = 24,
                FontAttributes = FontAttributes.Bold
            };

            panel.Children.Add(titleLabel);

            _picker = new Picker
            {
                Title = "Hello",
                //VerticalOptions = LayoutOptions.CenterAndExpand,
                ItemsSource = myItems,
            };

            panel.Children.Add(_picker);

            _picker.SelectedIndexChanged += OnPickerValueChanged;

            _label = new Xamarin.Forms.Label
            {
                Text = "Picker value is",
                HorizontalOptions = LayoutOptions.Center
            };
            panel.Children.Add(_label);

            var button = new Xamarin.Forms.Button()
            {
                Text = "Clear"
            };

            button.Clicked += (s, e) => {
                _picker.ItemsSource = new List <string>();
            };
            panel.Children.Add(button);

            var page = new ContentPage
            {
                Content = panel
            };

            return(page.GetGouiElement());
        }
 private static ElementHandler CreateHandler(XF.Element parent, MobileBlazorBindingsRenderer renderer)
 {
     return(parent switch
     {
         XF.ContentPage contentPage => new ContentPageHandler(renderer, contentPage),
         XF.ContentView contentView => new ContentViewHandler(renderer, contentView),
         XF.Label label => new LabelHandler(renderer, label),
         XF.FlyoutPage flyoutPage => new FlyoutPageHandler(renderer, flyoutPage),
         XF.ScrollView scrollView => new ScrollViewHandler(renderer, scrollView),
         XF.ShellContent shellContent => new ShellContentHandler(renderer, shellContent),
         XF.Shell shell => new ShellHandler(renderer, shell),
         XF.ShellItem shellItem => new ShellItemHandler(renderer, shellItem),
         XF.ShellSection shellSection => new ShellSectionHandler(renderer, shellSection),
         XF.TabbedPage tabbedPage => new TabbedPageHandler(renderer, tabbedPage),
         _ => new ElementHandler(renderer, parent),
     });
예제 #36
0
        static void DetachEffect(FormsElement element)
        {
            IElementController controller = element;

            if (controller == null || !controller.EffectIsAttached(EffectName))
            {
                return;
            }

            var toRemove = element.Effects.FirstOrDefault(e => e.ResolveId == Effect.Resolve(EffectName).ResolveId);

            if (toRemove != null)
            {
                element.Effects.Remove(toRemove);
            }
        }
        internal static bool HasDefaultFont(this Xamarin.Forms.Label element)
        {
            if (element.FontFamily != null || element.FontAttributes != FontAttributes.None)
            {
                return(false);
            }

            var getNamedSize = typeof(Device).GetRuntimeMethod("GetNamedSize", new Type[] { typeof(NamedSize), typeof(Type), typeof(bool) });

            if (getNamedSize != null)
            {
                var result = (double)getNamedSize.Invoke(null, new object[] { NamedSize.Default, typeof(Label), true });
                return(result == element.FontSize);
            }
            return(false);
        }
예제 #38
0
        View CreateContent(TextCell cell)
        {
            XForm.Label text = new XForm.Label
            {
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                FontAttributes          = FontAttributes.Bold,
            };
            XForm.Label detailLabel = new XForm.Label
            {
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.FillAndExpand,
            };
            detailLabel.FontSize = Device.GetNamedSize(NamedSize.Micro, detailLabel);

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

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

            var view = new AbsoluteLayout();

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

            cell.SetBinding(GridView.BindingContextProperty, new Binding("BindingContext", source: view));
            return(view);
        }
예제 #39
0
        void Construct()
        {
            BindingContext = new RefreshViewModel();

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

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

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

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

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

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

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

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

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

            refreshView.Content = listView;

            Content = refreshView;
        }
예제 #40
0
        public PageC()
        {
            var source = new HtmlWebViewSource();

            source.Html = @"<html><body bgcolor='yellow'>
           <h2 align='center' style='color: black; '>Setting</h2>

 <br>
           <p style='color: black; '>Setting function to custom preferences in-built features.</p>

 <br><br>
 <br><br>
 <br><br>

 &nbsp;&nbsp;<p style='color:black; '><<< Slide to following screen >>></>
           </body></html>";

            var labelhtml = new Xamarin.Forms.Label
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                Text = source.Html,
            };
            var webview = new WebView
            {
                Source            = source,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
            };

            var inMemoryScrollView = new ScrollView
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                IsClippedToBounds = true,
                Content           = labelhtml
            };

            Content = new StackLayout
            {
                Children =
                {
                    webview,
                }
            };
        }
예제 #41
0
        public EmbeddedResourceFontEffectPage()
        {
            var label = new Xamarin.Forms.Label
            {
                Text       = "Xamarin.Forms.Label",
                FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf"
            };

            //label.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect());
            Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(label);

            var editor = new Xamarin.Forms.Editor
            {
                Text       = "Xamarin.Forms.Editor",
                FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf"
            };

            editor.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect());

            var entry = new Xamarin.Forms.Entry
            {
                Text       = "Xamarin.Forms.Entry",
                FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf"
            };

            entry.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect());

            var button = new Xamarin.Forms.Button
            {
                Text       = "Xamarin.Forms.Button",
                FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf"
            };

            button.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect());

            Content = new StackLayout
            {
                Children =
                {
                    label,
                    editor,
                    entry,
                    button
                }
            };
        }
예제 #42
0
        private void com(object sender, EventArgs e)
        {
            Xamarin.Forms.Label hj = new Xamarin.Forms.Label();
            hj.Text = ed.Text; Xamarin.Forms.Label hjj = new Xamarin.Forms.Label()
            {
                FontSize = 15, TextColor = Color.DarkBlue
            };
            hjj.Text = login.strl;
            StackLayout stk = new StackLayout();

            stk.Children.Add(hjj); stk.Children.Add(hj);
            Xamarin.Forms.Image ll = new Xamarin.Forms.Image()
            {
                Source = "pro.png", WidthRequest = 50
            };
            g.Children.Add(ll, 0, rowcount); g.Children.Add(stk, 1, rowcount); rowcount++;
        }
예제 #43
0
        void InitializeComponent()
        {
            var grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Star
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Star
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Star
            });

            editor = new Editor
            {
                FontSize   = 12,
                FontFamily = "monospace",
            };
            editor.SetValue(Grid.ColumnProperty, 0);
            editor.SetValue(Grid.RowProperty, 1);

            results = new ContentView();
            results.SetValue(Grid.ColumnProperty, 1);
            results.SetValue(Grid.RowProperty, 1);

            var title = new Label
            {
                Text           = "XAML Editor",
                FontSize       = 24,
                FontAttributes = FontAttributes.Bold,
                Margin         = new Thickness(8),
            };

            title.SetValue(Grid.ColumnProperty, 0);
            title.SetValue(Grid.RowProperty, 0);

            grid.Children.Add(title);
            grid.Children.Add(editor);
            grid.Children.Add(results);

            Content = grid;
        }
예제 #44
0
        public CustomFontEffectPage()
        {
            var label = new Xamarin.Forms.Label
            {
                Text       = "Xamarin.Forms.Label",
                FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf"
            };

            label.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect"));

            var editor = new Xamarin.Forms.Editor
            {
                Text       = "Xamarin.Forms.Editor",
                FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf"
            };

            editor.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect"));

            var entry = new Xamarin.Forms.Entry
            {
                Text       = "Xamarin.Forms.Entry",
                FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf"
            };

            entry.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect"));

            var button = new Xamarin.Forms.Button
            {
                Text       = "Xamarin.Forms.Button",
                FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf"
            };

            button.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect"));

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

                View = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    BackgroundColor = Color.FromHex("#2980b9"),
                    Children        =
                    {
                        labelKey
                    }
                };
            }
예제 #46
0
        private void InitTextQuestion(int num, string question)
        {
            StackLayout stackLayout = new StackLayout();

            Xamarin.Forms.Label label = new Xamarin.Forms.Label();
            label.Text = "Вопрос " + Convert.ToString(num);
            Xamarin.Forms.Label label2 = new Xamarin.Forms.Label();
            label2.Text = question;
            Entry entry = new Entry();

            Xamarin.Forms.Button button = new Xamarin.Forms.Button();
            button.Text     = "Ввод";
            button.Clicked += ButtonClickTextQuestion;
            stackLayout.Children.Add(label);
            stackLayout.Children.Add(label2);
            stackLayout.Children.Add(entry);
            stackLayout.Children.Add(button);
            Content = stackLayout;
        }
예제 #47
0
        public PageB()
        {
            var source = new HtmlWebViewSource();

            source.Html = @"<html><body bgcolor='black'>
          <h2 align='center' style='color: white; '>Account</h2>
             
<br>
          <p style='color: white; '>Create Account before register and login.</p>
          <p style='color: white; '>Edit Account at the Account page.</p>
<br><br>
<br><br>
<br><br>

&nbsp;&nbsp;<p style='color: white; '><<< Slide to following screen >>></>
          </body></html>";

            var labelhtml = new Xamarin.Forms.Label
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                Text = source.Html,
            };
            var webview = new WebView
            {
                Source            = source,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
            };

            var inMemoryScrollView = new ScrollView
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                IsClippedToBounds = true,
                Content           = labelhtml
            };

            Content = new StackLayout
            {
                Children = { webview, }
            };
        }
예제 #48
0
        async void Button_Clicked(object sender, EventArgs e)
        {
            // Wrapping the popup in a using will cause the popup to be disposed when the FlyoutPopup is out of scope
            using (var popup = new Forms9Patch.FlyoutPopup
            {
                BackgroundColor = Color.LightPink
            })
            {
                var content = new Xamarin.Forms.Label
                {
                    Text              = "Close",
                    Padding           = 20,
                    BackgroundColor   = Color.Gray,
                    HorizontalOptions = LayoutOptions.Center,
                    VerticalOptions   = LayoutOptions.Center,

                    /*
                     * GestureRecognizers = { new TapGestureRecognizer
                     * {
                     *  Command = new Command(() => popup.IsVisible = false)
                     * }}
                     */
                };



                popup.Content   = content;
                popup.IsVisible = true;

                // just like the popup, listeners should be disposed.  A using sure helps make this easy!
                using (var listener = FormsGestures.Listener.For(content))
                {
                    listener.Tapped += (s, a) =>
                    {
                        popup.IsVisible = false;
                    };

                    // this prevents the popup form leaving this scope until it is popped (set invisible);
                    await popup.WaitForPoppedAsync();
                }
            }
        }
예제 #49
0
        public UcIHsLabelValueCell()
        {
            StackLayout layout = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal, Spacing = 5, Padding = new Thickness(5)
            };

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

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

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

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

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

            View = layout;
        }
예제 #50
0
        public PageA()
        {
            var source = new HtmlWebViewSource();

            source.Html = @"<html><body bgcolor='blue'>
          <h2 align='center' style='color: white; '>Home</h2>
             
<br>
          <p style='color: white; '>Navigate to other features from home</p>
<br><br>
<br><br>
<br><br>

&nbsp;&nbsp;<p style='color: white; '>>>> Slide to following screen >>></>
          </body></html>";

            var labelhtml = new Xamarin.Forms.Label
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                Text = source.Html,
            };
            var webview = new WebView
            {
                Source            = source,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
            };

            var inMemoryScrollView = new ScrollView
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                IsClippedToBounds = true,
                Content           = labelhtml
            };

            Content = new StackLayout
            {
                Children = { webview, }
            };
        }
예제 #51
0
        public Page1()
        {
            Xamarin.Forms.Label label = new Xamarin.Forms.Label {
                Text = "选择城市"
            };
            Picker cityPicker = new Picker();

            cityPicker.Items.Add("Beijing");
            cityPicker.Items.Add("Shanghai");

            Button button = new Button {
                Text = "获取"
            };

            Xamarin.Forms.Label lblWeather = new Xamarin.Forms.Label {
                Text = "当前天气"
            };
            Xamarin.Forms.Label lblDevice = new Xamarin.Forms.Label {
                Text = "设备信息"
            };

            button.Clicked += async delegate
            {
                MyClass myClass = new MyClass();
                lblWeather.Text = await myClass.GetWeather(cityPicker.Items[cityPicker.SelectedIndex]);

                lblDevice.Text = myClass.GetDevice();
            };


            Content = new StackLayout {
                Padding  = 20,
                Children =
                {
                    label,
                    cityPicker,
                    button,
                    lblWeather,
                    lblDevice
                }
            };
        }
        public WindowsReadingOrderPageCS()
        {
            _entry1 = new Entry {
                Text = "היסט?שכל !ורי !ה שכל ב", FlowDirection = FlowDirection.LeftToRight
            };
            _entry2 = new Entry {
                Text = "Hello Xamarin Forms! Hello World", FlowDirection = FlowDirection.RightToLeft
            };
            _editor1 = new Editor {
                Text = " שכל, ניווט ומהימנה תאולוגיה היא ב, זכר או מדעי תרומה מבוקשים. של ויש טכנולוגיה סוציולוגיה, מה אנא ביולי בקלות למחיקה. על חשמל אקטואליה רבה, שדרות ערכים ננקטת שמו בה. או עוד ציור מיזמים טבלאות, ריקוד קולנוע היסטוריה שכל ב", FlowDirection = FlowDirection.LeftToRight
            };
            _editor2 = new Editor {
                Text = "Lorem ipsum dolor sit amet, qui eleifend adversarium ei, pro tamquam pertinax inimicus ut. Quis assentior ius no, ne vel modo tantas omnium, sint labitur id nec. Mel ad cetero repudiare definiebas, eos sint placerat cu", FlowDirection = FlowDirection.LeftToRight
            };

            _label1 = new Xamarin.Forms.Label();
            _label2 = new Xamarin.Forms.Label();
            _label3 = new Xamarin.Forms.Label();
            _label4 = new Xamarin.Forms.Label();
            _label5 = new Xamarin.Forms.Label {
                Text = "היסט?שכל !ורי !ה שכל ב", FlowDirection = FlowDirection.LeftToRight
            };
            _label6 = new Xamarin.Forms.Label();

            var toggleButton = new Button {
                Text = "Toggle detect from content"
            };

            toggleButton.Clicked += OnToggleButtonClicked;

            Title   = "Text Reading Order";
            Content = new ScrollView
            {
                Margin  = new Thickness(20),
                Content = new StackLayout
                {
                    Children = { _entry1, _label1, _entry2, _label2, _editor1, _label3, _editor2, _label4, _label5, _label6, toggleButton }
                }
            };
            OnToggleButtonClicked(this, null);
        }
예제 #53
0
        Grid two()
        {
            con.Open();
            string          df = "SELECT * FROM comment WHERE code='" + Class1.code + "'";
            MySqlCommand    cn = new MySqlCommand(df, con);
            MySqlDataReader vbb;

            vbb = cn.ExecuteReader();

            g.ColumnDefinitions.Add(new ColumnDefinition {
                Width = 50
            });
            g.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            g.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            while (vbb.Read())
            {
                Xamarin.Forms.Image ii = new Xamarin.Forms.Image()
                {
                    Source = "defaultimage.png", HeightRequest = 50, WidthRequest = 50
                };
                g.Children.Add(ii, 0, rowcount);
                StackLayout         kll = new StackLayout();
                Xamarin.Forms.Label gg  = new Xamarin.Forms.Label()
                {
                    Text = login.strl
                };
                Xamarin.Forms.Label ggg = new Xamarin.Forms.Label()
                {
                    Text = vbb["comment"].ToString()
                };
                kll.Children.Add(gg); kll.Children.Add(ggg);
                g.Children.Add(kll, 1, rowcount); rowcount++;
            }
            con.Close();
            return(g);
        }
예제 #54
0
        public TwitterViewPage()


        {
            var source = new HtmlWebViewSource();

            //source.BaseUrl = DependencyService.Get<IBaseUrl>().Get();
            //var assetManager = Xamarin.Forms.Forms.Context.Assets;
            //using (var streamReader = new StreamReader(assetManager.Open("local.html")))
            //{
            //    source.Html = streamReader.ReadToEnd();
            //}

            source.Html = @"<a class=""twitter - timeline"" style=""color:white; font-size=80px; height:100px"" href=""https://twitter.com/shankarpokhrel8"">Tweets by shankarpokhrel8</a><script async src=""https://platform.twitter.com/widgets.js"" charset=""utf-8""></script>";

            var labelhtml = new Xamarin.Forms.Label
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                Text = source.Html,
            };
            var webview = new WebView
            {
                Source            = source,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
            };
            var inMemoryScrollView = new ScrollView
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                IsClippedToBounds = true,
                Content           = labelhtml
            };

            Content = new StackLayout
            {
                Children = { webview, }
            };
        }
        private void OpenSearchWindow()
        {
            stackLayout = new StackLayout();

            Grid stack = new Grid();

            Button button = new Button()
            {
                HorizontalOptions = LayoutOptions.End,
                Image             = "search.png",
                WidthRequest      = 50,
                HeightRequest     = 50,
                BorderRadius      = 100,
                BackgroundColor   = Color.Yellow
            };

            seachEdit = new Editor()
            {
                Text = "",
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            button.Clicked += Button_Search_Clicked;

            label = new Label()
            {
                TextColor = Color.Black
            };
            label.HorizontalOptions = LayoutOptions.Start;

            stack.Children.Add(seachEdit);

            stack.Children.Add(button);
            stackLayout.Children.Add(stack);
            stackLayout.Children.Add(label);

            Head.Children.Add(stackLayout);

            SearchFlag = true;
        }
        public MainPageCS()
        {
            var panel = new StackLayout();

            var userNameLabel = new Xamarin.Forms.Label
            {
                Text = "Username:"******"Password:"******"Login"
            };

            panel.Children.Add(loginButton);

            Content = panel;
        }
예제 #57
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomCell"/> class.
        /// </summary>
        /// <param name="title"> The title label in this view cell. </param>
        /// <param name="page"> The containing page for the table cell. </param>
        public CustomCell(string title, ContentPage page)
        {
            // Create new Relative layout for custom cell.
            listItemLayout = new RelativeLayout
            {
                HeightRequest = 120,
            };

            // Create new Label for item menu text.
            menuLabel = new Label
            {
                FontSize = 21,
                Text     = title,
            };

            // Set x,y coordinates for aligning menu label.
            listItemLayout.Children.Add(menuLabel, Constraint.RelativeToParent((parent) => (parent.X + 32)), Constraint.RelativeToParent((parent) => (.3 * parent.Height)));

            View = listItemLayout;

            // Add tap gesture.
            this.Tapped += (s, e) =>
            {
                if (Command == null)
                {
                    // This command is used for push new page in async mode,
                    // the parameter title is title of the new page.
                    Command = new Command(async() =>
                    {
                        await page.Navigation.PushAsync(new ResultPage(title));
                    });
                }

                if (Command != null)
                {
                    Command.Execute(null);
                }
            };
        }
예제 #58
0
            public WorkTicketDataCell()
            {
                // need a spot for the work ticket number
                Xamarin.Forms.Label labelWTNumber = new Xamarin.Forms.Label();
                labelWTNumber.FontSize = 10;
                labelWTNumber.SetBinding(Xamarin.Forms.Label.TextProperty, "FormattedTicketNo");

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

                View = new StackLayout()
                {
                    Padding  = 10,
                    Children =
                    {
                        labelWTNumber,
                        labelDescription
                    }
                };
            }
예제 #59
0
        public CustomerContactViewCell()
        {
            Color asbestos = Color.FromHex("#7f8c8d");

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

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

            View = new StackLayout()
            {
                Children =
                {
                    labelContactCode,
                    labelContactName
                }
            };
        }
예제 #60
0
        public Ooui.Element CreateElement()
        {
            var panel = new StackLayout();

            var titleLabel = new Xamarin.Forms.Label
            {
                Text           = "Slider",
                FontSize       = 24,
                FontAttributes = FontAttributes.Bold
            };

            panel.Children.Add(titleLabel);

            Slider slider = new Slider
            {
                Minimum = 0,
                Maximum = 100
            };

            panel.Children.Add(slider);

            slider.ValueChanged += OnSliderValueChanged;

            _label = new Xamarin.Forms.Label
            {
                Text = "Slider value is 0",
                HorizontalOptions = LayoutOptions.Center
            };
            panel.Children.Add(_label);

            var page = new ContentPage
            {
                Content = panel
            };

            return(page.GetOouiElement());
        }