public CameraView () { done = false; this.layout = new StackLayout{ Padding = 10 }; btn = new Button (); btn1 = new Button (); btn2 = new Button (); btn.Text = "Take picture"; btn1.Text = " Select Picture"; btn2.Text = "Add ticket"; imgByte = null; _imageSource = new Image (); _imageSource.Aspect = Aspect.AspectFill; layout.Children.Add (btn); layout.Children.Add (btn1); layout.Children.Add (_imageSource); btn.Clicked+= Btn_Clicked; btn1.Clicked+= Btn1_Clicked; btn2.Clicked+= Btn2_Clicked; Content = new ScrollView { Content = layout }; }
//private bool _taxaTxtChanged; public AddTaxaPage(string title) { var scrollView = new ScrollView(); var contentStack = new StackLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start }; _taxaStack = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand }; var numLabel = new Label { Text = "Enter Number of Taxa:" }; _numEntry = new Entry { WidthRequest = 50 }; _numEntry.Completed += NumTaxa_OnCompleted; _numEntry.Keyboard = Keyboard.Numeric; _numEntry.BindingContext = new EntryRestrictions(); _numEntry.SetBinding(Entry.TextProperty, "Num1To99"); contentStack.Children.Add(numLabel); contentStack.Children.Add(_numEntry); _noteLabel = new Label { Text = "These are the organisms you will be comparing." }; contentStack.Children.Add(_noteLabel); contentStack.Children.Add(_taxaStack); _addTaxaBtn.Clicked += OnAddTaxa; _addTaxaBtn.BackgroundColor = Color.Accent; _addTaxaBtn.IsEnabled = false; _addTaxaBtn.IsVisible = false; contentStack.Children.Add(_addTaxaBtn); scrollView.Content = contentStack; Content = scrollView; Title = title; }
public GameDetailPage() { Content = new ScrollView () { Content = new StackLayout () { Padding = new Thickness(0,0,0,30), Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.Start, Children = { Picture (), Space(), GameName(), HorzLine (), GamePrice (), HorzLine (), GameCount (), Space2 (), GameMenu (),TotalGamePicker (), AddtoCartButton () } } }; }
public iOSScrollViewPageCS(ICommand restore) { var scrollView = new Xamarin.Forms.ScrollView(); var button = new Button { Text = "Toggle ScrollView DelayContentTouches" }; button.Clicked += (sender, e) => scrollView.On <iOS>().SetShouldDelayContentTouches(!scrollView.On <iOS>().ShouldDelayContentTouches()); var returnButton = new Button { Text = "Return to Platform-Specifics List" }; returnButton.Clicked += (sender, e) => restore.Execute(null); scrollView.Content = new StackLayout { Margin = new Thickness(0, 20), Children = { new Slider(), button, returnButton } }; scrollView.On <iOS>().SetShouldDelayContentTouches(false); Master = new ContentPage { Title = "Menu", BackgroundColor = Color.Blue }; Detail = new ContentPage { Content = scrollView }; }
public SkillsPage() { SkillsViewModel skillsVM = new SkillsViewModel(); var layout = new StackLayout { Spacing = 0, VerticalOptions = LayoutOptions.FillAndExpand }; foreach (Skill skills in skillsVM.Skills) { layout.Children.Add(new Label { Text = skills.title }); layout.Children.Add(new Label { Text = skills.description }); } Content = new ScrollView { Content = layout }; }
void AddChildrenToParentLayout() { _layout.Children.Add( new Label { Style = StyleConstants.WhiteTextLabel, Text = "Please enter username", HorizontalOptions = LayoutOptions.Start } ); _layout.Children.Add(_usernameEntry); _layout.Children.Add( new Label { Style = StyleConstants.WhiteTextLabel, Text = "Please enter password", HorizontalOptions = LayoutOptions.Start } ); _layout.Children.Add(_passwordEntry); _layout.Children.Add(_saveUsernameButton); _layout.Children.Add(_cancelButton); Content = new Xamarin.Forms.ScrollView { Content = _layout }; }
protected override void OnAppearing () { base.OnAppearing (); const int count = 0xf196 - 0xf000; const int colCount = 10; var rowLayout = new StackLayout() { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; var c = 0xf000; for (var row = 0; row < count / colCount; row++) { var colLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.StartAndExpand, }; for (var col = 0; col < colCount; col++) { var label = new FontAwesomeLabel { Text = ((char) c++).ToString(), HorizontalOptions = LayoutOptions.CenterAndExpand, }; colLayout.Children.Add(label); } rowLayout.Children.Add(colLayout); } Content = new ScrollView { Content = rowLayout }; }
public SlideShowView () { HeightRequest = 200; var image1 = new Image() {Source = new FileImageSource(){ File = "bama1.jpg"}}; var image2 = new Image() {Source = new FileImageSource(){ File = "bama2.jpg"}}; var image3 = new Image() {Source = new FileImageSource(){ File = "bama3.jpg"}}; var image4 = new Image() {Source = new FileImageSource(){ File = "bama4.jpg"}}; var image5 = new Image() {Source = new FileImageSource(){ File = "bama5.jpg"}}; var image6 = new Image() {Source = new FileImageSource(){ File = "bama6.jpg"}}; var image7 = new Image() {Source = new FileImageSource(){ File = "bama7.jpg"}}; var image8 = new Image() {Source = new FileImageSource(){ File = "bama8.jpg"}}; var image9 = new Image() {Source = new FileImageSource(){ File = "bama9.jpg"}}; var stack = new StackLayout () { Padding = new Thickness(0,0,0,10), Orientation = StackOrientation.Horizontal, Spacing = 10, Children = { image1, image2, image3, image4, image5, image6, image7, image8, image9 } }; Content = new ScrollView() { Content = stack, Orientation = ScrollOrientation.Horizontal}; }
public ConfigSpringboard() { NavigationPage.SetHasNavigationBar (this, false); Grid configGrid = new Grid { BackgroundColor = Colours.BG_DARK, Padding = new Thickness(10), RowDefinitions = { new RowDefinition { Height = new GridLength(150, GridUnitType.Absolute) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; HomeButton UC = new HomeButton (IconLabel.Icon.FAUser, "YOUR INFO", Colours.USERCONFIG_LIGHT, Colours.USERCONFIG_MEDIUM); HomeButton AC = new HomeButton (IconLabel.Icon.FABell, "ALERTS CONFIG", Colours.ALERTSCONFIG_LIGHT, Colours.ALERTSCONFIG_MEDIUM); var alertConfigTapGestureRecognizer = new TapGestureRecognizer (); alertConfigTapGestureRecognizer.Tapped += async (s, e) => { if (AC.IsEnabled) { AC.IsEnabled = false; await AC.ScaleTo(.8, 100); await AC.ScaleTo(1, 100); await Navigation.PushAsync (await AlertConfigContainer.CreateAlertConfigContainer()); AC.IsEnabled = true; } }; AC.GestureRecognizers.Add (alertConfigTapGestureRecognizer); var userConfigTapGestureRecognizer = new TapGestureRecognizer (); userConfigTapGestureRecognizer.Tapped += async (s, e) => { if (UC.IsEnabled) { UC.IsEnabled = false; await UC.ScaleTo(.8, 100); await UC.ScaleTo(1, 100); await Navigation.PushAsync (await YourInfoPageContainer.CreateYourInfoPageContainer()); UC.IsEnabled = true; } }; UC.GestureRecognizers.Add (userConfigTapGestureRecognizer); configGrid.Children.Add (UC, 0, 0); configGrid.Children.Add (AC, 1, 0); ScrollView scrollView = new ScrollView { Orientation = ScrollOrientation.Vertical, Content = configGrid, VerticalOptions = LayoutOptions.FillAndExpand }; Content = scrollView; }
private void RenderContent() { ScrollView scrollview = new ScrollView() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand}; var rootLayout = new StackLayout() { BackgroundColor = Color.Black, Spacing = 15, Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(0, 0, 0, 10) }; // Padding = new Thickness(45, 15, 45, 15), ContentView header = new ContentView() { BackgroundColor = Color.Black, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(0, 80, 0, 0) }; rootLayout.Children.Add(header); btnGoogleLogIn = new Button() { Text = " LOG IN WITH GOOGLE ", FontAttributes = FontAttributes.Bold, BackgroundColor = Color.Green, TextColor = Color.White, HorizontalOptions = LayoutOptions.Center }; rootLayout.Children.Add(btnGoogleLogIn); scrollview.Content = rootLayout; if (Device.OS == TargetPlatform.Android) { scrollview.IsClippedToBounds = true; } Content = scrollview; }
public StartPage() { Title = "DataSave Sample"; Padding = 16; Content = new ScrollView { Content = new StackLayout { Spacing = 10, Children = { new Button { Text = "Save to dictionay (C#)", Command = new Command(async ()=> await Navigation.PushAsync(new SaveToDictionaryCS())) }, new Button { Text = "Save to dic by ViewModel (C#)", Command = new Command(async () => await Navigation.PushAsync(new SaveByVMCS())) }, new Button { Text = "Save to dic by ViewModel (Xaml)", Command = new Command(async () => await Navigation.PushAsync(new SaveByVMXaml())) }, new Button { Text = "Save to json (C#)", Command = new Command(async () => await Navigation.PushAsync(new SaveToJsonCS())) }, new Button { Text = "Save to json (Xaml)", Command = new Command(async () => await Navigation.PushAsync(new SaveToJsonXaml())) }, } } }; }
public ExperiencePage() { ExperienceViewModel experienceVM = new ExperienceViewModel(); var layout = new StackLayout { Spacing = 0, VerticalOptions = LayoutOptions.FillAndExpand }; foreach(Experience exp in experienceVM.Experience) { layout.Children.Add(new Label { Text = exp.title }); layout.Children.Add(new Label { Text = exp.description }); } Content = new ScrollView { Content = layout }; }
public GoalsMainPage() { NavigationPage.SetHasNavigationBar(this, false); masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244); progressBar = DependencyService.Get<IProgressBar>(); this.Appearing += OnAppearing; mainTitleBar = new GemsPageTitleBar(Color.FromRgb(8, 135, 224), "Goals & Dreams", Color.White, "", true); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += OnImageAreaTapGestureRecognizerTapped; masterScroll = new ScrollView(); masterScroll.WidthRequest = App.screenWidth - 20; masterScroll.HeightRequest = App.screenHeight * 85 / 100; masterScroll.BackgroundColor = Color.FromRgb( 244, 244, 244 ); masterScroll.IsClippedToBounds = true; masterStack = new StackLayout(); masterStack.Orientation = StackOrientation.Vertical; masterStack.BackgroundColor = Color.FromRgb(244, 244, 244); masterStack.Spacing = 0; //masterStack.Padding = new Thickness( 10, 10, 10, 10 ); }
public Page0(string pageName) : base(pageName) { _TopBar.RAction = async () => { await Navigation.PushAsync(new Page1("page 1")); }; _layout = new MyStackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Children = { new StackLayout { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand, Children = {_btnButton, _myLabel, _btnRemobeImage} } } }; Content = new ScrollView { Content = _layout }; _btnButton.Clicked += BtnButtonOnClicked; _btnRemobeImage.Clicked +=BtnRemobeImageOnClicked; }
public DetailsPage(Monkey monkey) { this.Title = monkey.Name; var details = new Label{ Text = monkey.Details }; var image = new Image { Source = monkey.Image, Aspect = Aspect.AspectFit, VerticalOptions = LayoutOptions.FillAndExpand }; Content = new ScrollView { Padding = 20, Content = new StackLayout { Spacing = 10, VerticalOptions = LayoutOptions.FillAndExpand, Children = { details, image} } }; }
public TrackingPage() { Title = "Tracking"; Padding = new Thickness (20, 20, 20, 20); locationLabel = new Label { Text = "Location", HorizontalOptions = LayoutOptions.CenterAndExpand, }; directionLabel = new Label { Text = "Direction", HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Font = Font.SystemFontOfSize(14) }; var layout = new StackLayout { Children = { locationLabel, directionLabel } }; var scroll = new ScrollView () { Content = layout }; Content = scroll; var timer = new Timer (1000); timer.Elapsed += OnTimerElapsed; timer.Start (); }
public static void SetupStepView(RelativeLayout rLayout, ScrollView helpSv, StackLayout questionContainer, Command questionTappedCmd) { var tgr = new TapGestureRecognizer() { Command = new Command((obj) => { var oldBound = helpSv.Bounds; if (oldBound.Height == 40) { // Need to show. var newBound = new Rectangle(0, rLayout.Height - 200, rLayout.Width, 200); helpSv.LayoutTo(newBound, 250, Easing.CubicInOut); } else { // Need to hide. var newBound = new Rectangle(0, rLayout.Height - 40, rLayout.Width, 40); helpSv.LayoutTo(newBound, 250, Easing.CubicInOut); } }) }; helpSv.GestureRecognizers.Add(tgr); var qControls = questionContainer.Children.Where(x => x is QuestionLayout).Cast<QuestionLayout>(); var currIdx = 0; foreach (var qControl in qControls) { var questionTgr = new TapGestureRecognizer() { Command = questionTappedCmd, CommandParameter = currIdx, }; qControl.GestureRecognizers.Add(questionTgr); currIdx++; } }
public SoldCars() { InitializeComponent(); manager = CarItemManager.DefaultManager; var instructionStack = new StackLayout () { BackgroundColor = Color.FromHex(ThemeColors.PrimaryDark), Padding=new Thickness (15, 15, 15, 15)}; var instructionLabel = new Label () { Text = "Click on an Entry for Details", FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)), TextColor=Color.FromHex(ThemeColors.TextIcons) }; instructionStack.Children.Add (instructionLabel); var scrollview = new ScrollView { Content = new StackLayout { Children = { instructionStack, todoList }, }, }; var outerStack = new StackLayout(); outerStack.Children.Add(scrollview); Content = outerStack; }
public CallPutPage () { BackgroundColor = MyColors.MidnightBlue; var stackLayout = new StackLayout { Padding = new Thickness (15), Children = { new Label { Text = "Compare call/put price against $100", HorizontalOptions = LayoutOptions.CenterAndExpand, FontAttributes = FontAttributes.Bold, TextColor = MyColors.Clouds }, new BoxView{ HeightRequest = 10, Opacity = 0 }, callValueEntry, new BoxView{ HeightRequest = 10, Opacity = 0 }, putValueEntry, new BoxView{ HeightRequest = 10, Opacity = 0 }, calcuatePayoffButton, } }; var scrollView = new ScrollView (); scrollView.Content = stackLayout; Content = scrollView; calcuatePayoffButton.Clicked += CalcuatePayoffButton_Clicked; }
public HomePage(string username) : base("HomePage") { _mainScroll = new ScrollView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; this.Content = _mainScroll; _mainStack = new StackLayout{ HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; _mainScroll.Content = _mainStack; _homepageTitle = new Label { Text = "Welcome, " + username + "!", HorizontalOptions = LayoutOptions.CenterAndExpand }; _mainStack.Children.Add (_homepageTitle); _next = new Views.TrackingButton(this.Title) { Text = "Next", HorizontalOptions = LayoutOptions.CenterAndExpand }; _next.Clicked += Next_Clicked; _mainStack.Children.Add (_next); }
public AboutPage() { Title = "Informacoes"; // GetValue (); var stack = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Children = { lbInformation } }; var scroll = new ScrollView { BackgroundColor = Colors.BackgroundDefault, Content = stack }; var absoluteLayout = new AbsoluteLayout (); var background = new Image { Style = Styles.BackgroundImage }; absoluteLayout.Children.Add (background, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All); absoluteLayout.Children.Add (scroll, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All); Content = absoluteLayout; }
public MovieDetail(string title, string rate, string poster, string descritption) { Title =title; Label rating = new Label { Text = rate, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), HorizontalOptions = LayoutOptions.Center }; Image image = new Image{ Source=poster, HeightRequest = 350, WidthRequest = 125 }; Label description = new Label { Text = descritption, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), HorizontalOptions = LayoutOptions.CenterAndExpand, }; StackLayout stackLayout = new StackLayout { Children = {rating, image, description} }; ScrollView scroll = new ScrollView{ Content = stackLayout }; this.Content = scroll; }
public ValidateNumberPage() { cursorLabel = new LabelCustomFont { Text = ">" }; entryNumber = new EntryCustomFont { HorizontalOptions = LayoutOptions.FillAndExpand, Keyboard = Keyboard.Numeric }; entryNumber.Completed += OnNumberEntryCompleted; stackLayout = new StackLayout { Padding = new Thickness(16), Children = { new LabelCustomFont { Text = "ENTER A CREDIT CARD NUMBER:" }, new StackLayout { Children = { cursorLabel, entryNumber }, Orientation = StackOrientation.Horizontal, Spacing = 0 } } }; Content = new ScrollView() { Content = stackLayout, HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = ScrollOrientation.Vertical }; }
public LoginPage() { BindingContext = new LoginViewModel(Navigation); var layout = new StackLayout { Padding = 10 }; var label = new Label { Text = "Login", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), TextColor = Color.White, VerticalOptions = LayoutOptions.Start, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, }; layout.Children.Add(label); var username = new Entry { Placeholder = "Username" }; username.SetBinding(Entry.TextProperty, LoginViewModel.UsernamePropertyName); layout.Children.Add(username); var password = new Entry { Placeholder = "Password", IsPassword = true }; password.SetBinding(Entry.TextProperty, LoginViewModel.PasswordPropertyName); layout.Children.Add(password); var button = new Button { Text = "Sign In", TextColor = Color.White }; button.SetBinding(Button.CommandProperty, LoginViewModel.LoginCommandPropertyName); layout.Children.Add(button); Content = new ScrollView { Content = layout }; }
public BottomStraddlePage () { BackgroundColor = MyColors.MidnightBlue; var stackLayout = new StackLayout { Padding = new Thickness (15), Children = { new Label { Text = "Create a Bottom Straddle", HorizontalOptions = LayoutOptions.CenterAndExpand, FontAttributes = FontAttributes.Bold, TextColor = MyColors.Clouds }, bottomStraddleEntry, new BoxView{ HeightRequest = 10, Opacity = 0 }, calculateBottomStraddleButton, new BoxView{ HeightRequest = 10, Opacity = 0 }, nullCheckLabel } }; var scrollView = new ScrollView (); scrollView.Content = stackLayout; Content = scrollView; calculateBottomStraddleButton.Clicked += CalculateBottomStraddleButton_Clicked; }
public ProjectsPage() { ProjectsViewModel projectsVM = new ProjectsViewModel(); var layout = new StackLayout { Spacing = 0, VerticalOptions = LayoutOptions.FillAndExpand }; foreach (Project project in projectsVM.Projects) { layout.Children.Add(new Label { Text = project.title }); layout.Children.Add(new Label { Text = project.description }); layout.Children.Add(new Label { Text = $"Type: {project.type}" }); } Content = new ScrollView { Content = layout }; }
public ScriptInputGroupPage(InputGroup inputGroup, List<InputGroup> previousInputGroups) { Title = "Input Group"; StackLayout contentLayout = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand }; foreach (StackLayout stack in UiProperty.GetPropertyStacks(inputGroup)) contentLayout.Children.Add(stack); Button editInputsButton = new Button { Text = "Edit Inputs", FontSize = 20, HorizontalOptions = LayoutOptions.FillAndExpand }; editInputsButton.Clicked += async (o, e) => { await Navigation.PushAsync(new ScriptInputsPage(inputGroup, previousInputGroups)); }; contentLayout.Children.Add(editInputsButton); Content = new ScrollView { Content = contentLayout }; }
public BeerDetails(BreweryDB.Models.Beer beer) { Title = beer.Name; name = new Label { Text = beer.Name, FontSize = 20, }; description = new Label { Text = beer.Description, FontSize = 10 }; image = new Image { Source = beer.Labels.Medium }; Content = new ScrollView { Content = new StackLayout { Padding = 10, Children = {image, name, description} } }; }
public AbsoluteLayoutPageCode () { Title = "AbsoluteLayout - C#"; BackgroundImage = "deer.jpg"; var outerLayout = new AbsoluteLayout (); var scroll = new ScrollView (); outerLayout.Children.Add (scroll, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All); outerLayout.Children.Add (new Button { Text = "Previous", BackgroundColor = Color.White, TextColor = Color.Green, BorderRadius = 0 }, new Rectangle (0, 1, .5, 60), AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.WidthProportional); outerLayout.Children.Add (new Button { Text = "Next", BackgroundColor = Color.White, TextColor = Color.Green, BorderRadius = 0 }, new Rectangle (1, 1, .5, 60), AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.WidthProportional); var innerLayout = new AbsoluteLayout (); scroll.Content = innerLayout; innerLayout.Children.Add (new Image { Source = "deer.jpg" }, new Rectangle (.5, 0, 300, 300), AbsoluteLayoutFlags.PositionProportional); innerLayout.Children.Add (new BoxView { Color = Color.FromHex ("#CC1A7019") }, new Rectangle (.5, 300, .7, 50), AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.WidthProportional); innerLayout.Children.Add (new Label { Text = "deer.jpg", XAlign = TextAlignment.Center, TextColor = Color.White }, new Rectangle (.5, 310, 1, 50), AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.WidthProportional); Content = outerLayout; }
public ContactPage() { ContactsViewModel contactsVM = new ContactsViewModel(); var layout = new StackLayout { Spacing = 0, VerticalOptions = LayoutOptions.FillAndExpand }; foreach (Contact contacts in contactsVM.Contacts) { layout.Children.Add(new Label { Text = contacts.title }); layout.Children.Add(new Label { Text = contacts.urlShort }); } Content = new ScrollView { Content = layout }; }
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 MainPage() { Label theLabel = new Label() { Text = " click ", HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand }; Button theButton = new Button() { Text = "Click Me", HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand }; theButton.Clicked +=(sender, e) => { theLabel.Text = string.Format("{0} {1}"," click ",theLabel.Text); }; DatePicker dtPicket = new DatePicker(); var container = new StackLayout() { Padding = new Thickness(20, Device.OnPlatform(20,0,0),20,20) }; container.Children.Add(dtPicket); container.Children.Add(theButton); container.Children.Add(theLabel); Content = new ScrollView() { Content = container }; }
public NewUserSignUpPage() { On <iOS>().SetUseSafeArea(true); BackgroundColor = Color.FromHex("#2980b9"); _usernameEntry = new UnderlinedEntry("Username", AutomationIdConstants.NewUserSignUpPage_NewUserNameEntry) { ReturnType = ReturnType.Next }; _passwordEntry = new UnderlinedEntry("Password", AutomationIdConstants.NewUserSignUpPage_NewPasswordEntry) { IsPassword = true, ReturnType = ReturnType.Go, ReturnCommand = new Command(() => HandleSaveUsernameButtonClicked(_saveUsernameButton, EventArgs.Empty)) }; _saveUsernameButton = new BorderedButton("Save Username", AutomationIdConstants.NewUserSignUpPage_SaveUsernameButton) { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.EndAndExpand }; _saveUsernameButton.Clicked += HandleSaveUsernameButtonClicked; _cancelButton = new BorderedButton("Cancel", AutomationIdConstants.NewUserSignUpPage_CancelButton) { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.End }; _cancelButton.Clicked += (object sender, EventArgs e) => { Navigation.PopModalAsync(); }; var layout = new StackLayout { Padding = new Thickness(20, 50, 20, 20), VerticalOptions = LayoutOptions.FillAndExpand, Children = { new WhiteTextLabel("Please enter username"), _usernameEntry, new WhiteTextLabel("Please enter password"), _passwordEntry, _saveUsernameButton, _cancelButton } }; Content = new Xamarin.Forms.ScrollView { Content = layout }; }
public async void init() { var scrollView = new Xamarin.Forms.ScrollView(); Content = scrollView; stackLayout = new StackLayout(); await GetDishes(stackLayout, "Kolacja"); this.Appearing += OnAppear; }
void AddChildrenToParentLayout() { _layout.Children.Add(new WhiteTextLabel("Please enter username")); _layout.Children.Add(_usernameEntry); _layout.Children.Add(new WhiteTextLabel("Please enter password")); _layout.Children.Add(_passwordEntry); _layout.Children.Add(_saveUsernameButton); _layout.Children.Add(_cancelButton); Content = new Xamarin.Forms.ScrollView { Content = _layout }; }
/********************************************************************** * ****************************************************************** * * * easy UI * * * ****************************************************************** * *********************************************************************/ StackLayout CreateLayout() { // Wrap ScrollView around StackLayout to be able to scroll the content scrollView = new Xamarin.Forms.ScrollView { Margin = new Thickness(10) }; var stackLayout = new StackLayout(); scrollView.Content = stackLayout; this.Content = scrollView; return(stackLayout); }
public LandingPage() { Title = "Landing"; BackgroundColor = Color.White; var topImage = new CachedImage() { Source = "sharedcode.png", Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.FillAndExpand }; var customFont = new Label() { Style = CoreStyles.FontLabel, Text = "Xamarin.Forms.CommonCore" }; var fs = new FormattedString(); //using an extension method to add span with text fs.AddTextSpan(" Xamarin.Forms provides a platform to resuse code across logic and UI development. " + "There is tremendous debate on the use of portable class libraries versus shared projects. \n\n"); fs.AddTextSpan(" After using the CommonCore project, the benefits of shared projects should be apparent with nested files, compiler directives and ease of change." + " It is still possible to write spaghetti code which XAML does help prevent but good team standards can mitigate these issues.\n\n"); fs.AddTextSpan(" CommonCore uses Unity to create static instances of the application's view models and service classes through dependency injection." + " Take a moment to view the readme file in order to understand all the nuget files and configuration settings available through CommonCore."); var lbl = new Label() { FormattedText = fs, Margin = 10 }; Content = new Xamarin.Forms.ScrollView() { Content = new CompressedStackLayout() { Children = { topImage, customFont, lbl } } }; }
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), });
public async Task GetDishes(StackLayout stackLayout, string dishType) { var scrollView = new Xamarin.Forms.ScrollView(); Content = scrollView; var menu = await restService.GetMenu(dishType); foreach (Dish dish in menu) { var dishRow = new DishRow(dish.dishId, dish.dishName, dish.price, dish.logoPath); var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += OnTap; dishRow.GestureRecognizers.Add(tapGestureRecognizer); stackLayout.Children.Add(dishRow); } stackLayout.Children.Add(billView); scrollView.Content = stackLayout; }
public iOSScrollViewPageCS() { var scrollView = new Xamarin.Forms.ScrollView(); var button = new Button { Text = "Toggle ScrollView DelayContentTouches" }; button.Clicked += (sender, e) => scrollView.On <iOS>().SetShouldDelayContentTouches(!scrollView.On <iOS>().ShouldDelayContentTouches()); scrollView.Content = new StackLayout { Margin = new Thickness(0, 20), Children = { new Slider(), button } }; scrollView.On <iOS>().SetShouldDelayContentTouches(false); Master = new ContentPage { Title = "Menu", BackgroundColor = Color.Blue }; Detail = new ContentPage { Content = scrollView }; }
public MainPage() { InitializeComponent(); var scrollVIew = new Xamarin.Forms.ScrollView { Content = new StackLayout { Spacing = 0, WidthRequest = 100, Children = { new BoxView { Color = Color.Blue, HeightRequest = 500, }, new BoxView { Color = Color.Yellow, HeightRequest = 500, }, new BoxView { Color = Color.Red, HeightRequest = 500, }, }, } }; //UIにStackLayoutをバインドする Content = scrollVIew; }
//METHODS /********************************************************************** *********************************************************************/ void CreateContent() { var scrollView = new Xamarin.Forms.ScrollView { Margin = new Thickness(10) }; var stackLayout = new StackLayout(); var stackLayout2 = new StackLayout() { Orientation = StackOrientation.Horizontal }; this.Content = scrollView; scrollView.Content = stackLayout; //Wrap ScrollView around StackLayout to be able to scroll the content //add elements to stacklayout var l_MemorySize = new Label { FontSize = App._h3FontSize, Text = "Memory Size" }; var l_Exponent = new Label { Text = "Exponent: ", VerticalOptions = LayoutOptions.Center, FontSize = App._textFontSize }; p_Exponent = new Xamarin.Forms.Picker() { FontSize = App._textFontSize, WidthRequest = 40 }; p_Exponent.Items.Add("1"); p_Exponent.Items.Add("2"); p_Exponent.Items.Add("3"); p_Exponent.Items.Add("4"); p_Exponent.Items.Add("5"); p_Exponent.Items.Add("6"); p_Exponent.Items.Add("7"); p_Exponent.Items.Add("8"); p_Exponent.Items.Add("9"); p_Exponent.Items.Add("10"); p_Exponent.Items.Add("11"); p_Exponent.Items.Add("12"); p_Exponent.Items.Add("13"); p_Exponent.Items.Add("14"); p_Exponent.Items.Add("15"); //been to lazy to programm a loop.sorry p_Exponent.SelectedIndex = 4; //5 p_Exponent.SelectedIndexChanged += P_Exponent_SelectedIndexChanged; //add method //TO DO: Fire Event when absoulute memorysize needs to be calculated l_AbsoluteMemorySize = new Label { Text = "Absoulute memory size: 32", FontSize = App._smallTextFontSize }; var l_Space = new Label { Text = " " }; var b_Start = new Button { Text = "Start", BackgroundColor = App._buttonBackground, TextColor = App._buttonText, CornerRadius = App._buttonCornerRadius, FontSize = App._buttonFontSize }; b_Start.Clicked += B_Start_Clicked; //add Click Event(Method) stackLayout.Children.Add(l_MemorySize); stackLayout2.Children.Add(l_Exponent); stackLayout2.Children.Add(p_Exponent); stackLayout.Children.Add(stackLayout2); stackLayout.Children.Add(l_AbsoluteMemorySize); stackLayout.Children.Add(l_Space); stackLayout.Children.Add(b_Start); }
public HardwareKeyPage1(bool modal) { #region Hardware Key Listeners #region ... for this HardwareKeyPage this.AddHardwareKeyListener("ç", OnHardwareKeyPressed); this.AddHardwareKeyListener("é", OnHardwareKeyPressed); this.AddHardwareKeyListener("ф", OnHardwareKeyPressed); this.AddHardwareKeyListener("A", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("`", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("~", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("1", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("!", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("2", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("@", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("3", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("#", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("4", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("$", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("5", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("%", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("6", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("^", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("7", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("&", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("8", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("*", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("9", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("(", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("0", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(")", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("-", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("_", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("+", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("=", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("0", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(")", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("[", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("{", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("]", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("}", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("\\", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("|", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(";", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(":", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("'", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("\"", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(",", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("<", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(".", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(">", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("/", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener("?", HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.UpArrowKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.DownArrowKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.LeftArrowKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.RightArrowKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.EscapeKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.BackspaceDeleteKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.ForwardDeleteKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.InsertKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.TabKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.EnterReturnKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.PageUpKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.PageDownKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.HomeKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.EndKeyInput, HardwareKeyModifierKeys.Any, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.UpArrowKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.DownArrowKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.LeftArrowKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.RightArrowKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.EscapeKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.BackspaceDeleteKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.ForwardDeleteKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.InsertKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.TabKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.EnterReturnKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.PageUpKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.PageDownKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.HomeKeyInput, OnHardwareKeyPressed); this.AddHardwareKeyListener(HardwareKey.EndKeyInput, OnHardwareKeyPressed); #endregion #region ... for _entry _entry.AddHardwareKeyListener(HardwareKey.UpArrowKeyInput, OnHardwareKeyPressed); _entry.AddHardwareKeyListener(HardwareKey.DownArrowKeyInput, OnHardwareKeyPressed); _entry.AddHardwareKeyListener(HardwareKey.LeftArrowKeyInput, OnHardwareKeyPressed); _entry.AddHardwareKeyListener(HardwareKey.RightArrowKeyInput, OnHardwareKeyPressed); _entry.AddHardwareKeyListener(HardwareKey.EscapeKeyInput, OnHardwareKeyPressed); #endregion #region ... for _editor _editor.AddHardwareKeyListener(HardwareKey.UpArrowKeyInput, OnHardwareKeyPressed); _editor.AddHardwareKeyListener(HardwareKey.DownArrowKeyInput, OnHardwareKeyPressed); _editor.AddHardwareKeyListener(HardwareKey.LeftArrowKeyInput, OnHardwareKeyPressed); _editor.AddHardwareKeyListener(HardwareKey.RightArrowKeyInput, OnHardwareKeyPressed); _editor.AddHardwareKeyListener(HardwareKey.EscapeKeyInput, OnHardwareKeyPressed); #endregion #region ... for _label _label.AddHardwareKeyListener(HardwareKey.UpArrowKeyInput, OnHardwareKeyPressed); _label.AddHardwareKeyListener(HardwareKey.DownArrowKeyInput, OnHardwareKeyPressed); _label.AddHardwareKeyListener(HardwareKey.LeftArrowKeyInput, OnHardwareKeyPressed); _label.AddHardwareKeyListener(HardwareKey.RightArrowKeyInput, OnHardwareKeyPressed); _label.AddHardwareKeyListener(HardwareKey.EscapeKeyInput, OnHardwareKeyPressed); #endregion #region ... for _button _button.AddHardwareKeyListener(HardwareKey.UpArrowKeyInput, OnHardwareKeyPressed); _button.AddHardwareKeyListener(HardwareKey.DownArrowKeyInput, OnHardwareKeyPressed); _button.AddHardwareKeyListener(HardwareKey.LeftArrowKeyInput, OnHardwareKeyPressed); _button.AddHardwareKeyListener(HardwareKey.RightArrowKeyInput, OnHardwareKeyPressed); _button.AddHardwareKeyListener(HardwareKey.EscapeKeyInput, OnHardwareKeyPressed); #endregion #endregion #region layout Padding = new Thickness(5, 25, 5, 5); Content = new Xamarin.Forms.ScrollView { Content = new Xamarin.Forms.StackLayout { Children = { _label, _editor, _entry, _button, new Xamarin.Forms.Label { Text = "Focus:" }, _segmentedControl, new BoxView { Color = Color.Black,HeightRequest = 2 }, _focusLabel, new BoxView { Color = Color.Black,HeightRequest = 2 }, _defaultFocusLabel, new BoxView { Color = Color.Black,HeightRequest = 2 }, _inputLabel, _modifiersLabel, _keyboardType } } }; #endregion #region Event Handlers // NOTE: The only elements that change the focus are Entry and Editor. As such, if we want to change focus when a user takes an action other then selecting an Editor or Entry, we have change the focus ourselves. _segmentedControl.SegmentTapped += (sender, e) => { switch (e.Segment.Text) { case "label": _label.HardwareKeyFocus(); break; case "editor": _editor.HardwareKeyFocus(); break; case "entry": _entry.HardwareKeyFocus(); break; case "button": _button.HardwareKeyFocus(); break; } }; Forms9Patch.HardwareKeyPage.FocusedElementChanged += (sender, e) => { _defaultFocusLabel.Text = "HardwareKeyPage.DefaultFocusedElement: " + Forms9Patch.HardwareKeyPage.DefaultFocusedElement; _focusLabel.Text = "HardwareKeyPage.FocusedElement: " + sender; if (sender == _label) { _segmentedControl.SelectIndex(0); } else if (sender == _editor) { _segmentedControl.SelectIndex(1); } else if (sender == _entry) { _segmentedControl.SelectIndex(2); } else if (sender == _button) { _segmentedControl.SelectIndex(3); } else { _segmentedControl.DeselectAll(); } }; _button.Clicked += async(object sender, EventArgs e) => { if (modal) { await Navigation.PopModalAsync(); } else { await Navigation.PopAsync(); } }; // NOTE: The only elements that change the focus are Entry and Editor. As such, if we want to change focus when a user takes an action other then selecting an Editor or Entry, we have change the focus ourselves. var labelGestureListener = FormsGestures.Listener.For(_label); labelGestureListener.Tapped += (s, e) => _label.HardwareKeyFocus(); // NOTE: The only elements that change the focus are Entry and Editor. As such, if we want to change focus when a user takes an action other then selecting an Editor or Entry, we have change the focus ourselves. var pageGestureListener = FormsGestures.Listener.For(this); pageGestureListener.Tapped += (s, e) => Forms9Patch.HardwareKeyPage.FocusedElement = null; #endregion }
public PlatformSpecificsPageCS() { var blurButton = new Button { Text = "Blur Effect (iOS only)" }; blurButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSBlurEffectPageCS()); var largeTitleButton = new Button { Text = "Large Title Display (iOS only)" }; largeTitleButton.Clicked += (sender, e) => { var navigationPage = new Xamarin.Forms.NavigationPage(new iOSLargeTitlePageCS(new Command(RestoreOriginal))); navigationPage.On <iOS>().SetPrefersLargeTitles(true); SetRoot(navigationPage); }; var safeAreaButton = new Button { Text = "Safe Area Layout Guide (iOS only)" }; safeAreaButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSSafeAreaPageCS()); var translucentButton = new Button { Text = "Translucent Navigation Bar (iOS only) " }; translucentButton.Clicked += (sender, e) => SetRoot(new Xamarin.Forms.NavigationPage(new iOSTranslucentNavigationBarPageCS(new Command(RestoreOriginal)))); var entryButton = new Button { Text = "Entry Font Size Adjusts to Text Width (iOS only)" }; entryButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSEntryPageCS()); var hideStatusBarButton = new Button { Text = "Hide Status Bar (iOS only) " }; hideStatusBarButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSStatusBarPageCS()); var pickerUpdateModeButton = new Button { Text = "Picker UpdateMode (iOS only)" }; pickerUpdateModeButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSPickerPageCS()); var scrollViewButton = new Button { Text = "ScrollView DelayContentTouches (iOS only)" }; scrollViewButton.Clicked += (sender, e) => SetRoot(new iOSScrollViewPageCS(new Command(RestoreOriginal))); var statusBarTextColorModeButton = new Button { Text = "Navigation Page Status Bar Text Color Mode (iOS only)" }; statusBarTextColorModeButton.Clicked += (sender, e) => SetRoot(new iOSStatusBarTextColorModePageCS(new Command(RestoreOriginal))); var inputModeButton = new Button { Text = "Soft Input Mode Adjust (Android only)" }; inputModeButton.Clicked += async(sender, e) => await Navigation.PushAsync(new AndroidSoftInputModeAdjustPageCS()); var lifecycleEventsButton = new Button { Text = "Pause and Resume Lifecycle Events (Android only)" }; lifecycleEventsButton.Clicked += async(sender, e) => await Navigation.PushAsync(new AndroidLifecycleEventsPageCS()); var tabbedPageSwipeButton = new Button { Text = "Tabbed Page Swipe (Android only)" }; tabbedPageSwipeButton.Clicked += (sender, e) => SetRoot(new AndroidTabbedPageSwipePageCS(new Command(RestoreOriginal))); var listViewFastScrollButton = new Button { Text = "ListView FastScroll (Android only)" }; listViewFastScrollButton.Clicked += async(sender, e) => await Navigation.PushAsync(new AndroidListViewFastScrollPageCS()); var elevationButton = new Button { Text = "Elevation (Android only)" }; elevationButton.Clicked += async(sender, e) => await Navigation.PushAsync(new AndroidElevationPageCS()); var tabbedPageButton = new Button { Text = "Tabbed Page Toolbar Location Adjust (Windows only)" }; tabbedPageButton.Clicked += (sender, e) => SetRoot(new WindowsTabbedPageCS(new Command(RestoreOriginal))); var navigationPageButton = new Button { Text = "Navigation Page Toolbar Location Adjust (Windows only)" }; navigationPageButton.Clicked += (sender, e) => SetRoot(new WindowsNavigationPageCS(new Command(RestoreOriginal))); var masterDetailPageButton = new Button { Text = "Master Detail Page Toolbar Location Adjust (Windows only)" }; masterDetailPageButton.Clicked += (sender, e) => SetRoot(new WindowsMasterDetailPageCS(new Command(RestoreOriginal))); Title = "Platform Specifics Demo"; Content = new Xamarin.Forms.ScrollView { Content = new StackLayout { Margin = new Thickness(20), Children = { blurButton, largeTitleButton, safeAreaButton, translucentButton, entryButton, hideStatusBarButton, pickerUpdateModeButton, scrollViewButton, statusBarTextColorModeButton, inputModeButton, lifecycleEventsButton, tabbedPageSwipeButton, listViewFastScrollButton, elevationButton, tabbedPageButton, navigationPageButton, masterDetailPageButton } } }; }
public LoginPage() { ViewModel.LoginFailed += HandleLoginFailed; ViewModel.LoginApproved += HandleLoginApproved; BackgroundColor = Color.FromHex("#3498db"); Padding = GetPagePadding(); _logo = new Image { Source = "xamarin_logo" }; _logoSlogan = new StyledLabel { Opacity = 0, Text = "Login to your account with facial recognition.", }; _usernameEntry = new StyledEntry { Placeholder = "Username", ReturnType = ReturnType.Next, ReturnCommand = new Command(() => _passwordEntry.Focus()) }; _usernameEntry.SetBinding(Xamarin.Forms.Entry.TextProperty, nameof(ViewModel.UsernameEntryText)); _passwordEntry = new StyledEntry { Placeholder = "Password", IsPassword = true, ReturnType = ReturnType.Done }; _passwordEntry.SetBinding(Xamarin.Forms.Entry.TextProperty, nameof(ViewModel.PasswordEntryText)); _passwordEntry.SetBinding(Xamarin.Forms.Entry.ReturnCommandProperty, nameof(ViewModel.LoginButtonTappedCommand)); _loginButton = new StyledButton(Borders.Thin) { Text = "Login" }; _loginButton.SetBinding(IsEnabledProperty, nameof(ViewModel.IsInternetConnectionInactive)); _loginButton.SetBinding(Button.CommandProperty, nameof(ViewModel.LoginButtonTappedCommand)); _newUserSignUpButton = new StyledButton(Borders.None) { Text = "Sign-up" }; _newUserSignUpButton.Clicked += HandleNewUserSignUpButtonClicked; _newUserSignUpButton.SetBinding(IsEnabledProperty, nameof(ViewModel.IsInternetConnectionInactive)); var activityIndicator = new ActivityIndicator { Color = Color.White }; activityIndicator.SetBinding(IsVisibleProperty, nameof(ViewModel.IsInternetConnectionActive)); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(ViewModel.IsInternetConnectionActive)); On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); Func <RelativeLayout, double> getNewUserButtonWidth = (p) => _newUserSignUpButton.Measure(p.Width, p.Height).Request.Width; Func <RelativeLayout, double> getLogoSloganWidth = (p) => _logoSlogan.Measure(p.Width, p.Height).Request.Width; Func <RelativeLayout, double> getActivityIndicatorHeight = (p) => activityIndicator.Measure(p.Width, p.Height).Request.Height; Func <RelativeLayout, double> getActivityIndicatorWidth = (p) => activityIndicator.Measure(p.Width, p.Height).Request.Width; _relativeLayout = new RelativeLayout(); _relativeLayout.Children.Add( _logo, xConstraint: Constraint.Constant(100), yConstraint: Constraint.Constant(250), widthConstraint: Constraint.RelativeToParent(p => p.Width - 200) ); _relativeLayout.Children.Add( _logoSlogan, xConstraint: Constraint.RelativeToParent(p => (p.Width / 2) - (getLogoSloganWidth(p) / 2)), yConstraint: Constraint.Constant(125) ); _relativeLayout.Children.Add( _usernameEntry, xConstraint: Constraint.Constant(40), yConstraint: Constraint.RelativeToView(_logoSlogan, (p, v) => v.Y + v.Height + _relativeLayoutPadding), widthConstraint: Constraint.RelativeToParent(p => p.Width - 80) ); _relativeLayout.Children.Add( _passwordEntry, xConstraint: Constraint.Constant(40), yConstraint: Constraint.RelativeToView(_usernameEntry, (p, v) => v.Y + v.Height + _relativeLayoutPadding), widthConstraint: Constraint.RelativeToParent(p => p.Width - 80) ); _relativeLayout.Children.Add( _loginButton, xConstraint: Constraint.Constant(40), yConstraint: Constraint.RelativeToView(_passwordEntry, (p, v) => v.Y + v.Height + _relativeLayoutPadding), widthConstraint: Constraint.RelativeToParent(p => p.Width - 80) ); _relativeLayout.Children.Add( _newUserSignUpButton, xConstraint: Constraint.RelativeToParent(p => (p.Width / 2) - (getNewUserButtonWidth(p) / 2)), yConstraint: Constraint.RelativeToView(_loginButton, (p, v) => v.Y + _loginButton.Height + 15) ); _relativeLayout.Children.Add(activityIndicator, xConstraint: Constraint.RelativeToParent(parent => parent.Width / 2 - getActivityIndicatorWidth(parent) / 2), yConstraint: Constraint.RelativeToParent(parent => parent.Height / 2 - getActivityIndicatorHeight(parent) / 2)); Content = new Xamarin.Forms.ScrollView { Content = _relativeLayout }; }
public LoginPage() { ViewModel.LoginFailed += HandleLoginFailed; ViewModel.LoginApproved += HandleLoginApproved; BackgroundColor = Color.FromHex("#3498db"); Padding = GetPagePadding(); _logo = new Image { Source = "xamarin_logo" }; _passwordEntry = new StyledEntry { Placeholder = "Password", IsPassword = true, ReturnType = ReturnType.Done }; _passwordEntry.SetBinding(Xamarin.Forms.Entry.TextProperty, nameof(LoginViewModel.PasswordEntryText)); _passwordEntry.SetBinding(Xamarin.Forms.Entry.ReturnCommandProperty, nameof(LoginViewModel.LoginButtonTappedCommand)); _logoSlogan = new StyledLabel { Opacity = 0, Text = "Delighting Developers.", }; _usernameEntry = new StyledEntry { Placeholder = "Username", ReturnType = ReturnType.Next, ReturnCommand = new Command(() => _passwordEntry.Focus()) }; _usernameEntry.SetBinding(Xamarin.Forms.Entry.TextProperty, nameof(LoginViewModel.UsernameEntryText)); _loginButton = new StyledButton(Borders.Thin) { Text = "Login" }; _loginButton.SetBinding(IsEnabledProperty, nameof(LoginViewModel.IsInternetConnectionInactive)); _loginButton.SetBinding(Button.CommandProperty, nameof(LoginViewModel.LoginButtonTappedCommand)); _newUserSignUpButton = new StyledButton(Borders.None) { Text = "Sign-up" }; _newUserSignUpButton.Clicked += HandleNewUserSignUpButtonClicked; _newUserSignUpButton.SetBinding(IsEnabledProperty, nameof(LoginViewModel.IsInternetConnectionInactive)); var activityIndicator = new ActivityIndicator { Color = Color.White }; activityIndicator.SetBinding(IsVisibleProperty, nameof(LoginViewModel.IsInternetConnectionActive)); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(LoginViewModel.IsInternetConnectionActive)); On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); _relativeLayout = new RelativeLayout(); _relativeLayout.Children.Add(_logo, Constraint.Constant(100), Constraint.Constant(250), Constraint.RelativeToParent(parent => parent.Width - 200)); _relativeLayout.Children.Add(_logoSlogan, Constraint.RelativeToParent(parent => parent.Width / 2 - getWidth(parent, _logoSlogan) / 2), Constraint.Constant(125)); _relativeLayout.Children.Add(_usernameEntry, Constraint.Constant(40), Constraint.RelativeToView(_logoSlogan, (parent, view) => view.Y + view.Height + _relativeLayoutPadding), Constraint.RelativeToParent(parent => parent.Width - 80)); _relativeLayout.Children.Add(_passwordEntry, Constraint.Constant(40), Constraint.RelativeToView(_usernameEntry, (parent, view) => view.Y + view.Height + _relativeLayoutPadding), Constraint.RelativeToParent(parent => parent.Width - 80)); _relativeLayout.Children.Add(_loginButton, Constraint.Constant(40), Constraint.RelativeToView(_passwordEntry, (parent, view) => view.Y + view.Height + _relativeLayoutPadding), Constraint.RelativeToParent(parent => parent.Width - 80)); _relativeLayout.Children.Add(_newUserSignUpButton, Constraint.RelativeToParent(parent => parent.Width / 2 - getWidth(parent, _newUserSignUpButton) / 2), Constraint.RelativeToView(_loginButton, (parent, view) => view.Y + getHeight(parent, _loginButton) + 15)); _relativeLayout.Children.Add(activityIndicator, Constraint.RelativeToParent(parent => parent.Width / 2 - getWidth(parent, activityIndicator) / 2), Constraint.RelativeToParent(parent => parent.Height / 2 - getHeight(parent, activityIndicator) / 2)); Content = new Xamarin.Forms.ScrollView { Content = _relativeLayout };
public PopupsPage() { Padding = 20; _hzLayoutOptions.SelectIndex(1); _vtLayoutOptions.SelectIndex(1); #region ModalPopup cancelModalButton.Clicked += async(sender, e) => await _modalPopup.CancelAsync(); popPushModalButton.Clicked += (sender, e) => { _modalPopup.IsVisible = false; _modalPopup.IsVisible = true; }; showModalButton.Clicked += (sender, e) => { _modalPopup.HasShadow = _hasShadow; _modalPopup.ShadowInverted = _shadowInverted; _modalPopup.OutlineWidth = _blueOutline ? 1 : 0; _modalPopup.IsVisible = true; _modalPopup.HorizontalOptions = LayoutOption(_hzLayoutOptions); _modalPopup.VerticalOptions = LayoutOption(_vtLayoutOptions); }; #endregion #region BubblePopups var showBubbleLeftButton = new Forms9Patch.Button(bubbleLeftText) { BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center }; var showBubbleRightButton = new Forms9Patch.Button(bubbleRightText) { BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center }; var showBubbleUpButton = new Forms9Patch.Button(bubbleUpText) { BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center }; var showBubbleDownButton = new Forms9Patch.Button(bubbleDownText) { BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center }; var showBubbleHzButton = new Forms9Patch.Button(bubbleHzText) { BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center }; var showBubbleVtButton = new Forms9Patch.Button(bubbleVtText) { BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center }; var showBubbleAnyButton = new Forms9Patch.Button(bubbleAnyText) { BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center }; var showBubbleNoneButton = new Forms9Patch.Button(bubbleNoneText) { BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center }; var bubblePointerDirectionControl = new SegmentedControl { Segments = { new Segment("←"), new Segment("↑"), new Segment("→"), new Segment("↓"), new Segment("↔"), new Segment("↕"), new Segment("↔ ↕"), new Segment(" ") }, SyncSegmentFontSizes = false, }; var cancelBubbleButton = new Forms9Patch.Button("CANCEL"); var bubbleTarget = new Forms9Patch.Frame { OutlineWidth = 1, OutlineColor = Color.Black, OutlineRadius = 4, Content = new Forms9Patch.Label("BUBBLE TARGET"), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; bubble = new BubblePopup(bubbleTarget) { Content = new Xamarin.Forms.StackLayout { Children = { new Forms9Patch.Label("BubblePopup") { FontAttributes = FontAttributes.Bold }, bubblePointerDirectionControl, cancelBubbleButton }, }, }; bubblePointerDirectionControl.SegmentTapped += (sender, e) => { switch (e.Segment.Text) { case "←": bubble.PointerDirection = PointerDirection.Left; break; case "↑": bubble.PointerDirection = PointerDirection.Up; break; case "→": bubble.PointerDirection = PointerDirection.Right; break; case "↓": bubble.PointerDirection = PointerDirection.Down; break; case "↔": bubble.PointerDirection = PointerDirection.Horizontal; break; case "↕": bubble.PointerDirection = PointerDirection.Vertical; break; case "↔↕": bubble.PointerDirection = PointerDirection.Any; break; case " ": bubble.PointerDirection = PointerDirection.None; break; } }; cancelBubbleButton.Clicked += async(sender, e) => await bubble.CancelAsync(); showBubbleLeftButton.Clicked += OnBubbleButtonClicked; showBubbleRightButton.Clicked += OnBubbleButtonClicked; showBubbleUpButton.Clicked += OnBubbleButtonClicked; showBubbleDownButton.Clicked += OnBubbleButtonClicked; showBubbleHzButton.Clicked += OnBubbleButtonClicked; showBubbleVtButton.Clicked += OnBubbleButtonClicked; showBubbleAnyButton.Clicked += OnBubbleButtonClicked; showBubbleNoneButton.Clicked += OnBubbleButtonClicked; #endregion #region ActivityPopup Forms9Patch.Button showActivityPopupButton = new Forms9Patch.Button("ActivityIndicatorPopup") { BackgroundColor = Color.White }; showActivityPopupButton.Clicked += (sender, e) => { //var activity = Forms9Patch.ActivityIndicatorPopup.Create(); _activity.CancelOnPageOverlayTouch = true; _activity.IsVisible = true; }; #endregion #region PermissionPopup var showPermissionButton = new Forms9Patch.Button("PermissionPopup") { BackgroundColor = Color.White }; showPermissionButton.Clicked += (sender, e) => { var permission = PermissionPopup.Create("PermissionPopup", "Do you agree?"); permission.HorizontalOptions = LayoutOption(_hzLayoutOptions); permission.VerticalOptions = LayoutOption(_vtLayoutOptions); permission.OutlineColor = Color.Blue; permission.HasShadow = _hasShadow; permission.ShadowInverted = _shadowInverted; permission.OutlineWidth = _blueOutline ? 1 : 0; }; #endregion #region Toast var showToastButton = new Forms9Patch.Button("Toast") { BackgroundColor = Color.White }; showToastButton.Clicked += (sender, e) => { var toast = Toast.Create("Toast", "... of the town!"); toast.OutlineColor = Color.Blue; toast.HasShadow = _hasShadow; toast.ShadowInverted = _shadowInverted; toast.OutlineWidth = _blueOutline ? 1 : 0; toast.HorizontalOptions = LayoutOption(_hzLayoutOptions); toast.VerticalOptions = LayoutOption(_vtLayoutOptions); }; #endregion #region TargetedToast var showTargetedToash = new Forms9Patch.Button("TargetedToast") { BackgroundColor = Color.White }; showTargetedToash.Clicked += (sender, e) => { var toast = TargetedToast.Create(showTargetedToash, "TargetedToast", "... has the far getted most!"); toast.OutlineColor = Color.Blue; toast.HasShadow = _hasShadow; toast.ShadowInverted = _shadowInverted; toast.OutlineWidth = _blueOutline ? 1 : 0; toast.HorizontalOptions = LayoutOption(_hzLayoutOptions); toast.VerticalOptions = LayoutOption(_vtLayoutOptions); }; #endregion #region TargetedMenu showTargetedMenu = new Forms9Patch.Button("TargetedMenu") { BackgroundColor = Color.White }; var targetedMenu = new Forms9Patch.TargetedMenu(showTargetedMenu) { Segments = { new Segment("Copy", "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>"), new Segment("Cut", "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>"), new Segment("Paste", "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>"), new Segment("Segment A"), new Segment("Segment B"), new Segment("Segment C"), new Segment("Segment D"), new Segment("Segment E"), new Segment("Segment F"), new Segment("Segment G"), new Segment("Segment H"), }, TextColor = Color.White }; showTargetedMenu.Clicked += (s, e) => { targetedMenu.IsVisible = true; targetedMenu.HasShadow = _hasShadow; targetedMenu.ShadowInverted = _shadowInverted; targetedMenu.IsVisible = true; }; targetedMenu.SegmentTapped += (s, e) => System.Diagnostics.Debug.WriteLine("TargetedMenu.SegmentTapped: " + e.Segment.Text); #endregion #region Vertical TargetedMenu var showVerticalTargetedMenu = new Forms9Patch.Button("Vertical TargetedMenu") { BackgroundColor = Color.White }; var verticalTargetedMenu = new Forms9Patch.TargetedMenu(showVerticalTargetedMenu) { Orientation = StackOrientation.Vertical, Segments = { new Segment("Copy", "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>"), new Segment("Cut", "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>"), new Segment("Paste", "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>"), new Segment("Segment A"), new Segment("Segment B"), new Segment("Segment C"), new Segment("Segment D"), new Segment("Segment E"), new Segment("Segment F"), new Segment("Segment G"), new Segment("Segment H"), }, }; showVerticalTargetedMenu.Clicked += (s, e) => { //verticalTargetedMenu.OutlineColor = Color.Blue; verticalTargetedMenu.IsVisible = true; verticalTargetedMenu.HasShadow = _hasShadow; verticalTargetedMenu.ShadowInverted = _shadowInverted; verticalTargetedMenu.IsVisible = true; }; verticalTargetedMenu.SegmentTapped += (s, e) => System.Diagnostics.Debug.WriteLine("TargetedMenu.SegmentTapped: " + e.Segment.Text); #endregion #region SoftwareKeyboardTest var yearPicker = new Xamarin.Forms.Picker { Title = "SELECT YEAR", ItemsSource = new List <string> { "SELECT YEAR", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2006", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020" }, SelectedItem = "SELECT YEAR", SelectedIndex = 0, TextColor = Color.LightGray, }; yearPicker.SelectedIndexChanged += (s, e) => yearPicker.TextColor = yearPicker.SelectedIndex == 0 ? Color.LightGray : Color.Blue; var monthPicker = new Xamarin.Forms.Picker { Title = "SELECT MONTH", ItemsSource = new List <string> { "SELECT MONTH", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }, SelectedItem = "SELECT MONTH", TextColor = Color.LightGray, }; monthPicker.SelectedIndexChanged += (s, e) => monthPicker.TextColor = monthPicker.SelectedIndex == 0 ? Color.LightGray : Color.Blue; var softwareKeyboardTestButton = new Forms9Patch.Button("Software Keyboard Test") { BackgroundColor = Color.White }; var softwareKeyboardTestPopup = new ModalPopup { HorizontalOptions = LayoutOption(_hzLayoutOptions), VerticalOptions = LayoutOption(_vtLayoutOptions), Content = new Xamarin.Forms.StackLayout { Children = { yearPicker, monthPicker, new Xamarin.Forms.Entry { Placeholder = "ENTER FIRST NAME", TextColor = Color.Blue, PlaceholderColor = Color.LightGray, }, new Xamarin.Forms.Entry { Placeholder = "ENTER LAST NAME", TextColor = Color.Blue, PlaceholderColor = Color.LightGray, }, } } }; softwareKeyboardTestButton.Clicked += (s, e) => { softwareKeyboardTestPopup.OutlineColor = Color.Blue; softwareKeyboardTestPopup.HasShadow = _hasShadow; softwareKeyboardTestPopup.ShadowInverted = _shadowInverted; softwareKeyboardTestPopup.OutlineWidth = _blueOutline ? 1 : 0; softwareKeyboardTestPopup.IsVisible = true; softwareKeyboardTestPopup.HorizontalOptions = LayoutOption(_hzLayoutOptions); softwareKeyboardTestPopup.VerticalOptions = LayoutOption(_vtLayoutOptions); }; #endregion Content = new Xamarin.Forms.ScrollView { Content = new Xamarin.Forms.StackLayout { Children = { new BoxView { HeightRequest = 1 }, _decoration, new Forms9Patch.Label("HZ LAYOUT ALIGNMENT:"), _hzLayoutOptions, new Forms9Patch.Label("VT LAYOUT ALIGNMENT:"), _vtLayoutOptions, new BoxView { HeightRequest = 1 }, showModalButton, showBubbleLeftButton, showBubbleRightButton, showBubbleUpButton, showBubbleDownButton, showBubbleHzButton, showBubbleVtButton, showBubbleAnyButton, showBubbleNoneButton, bubbleTarget, showActivityPopupButton, showPermissionButton, showToastButton, showTargetedToash, showTargetedMenu, showVerticalTargetedMenu, softwareKeyboardTestButton, new BoxView { HeightRequest = 1 }, } } }; _decoration.SegmentTapped += (s, e) => { switch (e.Segment.Text) { case _hasShadowText: _hasShadow = !_hasShadow; break; case _shadowInvertedText: _shadowInverted = !_shadowInverted; break; case _blueOutlineText: _blueOutline = !_blueOutline; break; } }; BackgroundColor = Color.LightSlateGray; }
//METHODS /********************************************************************** *********************************************************************/ void CreateContent() { var scrollView = new Xamarin.Forms.ScrollView { Margin = new Thickness(10) }; var stackLayout = new StackLayout(); var stackLayout2 = new StackLayout { Orientation = StackOrientation.Horizontal }; var stackLayout3 = new StackLayout { Orientation = StackOrientation.Horizontal }; this.Content = scrollView; scrollView.Content = stackLayout; //Wrap ScrollView around StackLayout to be able to scroll the content //define and add elements to stacklayout var l_Strategy = new Label { Text = "Strategy", FontSize = App._h3FontSize }; p_Strategy = new Xamarin.Forms.Picker() { FontSize = App._textFontSize }; p_Strategy.Items.Add("Go Back N"); p_Strategy.Items.Add("Selective Repeat"); p_Strategy.SelectedIndex = 0;//Go Back N var l_Space = new Label { Text = " " }; var l_WindowSize = new Label { Text = "Window Size", FontSize = App._h3FontSize }; p_WindowSize = new Xamarin.Forms.Picker() { FontSize = App._textFontSize }; p_WindowSize.Items.Add("2"); p_WindowSize.Items.Add("3"); p_WindowSize.Items.Add("4"); p_WindowSize.Items.Add("5"); p_WindowSize.SelectedIndex = 3;//5 var l_Space2 = new Label { Text = " " }; var l_Timeout = new Label { Text = "Timeout =", FontSize = App._h3FontSize }; l_TimeoutValue = new Label { Text = "11", VerticalOptions = LayoutOptions.Center, FontSize = App._textFontSize }; s_Timeout = new Xamarin.Forms.Slider(11, 20, 11); //min, max, val s_Timeout.HorizontalOptions = LayoutOptions.FillAndExpand; s_Timeout.ValueChanged += S_Timeout_ValueChanged;; //s_Timeout.Minimum = 0.0f; //minimum roundtrip time //s_Timeout.Maximum = 10.0f; //maximum roundtrip time var l_TimeoutMi = new Label { VerticalOptions = LayoutOptions.Center, FontSize = App._textFontSize, Text = "11" }; var l_TimeoutMa = new Label { VerticalOptions = LayoutOptions.Center, FontSize = App._textFontSize, Text = "20" }; var l_RoundtripTime = new Label { FontSize = App._smallTextFontSize, Text = "Round Trip Time: 10" }; var l_Space3 = new Label { Text = " " }; var b_Start = new Button { Text = "Start", BackgroundColor = App._buttonBackground, TextColor = App._buttonText, CornerRadius = App._buttonCornerRadius, FontSize = App._buttonFontSize }; b_Start.Clicked += B_Start_Clicked; //add Click Event(Method) stackLayout3.Children.Add(l_Timeout); stackLayout3.Children.Add(l_TimeoutValue); stackLayout2.Children.Add(l_TimeoutMi); stackLayout2.Children.Add(s_Timeout); stackLayout2.Children.Add(l_TimeoutMa); stackLayout.Children.Add(l_Strategy); stackLayout.Children.Add(p_Strategy); stackLayout.Children.Add(l_Space); stackLayout.Children.Add(l_WindowSize); stackLayout.Children.Add(p_WindowSize); stackLayout.Children.Add(l_Space2); stackLayout.Children.Add(stackLayout3); stackLayout.Children.Add(stackLayout2); stackLayout.Children.Add(l_RoundtripTime); stackLayout.Children.Add(l_Space3); stackLayout.Children.Add(b_Start); }
//................Structure..................................// // Grid - Main grid containing 2 rows // ScrollView(_tabScrolling) - Contains grid with 1 row. // Grid(_tabHeaderHolder) - Used to hold tabHeader and selectedTabhighlighter // Stacklayout(_tabHeaderStack) - Contains _tabHeader // RelativeLayout(_selectedTabIndicatorHolder) - Contains _selectedTabIndicator, will be drawn according to selected tab // Frame(_tabContent) - Hold tab content and change the content according to selected tab //................Structure..................................// public Tab() { //Declaring the main grid this.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Star } }; this.RowSpacing = 0; this.Padding = 0; _tabScrolling = new Xamarin.Forms.ScrollView(); _tabScrolling.Orientation = ScrollOrientation.Horizontal; _tabScrolling.SetValue(Grid.RowProperty, 0); _tabScrolling.SetValue(ScrollViewPoperty.HorizontalScrollBarVisibleProperty, false); _tabHeaderHolder = new Grid(); _tabHeaderHolder.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = 2 } }; _tabHeaderHolder.RowSpacing = 0; _tabHeaderStack = new StackLayout(); _tabHeaderStack.Orientation = StackOrientation.Horizontal; _tabHeaderStack.Spacing = 0; _tabHeaderHolder.Children.Add(_tabHeaderStack); _selectedTabIndicator = new BoxView(); _selectedTabIndicator.HeightRequest = Device.OnPlatform <double>(3, 2, 0); _seperator = new BoxView(); _seperator.HeightRequest = 1; _seperator.VerticalOptions = LayoutOptions.End; _seperator.SetValue(Grid.RowProperty, 1); _tabHeaderHolder.Children.Add(_seperator); _selectedTabIndicatorHolder = new RelativeLayout(); _selectedTabIndicatorHolder.BackgroundColor = Color.Transparent; _selectedTabIndicatorHolder.SetValue(Grid.RowProperty, 1); _selectedTabIndicatorHolder.VerticalOptions = LayoutOptions.End; _selectedTabIndicatorHolder.Children.Add(_selectedTabIndicator, xConstraint: null); //Adding _selectedTabHolder(RelativeLayout) as a child to _tabHeaderHolder(Grid) _tabHeaderHolder.Children.Add(_selectedTabIndicatorHolder); //Adding _tabHeaderHolder(Grid) as a content to _tabScrolling(ScrollView) _tabScrolling.Content = _tabHeaderHolder; this.Children.Add(_tabScrolling); //Generating frame to hold tab item content _tabContent = new Frame(); _tabContent.Padding = 0; _tabContent.OutlineColor = Color.Transparent; _tabContent.HasShadow = false; _tabContent.SetValue(Grid.RowProperty, 1); _tabContent.HorizontalOptions = LayoutOptions.FillAndExpand; _tabContent.VerticalOptions = LayoutOptions.FillAndExpand; //Adding tabContent to main grid row 1 this.Children.Add(_tabContent); this.TabItems.CollectionChanged += (s, e) => { // TODO: Processing assumes first element in NewItem is always new, no code to process removal of child. var tabItem = e.NewItems[0] as TabItem; if (tabItem == null) { return; } var tabItemButton = new Button(); tabItemButton.Margin = 0; tabItemButton.BackgroundColor = Color.Transparent; tabItemButton.BorderRadius = 1; tabItemButton.SetValue(ButtonProperty.PaddingProperty, new Thickness(6, 5)); //tabItemButton.SetValue(ResponsiveProperty.ClassProperty, "btn-sm"); tabItemButton.Text = (e.NewItems[0] as TabItem).Title.ToUpper(); tabItemButton.TextColor = TabHeaderTextColor; tabItemButton.Clicked += (sender, args) => { //Handling Clicked event for the tab item if (_lastSelectedItem != tabItem) { foreach (var item in TabItems) { item.IsSelected = false; } tabItem.IsSelected = true; this._lastSelectedItem = tabItem; //Draw seleted tab highlighter DrawSelectedTab(sender, tabItem); } }; _tabHeaderStack.Children.Add(tabItemButton); }; this.SizeChanged += (sender, args) => { if (!this.TabItems.Any(o => o.IsSelected)) { if (_lastSelectedItem != TabItems[0]) { TabItems[0].IsSelected = true; } } for (int i = 0; i < TabItems.Count; i++) { if (TabItems[i].IsSelected) { DrawSelectedTab(_tabHeaderStack.Children[i], TabItems[i]); _lastSelectedItem = TabItems[i]; break; } } }; }
public MainApp_Android() { // InitializeComponent(); var screen = DependencyService.Get <UIScreen>(); var padding = new Thickness(20, Device.OnPlatform(40, 40, 0), 10, 10); SetFontSize(); SetupBlueTooth(); DisplayListOfBluetoothDevices(); SetTapGestures(); //Common Lables Label Spacer = new Label(); Spacer.FontSize = _fontSizeMicro; Spacer.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; Spacer.Text = " "; #region ServerPage var ServerPage = new ContentPage(); var Content = new StackLayout(); Content.VerticalOptions = LayoutOptions.Start; // Label _testLabel = new Label(); _testLabel.FontSize = 24; _testLabel.FontAttributes = FontAttributes.Bold; _testLabel.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; _testLabel.Text = "Bluetooth setup :"; _testLabel.GestureRecognizers.Add(_tapConnect); //ListView var listView = new Xamarin.Forms.ListView(); listView.ItemsSource = _bluetoothDevices; listView.ItemSelected += OnSelectedBluetoothDevice; _startServerButton.Text = "Start Server"; _startServerButton.Clicked += StartServer_Clicked; Content.Children.Add(_testLabel); Content.Children.Add(listView); Content.Children.Add(_startServerButton); ServerPage.Content = Content; ServerPage.AnchorX = 0; #endregion #region Gartner Label var Circle = new ContentPage { //Padding = padding, Title = "Circle", Content = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Image { Aspect = Aspect.Fill, Source = ImageSource.FromFile("circle.png"), WidthRequest = 675, HeightRequest = 500 } } } }; Circle.AnchorX = 1; #endregion #region Gartner Basic Info var ScalePage = new ContentPage(); var ContentScalePage = new StackLayout(); ContentScalePage.VerticalOptions = LayoutOptions.Start; // Title Label SP1 = new Label(); SP1.FontSize = _fontSizeMed; SP1.FontAttributes = FontAttributes.Italic; SP1.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; SP1.TextColor = Color.Teal; SP1.BackgroundColor = Color.Silver; SP1.Text = " Gartner"; // Blank Line Label SP2 = new Label(); SP2.FontSize = _fontSizeSmall; SP2.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; SP2.Text = " "; // World Leading... Label SP3 = new Label(); SP3.FontSize = _fontSizeLarge; SP3.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; FormattedString fpScale1 = new FormattedString(); Span fpScale1_Span1 = new Span(); fpScale1_Span1.Text = " - "; fpScale1_Span1.FontSize = _fontSizeLarge; Span fpScale1_Span2 = new Span(); fpScale1_Span2.Text = "World leading tech research and advising company."; fpScale1_Span2.FontSize = _fontSizeLarge; fpScale1_Span2.FontAttributes = FontAttributes.Bold; fpScale1.Spans.Add(fpScale1_Span1); fpScale1.Spans.Add(fpScale1_Span2); SP3.FormattedText = fpScale1; // Blank Line Label SP4 = new Label(); SP4.FontSize = _fontSizeMicro; SP4.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; SP4.Text = " "; // Help people... Label SP5 = new Label(); SP5.FontSize = _fontSizeLarge; SP5.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; FormattedString fpScale2 = new FormattedString(); Span fpScale1_Span3 = new Span(); fpScale1_Span3.Text = " - "; fpScale1_Span3.FontSize = _fontSizeLarge; Span fpScale1_Span4 = new Span(); fpScale1_Span4.Text = "Help clients select right technologies, using the right vendors at the right time."; fpScale1_Span4.FontSize = _fontSizeLarge; fpScale1_Span4.FontAttributes = FontAttributes.Bold; fpScale2.Spans.Add(fpScale1_Span3); fpScale2.Spans.Add(fpScale1_Span4); SP5.FormattedText = fpScale2; // Blank Line Label SP6 = new Label(); SP6.FontSize = _fontSizeMicro; SP6.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; SP6.Text = " "; // Over 11,000... Label SP7 = new Label(); SP7.FontSize = _fontSizeLarge; SP7.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; FormattedString fpScale3 = new FormattedString(); Span fpScale1_Span5 = new Span(); fpScale1_Span5.Text = " - "; fpScale1_Span5.FontSize = _fontSizeLarge; Span fpScale1_Span6 = new Span(); fpScale1_Span6.Text = "Over 11,000 client companies w/ 87% retention rate!"; fpScale1_Span6.FontSize = _fontSizeLarge; fpScale1_Span6.FontAttributes = FontAttributes.Bold; fpScale3.Spans.Add(fpScale1_Span5); fpScale3.Spans.Add(fpScale1_Span6); SP7.FormattedText = fpScale3; ContentScalePage.Children.Add(SP1); ContentScalePage.Children.Add(SP2); ContentScalePage.Children.Add(SP3); ContentScalePage.Children.Add(SP4); ContentScalePage.Children.Add(SP5); ContentScalePage.Children.Add(SP6); ContentScalePage.Children.Add(SP7); ScalePage.Content = ContentScalePage; ScalePage.AnchorX = 2; #endregion #region Gartner For CIO's ROI var GartnerROIInfo = new ContentPage(); var ContentGartnerROIInfo = new StackLayout(); ContentGartnerROIInfo.VerticalOptions = LayoutOptions.Start; Label PP1 = new Label(); PP1.FontSize = _fontSizeMed; PP1.FontAttributes = FontAttributes.Italic; PP1.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; PP1.TextColor = Color.Teal; PP1.BackgroundColor = Color.Silver; PP1.Text = " Gartner for CIO's - Hearth"; Label PP2 = new Label(); PP2.FontSize = _fontSizeSmall; PP2.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; PP2.Text = " "; Label PP3 = new Label(); PP3.FontSize = _fontSizeLarge; PP3.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; PP3.Text = " Cost Optimization"; Label PP4 = new Label(); PP4.FontSize = _fontSizeLarge; PP4.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; PP4.Text = " Research"; Label PP5 = new Label(); PP5.FontSize = _fontSizeLarge; PP5.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; PP5.Text = " Executive Partner"; Label SpacerPay2 = new Label(); SpacerPay2.FontSize = _fontSizeMicro; SpacerPay2.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; SpacerPay2.Text = " "; Label PP6 = new Label(); PP6.FontSize = _fontSizeMed; PP6.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; PP6.Text = " - Save 15% on IT Spend"; Label PP7 = new Label(); PP7.FontSize = _fontSizeMed; PP7.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; PP7.Text = " - Hearth Reduce 1.3M on IT Spend - 1200% ROI"; Label PP8 = new Label(); PP8.FontSize = _fontSizeMed; PP8.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; PP8.Text = " - Avoid Errors, Save Time, Better Outcomes"; Label PP9 = new Label(); PP9.FontSize = _fontSizeLarge; PP9.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; PP9.Text = " - Increase Confidence in Decisions"; ContentGartnerROIInfo.Children.Add(PP1); ContentGartnerROIInfo.Children.Add(PP2); ContentGartnerROIInfo.Children.Add(PP3); ContentGartnerROIInfo.Children.Add(PP4); ContentGartnerROIInfo.Children.Add(PP5); ContentGartnerROIInfo.Children.Add(PP6); ContentGartnerROIInfo.Children.Add(SpacerPay2); ContentGartnerROIInfo.Children.Add(PP7); ContentGartnerROIInfo.Children.Add(PP8); ContentGartnerROIInfo.Children.Add(PP9); GartnerROIInfo.Content = ContentGartnerROIInfo; GartnerROIInfo.AnchorX = 3; #endregion #region Gartner Selection var SelectionPage = new ContentPage(); var ScrollView = new Xamarin.Forms.ScrollView(); var mainGrid = new Grid(); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); mainGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); mainGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); // Title Label SP0 = new Label(); SP0.FontSize = _fontSizeMed; SP0.FontAttributes = FontAttributes.Italic; SP0.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; SP0.TextColor = Color.Teal; SP0.BackgroundColor = Color.Silver; SP0.Text = " Gartner"; ////////////////////////////////// Label LabelPH1 = new Label(); LabelPH1.FontSize = _fontSizeMed; LabelPH1.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; LabelPH1.Text = "Cost Optimization Tool"; var PH1 = new Image(); PH1.Aspect = Aspect.Fill; PH1.Source = ImageSource.FromFile("SMcostop.png"); PH1.GestureRecognizers.Add(new TapGestureRecognizer(OnPH1)); ////////////////////////////////// Label LabelPH2 = new Label(); LabelPH2.FontSize = _fontSizeMed; LabelPH2.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; LabelPH2.Text = "Magic Quadriant"; var PH2 = new Image(); PH2.Aspect = Aspect.Fill; PH2.Source = ImageSource.FromFile("SMmagicq.png"); PH2.GestureRecognizers.Add(new TapGestureRecognizer(OnPH2)); ////////////////////////////////// Label LabelPH3 = new Label(); LabelPH3.FontSize = _fontSizeMed; LabelPH3.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; LabelPH3.Text = "Hype Cycle"; var PH3 = new Image(); PH3.Aspect = Aspect.Fill; PH3.Source = ImageSource.FromFile("SMhype.png"); PH3.GestureRecognizers.Add(new TapGestureRecognizer(OnPH3)); ////////////////////////////////// Label LabelPH4 = new Label(); LabelPH4.FontSize = _fontSizeMed; LabelPH4.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; LabelPH4.Text = "Vendor Rating"; var PH4 = new Image(); PH4.Aspect = Aspect.Fill; PH4.Source = ImageSource.FromFile("SMvenrate.png"); PH4.GestureRecognizers.Add(new TapGestureRecognizer(OnPH4)); ////////////////////////////////// Label LabelPH5 = new Label(); LabelPH5.FontSize = _fontSizeMed; LabelPH5.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; LabelPH5.Text = "Critical Capabilities"; var PH5 = new Image(); PH5.Aspect = Aspect.Fill; PH5.Source = ImageSource.FromFile("SMcritcap.png"); PH5.GestureRecognizers.Add(new TapGestureRecognizer(OnPH5)); ////////////////////////////////// Label LabelPH6 = new Label(); LabelPH6.FontSize = _fontSizeMed; LabelPH6.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; LabelPH6.Text = "IT Scorecard"; var PH6 = new Image(); PH6.Aspect = Aspect.Fill; PH6.Source = ImageSource.FromFile("SMitscore.png"); PH6.GestureRecognizers.Add(new TapGestureRecognizer(OnPH6)); ////////////////////////////////// Label LabelPH7 = new Label(); LabelPH7.FontSize = _fontSizeMed; LabelPH7.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; LabelPH7.Text = "Market Clock"; var PH7 = new Image(); PH7.Aspect = Aspect.Fill; PH7.Source = ImageSource.FromFile("SMmarkclk.png"); PH7.GestureRecognizers.Add(new TapGestureRecognizer(OnPH7)); ////////////////////////////////// Label LabelPH8 = new Label(); LabelPH8.FontSize = _fontSizeMed; LabelPH8.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; LabelPH8.Text = "Market Guide"; var PH8 = new Image(); PH8.Aspect = Aspect.Fill; PH8.Source = ImageSource.FromFile("SMmrktgid.png"); PH8.GestureRecognizers.Add(new TapGestureRecognizer(OnPH8)); mainGrid.Children.Add(SP0, 0, 0); mainGrid.Children.Add(LabelPH1, 0, 2); mainGrid.Children.Add(PH1, 0, 3); mainGrid.Children.Add(LabelPH2, 1, 2); mainGrid.Children.Add(PH2, 1, 3); mainGrid.Children.Add(LabelPH3, 0, 5); mainGrid.Children.Add(PH3, 0, 6); mainGrid.Children.Add(LabelPH4, 1, 5); mainGrid.Children.Add(PH4, 1, 6); mainGrid.Children.Add(LabelPH5, 0, 8); mainGrid.Children.Add(PH5, 0, 9); mainGrid.Children.Add(LabelPH6, 1, 8); mainGrid.Children.Add(PH6, 1, 9); mainGrid.Children.Add(LabelPH7, 0, 11); mainGrid.Children.Add(PH7, 0, 12); mainGrid.Children.Add(LabelPH8, 1, 11); mainGrid.Children.Add(PH8, 1, 12); ScrollView.Content = mainGrid; SelectionPage.Content = ScrollView; SelectionPage.AnchorX = 4; _navigationPage = SelectionPage; #endregion #region Cost Optimization.png var CostOptimization = new ContentPage() { //Padding = padding, Title = "CostOptimization", Content = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Label { FontSize = _fontSizeMed, HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start, TextColor = Color.Teal, BackgroundColor = Color.Silver, Text = " Cost Optimization Tool" }, new Image { Aspect = Aspect.Fill, Source = ImageSource.FromFile("costop.png"), WidthRequest = 675, HeightRequest = 449 } } } }; CostOptimization.AnchorX = 5; #endregion #region MagicQuad var MagicQuad = new ContentPage() { //Padding = padding, Title = "MagicQuad", Content = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Label { FontSize = _fontSizeMed, HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start, TextColor = Color.Teal, BackgroundColor = Color.Silver, Text = " Magic Quadrant (Who - Key Players)" }, new Image { Aspect = Aspect.Fill, Source = ImageSource.FromFile("magicq.png"), WidthRequest = 675, HeightRequest = 449 } } } }; MagicQuad.AnchorX = 6; #endregion #region Hype Cycle var HypeCycle = new ContentPage() { //Padding = padding, Title = "HypeCycle", Content = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Label { FontSize = _fontSizeMed, HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start, TextColor = Color.Teal, BackgroundColor = Color.Silver, Text = " Hype Cycle (When - Maturity)" }, new Image { Aspect = Aspect.Fill, Source = ImageSource.FromFile("hype.png"), WidthRequest = 675, HeightRequest = 449 } } } }; HypeCycle.AnchorX = 7; #endregion #region VendorRate var VendorRate = new ContentPage() { //Padding = padding, Title = "VendorRate", Content = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Label { FontSize = _fontSizeMed, HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start, TextColor = Color.Teal, BackgroundColor = Color.Silver, Text = " Vendor Rating (Price, Service, Financials)" }, new Image { Aspect = Aspect.Fill, Source = ImageSource.FromFile("venrate.png"), WidthRequest = 675, HeightRequest = 449 } } } }; VendorRate.AnchorX = 8; #endregion #region Crit capabilities var CritCap = new ContentPage() { //Padding = padding, Title = "CritCap", Content = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Label { FontSize = _fontSizeMed, HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start, TextColor = Color.Teal, BackgroundColor = Color.Silver, Text = " Critical Capabilities (What - Deep Dive)" }, new Image { Aspect = Aspect.Fill, Source = ImageSource.FromFile("critcap.png"), WidthRequest = 675, HeightRequest = 449 } } } }; CritCap.AnchorX = 9; #endregion #region IT Score Card var ITScore = new ContentPage() { //Padding = padding, Title = "ITScore", Content = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Label { FontSize = _fontSizeMed, HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start, TextColor = Color.Teal, BackgroundColor = Color.Silver, Text = " IT Score Card (IT & Enterprise)" }, new Image { Aspect = Aspect.Fill, Source = ImageSource.FromFile("itscore.png"), WidthRequest = 675, HeightRequest = 449 } } } }; ITScore.AnchorX = 10; #endregion #region Market Clock var MarketClock = new ContentPage() { //Padding = padding, Title = "MarketClock", Content = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Label { FontSize = _fontSizeMed, HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start, TextColor = Color.Teal, BackgroundColor = Color.Silver, Text = " Market Clock (Updating - Obsolescence)" }, new Image { Aspect = Aspect.Fill, Source = ImageSource.FromFile("markclk.png"), WidthRequest = 675, HeightRequest = 449 } } } }; MarketClock.AnchorX = 11; #endregion #region Market Guide var MarketGuide = new ContentPage() { //Padding = padding, Title = "MarketGuide", Content = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Label { FontSize = _fontSizeMed, HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start, TextColor = Color.Teal, BackgroundColor = Color.Silver, Text = " Market Guide (Edge Players)" }, new Image { Aspect = Aspect.Fill, Source = ImageSource.FromFile("mrktgid.png"), WidthRequest = 675, HeightRequest = 449 } } } }; MarketGuide.AnchorX = 12; #endregion #region Summary //var SummaryPage = new ContentPage(); //var _summaryLabelHeader = new Label(); //_summaryLabelHeader.FontSize = _fontSizeMed; //_summaryLabelHeader.FontAttributes = FontAttributes.Italic; //_summaryLabelHeader.BackgroundColor = Color.Silver; //_summaryLabelHeader.TextColor = Color.Teal; //_summaryLabelHeader.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; //_summaryLabelHeader.Text = " ADP RUN - Solution for Stuart Surveying"; //Label SH3 = new Label(); //SH3.FontSize = _fontSizeSmall; //SH3.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; //SH3.Text = " "; //var _summaryLabelHeader2 = new Label(); //_summaryLabelHeader2.FontSize = _fontSizeLarge; //_summaryLabelHeader2.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; //_summaryLabelHeader2.Text = " RUN can help with..."; //Label SummarySpacer = new Label(); //SummarySpacer.FontSize = _fontSizeMicro; //SummarySpacer.HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Start; //SummarySpacer.Text = " "; //_summaryLabel.FontSize = _fontSizeMed; //_summaryStackLayout.Children.Add(_summaryLabelHeader); //_summaryStackLayout.Children.Add(SH3); //_summaryStackLayout.Children.Add(_summaryLabelHeader2); //_summaryStackLayout.Children.Add(SummarySpacer); //_summaryStackLayout.Children.Add(_summaryLabel); //SummaryPage.Content = _summaryStackLayout; //SummaryPage.AnchorX = 7; #endregion _carouselPage = new CarouselPage(); _carouselPage.Children.Add(ServerPage); _carouselPage.Children.Add(Circle); _carouselPage.Children.Add(ScalePage); _carouselPage.Children.Add(GartnerROIInfo); _carouselPage.Children.Add(SelectionPage); // Images _carouselPage.Children.Add(CostOptimization); _carouselPage.Children.Add(MagicQuad); _carouselPage.Children.Add(HypeCycle); _carouselPage.Children.Add(VendorRate); _carouselPage.Children.Add(CritCap); _carouselPage.Children.Add(ITScore); _carouselPage.Children.Add(MarketClock); _carouselPage.Children.Add(MarketGuide); MainPage = _carouselPage; _carouselPage.PropertyChanged += _carouselPage_PropertyChanged; }
public ImageButtonAlignments() { _grid1.Children.Add(new Xamarin.Forms.Label { Text = "HZ", VerticalTextAlignment = TextAlignment.Center, FontSize = 9 }, 0, 0); _grid1.Children.Add(_hzAlignmentElement, 1, 0); _grid1.Children.Add(new Xamarin.Forms.Label { Text = "VT", VerticalTextAlignment = TextAlignment.Center, FontSize = 9 }, 0, 1); _grid1.Children.Add(_vtAlignmentElement, 1, 1); _grid1.Children.Add(new Xamarin.Forms.Label { Text = "Opt", VerticalTextAlignment = TextAlignment.Center, FontSize = 9 }, 0, 2); _grid1.Children.Add(_optionsElement, 1, 2); //_grid1.Children.Add(new Xamarin.Forms.Label { Text = "Icon", VerticalTextAlignment = TextAlignment.Center, FontSize = 9 }, 0, 3); //_grid1.Children.Add(_iconElement, 1, 3); _grid2.Children.Add(new Xamarin.Forms.Label { Text = "Spacing:" }, 0, 0); _grid2.Children.Add(_spacingSlider, 0, 1); _grid2.Children.Add(new Xamarin.Forms.Label { Text = "Imposed Ht:" }, 1, 0); _grid2.Children.Add(_imposedHeightSwitch, 1, 1); _iconTextAndTextButton.Tapped += (sender, e) => System.Diagnostics.Debug.WriteLine("Tapped"); _iconTextAndTextButton.LongPressed += (sender, e) => System.Diagnostics.Debug.WriteLine("LongPressed"); _iconTextAndTextButton.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine("LongPressing"); Padding = new Thickness(40, 20, 20, 20); Content = new Xamarin.Forms.ScrollView { Content = new Xamarin.Forms.StackLayout { Children = { _grid1, _grid2, new BoxView { HeightRequest = 1, Color = Color.Black }, _iconTextAndTextButton, } } }; _hzAlignmentElement.SegmentTapped += (sender, e) => { TextAlignment alignment; var buttonText = string.Concat(e.Segment.Text.ToUpper().Substring(0, 1), e.Segment.Text.ToLower().Substring(1)); if (!Enum.TryParse <TextAlignment>(buttonText, out alignment)) { throw new Exception("doh"); } _labelElement.HorizontalTextAlignment = alignment; _iconTextAndTextButton.HorizontalTextAlignment = alignment; }; _vtAlignmentElement.SegmentTapped += (sender, e) => { TextAlignment alignment; var buttonText = string.Concat(e.Segment.Text.ToUpper().Substring(0, 1), e.Segment.Text.ToLower().Substring(1)); if (!Enum.TryParse <TextAlignment>(buttonText, out alignment)) { throw new Exception("doh"); } _labelElement.VerticalTextAlignment = alignment; _iconTextAndTextButton.VerticalTextAlignment = alignment; }; _optionsElement.SegmentTapped += (sender, e) => { _iconTextAndTextButton.HasTightSpacing = _optionsElement.IsIndexSelected(0); _iconTextAndTextButton.TrailingIcon = _optionsElement.IsIndexSelected(1); _iconTextAndTextButton.Orientation = _optionsElement.IsIndexSelected(2) ? StackOrientation.Vertical : StackOrientation.Horizontal; }; _iconElement.SegmentTapped += (sender, e) => { if (e.Segment.IconImage != null) { _iconTextAndTextButton.IconImage = new Forms9Patch.Image { Source = e.Segment.IconImage.Source } } ; // Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.Info"); else { SetIconText(e.Segment.HtmlText); } }; _spacingSlider.ValueChanged += (sender, e) => { _iconTextAndTextButton.Spacing = _spacingSlider.Value; }; _imposedHeightSwitch.Toggled += (sender, e) => { _iconTextAndTextButton.HeightRequest = _imposedHeightSwitch.IsToggled ? 60 : -1; _vtAlignmentElement.IsEnabled = _imposedHeightSwitch.IsToggled; if (!_vtAlignmentElement.IsEnabled) { _vtAlignmentElement.DeselectAll(); } }; var defaultHzAlignment = _iconTextAndTextButton.HorizontalTextAlignment; if (defaultHzAlignment == TextAlignment.Start) { _hzAlignmentElement.SelectIndex(0); } else if (defaultHzAlignment == TextAlignment.Center) { _hzAlignmentElement.SelectIndex(1); } else { _hzAlignmentElement.SelectIndex(2); } _iconElement.SelectIndex(0); _vtAlignmentElement.IsEnabled = false; }
public HomePageCS() { var stackLayout = new StackLayout { Children = { new Label { Text = "Nest Platform Control Demo", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center }, new Label { Text = "The controls below the separator have been added to this Xamarin.Forms page using platform-specific controls." }, new Separator() } }; Content = new Xamarin.Forms.ScrollView { Margin = new Xamarin.Forms.Thickness(20, 40, 20, 0), Content = stackLayout }; #if __IOS__ const string originalText = "Native UILabel."; const string longerText = "Native UILabel. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel elit orci. Nam sollicitudin consectetur congue."; var uiLabel = new UILabel { MinimumFontSize = 14f, Lines = 0, LineBreakMode = UILineBreakMode.WordWrap, Text = originalText, }; stackLayout.Children.Add(uiLabel); var uiButton = new UIButton(UIButtonType.RoundedRect); uiButton.SetTitle("Change Text", UIControlState.Normal); uiButton.Font = UIFont.FromName("Helvetica", 14f); uiButton.TouchUpInside += (sender, args) => { uiLabel.Text = uiLabel.Text == originalText ? longerText : originalText; uiLabel.SizeToFit(); }; stackLayout.Children.Add(uiButton); var explanation1 = new UILabel { MinimumFontSize = 14f, Lines = 0, LineBreakMode = UILineBreakMode.WordWrap, Text = "The next control is a CustomControl (a customized UILabel with a bad SizeThatFits implementation).", }; stackLayout.Children.Add(explanation1); var brokenControl = new CustomControl { MinimumFontSize = 14, Lines = 0, LineBreakMode = UILineBreakMode.WordWrap, Text = "This control has incorrect sizing - there's empty space above and below it." }; stackLayout.Children.Add(brokenControl); var explanation2 = new UILabel { MinimumFontSize = 14f, Lines = 0, LineBreakMode = UILineBreakMode.WordWrap, Text = "The next control is a CustomControl, but an override to the GetDesiredSize method is passed in when adding the control to the layout.", }; stackLayout.Children.Add(explanation2); var fixedControl = new CustomControl { MinimumFontSize = 14, Lines = 0, LineBreakMode = UILineBreakMode.WordWrap, Text = "This control has correct sizing - there's no empty space above and below it." }; stackLayout.Children.Add(fixedControl, FixSize); #endif #if __ANDROID__ const string originalText = "Native TextView."; const string longerText = "Native TextView. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel elit orci. Nam sollicitudin consectetur congue."; var textView = new TextView(MainActivity.Instance) { Text = originalText, TextSize = 14 }; textView.SetSingleLine(false); textView.SetLines(3); stackLayout.Children.Add(textView); var button = new Android.Widget.Button(MainActivity.Instance) { Text = "Change Text" }; button.Click += (sender, args) => { textView.Text = textView.Text == originalText ? longerText : originalText; }; stackLayout.Children.Add(button); var explanation1 = new TextView(MainActivity.Instance) { Text = "The next control is a CustomControl (a customized TextView with a bad OnMeasure implementation).", TextSize = 14 }; stackLayout.Children.Add(explanation1); var brokenControl = new CustomControl(MainActivity.Instance) { Text = "This control has incorrect sizing - it doesn't occupy the available width of the device.", TextSize = 14 }; stackLayout.Children.Add(brokenControl); var explanation2 = new TextView(MainActivity.Instance) { Text = "The next control is a CustomControl, but with a custom GetDesiredSize delegate to accomodate it's sizing problem.", TextSize = 14 }; stackLayout.Children.Add(explanation2); var goodControl = new CustomControl(MainActivity.Instance) { Text = "This control has correct sizing - it occupies the available width of the device.", TextSize = 14 }; stackLayout.Children.Add(goodControl, FixSize); #endif #if WINDOWS_UWP const string originalText = "Native TextBlock."; const string longerText = "Native TextBlock. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel elit orci. Nam sollicitudin consectetur congue."; var textBlock = new TextBlock { Text = originalText, FontSize = 14, FontFamily = new FontFamily("HeveticaNeue"), TextWrapping = TextWrapping.Wrap }; stackLayout.Children.Add(textBlock); var button = new Windows.UI.Xaml.Controls.Button { Content = "Change Text" }; button.Click += (sender, args) => { textBlock.Text = textBlock.Text == originalText ? longerText : originalText; }; stackLayout.Children.Add(button); var explanation1 = new TextBlock { Text = "The next control is a CustomControl (a customized TextBlock with a bad ArrangeOverride implementation).", FontSize = 14, FontFamily = new FontFamily("HeveticaNeue"), TextWrapping = TextWrapping.Wrap }; stackLayout.Children.Add(explanation1); var brokenControl = new CustomControl { Text = "This control has incorrect sizing - it doesn't occupy the available width of the device." }; stackLayout.Children.Add(brokenControl); var explanation2 = new TextBlock { Text = "The next control is a CustomControl, but an ArrangeOverride delegate is passed in when adding the control to the layout.", FontSize = 14, FontFamily = new FontFamily("HeveticaNeue"), TextWrapping = TextWrapping.Wrap }; stackLayout.Children.Add(explanation2); var fixedControl = new CustomControl { Text = "This control has correct sizing - it occupies the available width of the device." }; stackLayout.Children.Add(fixedControl, arrangeOverrideDelegate: (renderer, finalSize) => { if (finalSize.Width <= 0 || double.IsInfinity(finalSize.Width)) { return(null); } var frameworkElement = renderer.Control; frameworkElement.Arrange(new Rect(0, 0, finalSize.Width * 2, finalSize.Height)); return(finalSize); }); #endif }
public ButtonAndSegmentAlignments() { _grid1.Children.Add(new Xamarin.Forms.Label { Text = "HZ", VerticalTextAlignment = TextAlignment.Center, FontSize = 9 }, 0, 0); _grid1.Children.Add(_hzAlignmentElement, 1, 0); _grid1.Children.Add(new Xamarin.Forms.Label { Text = "VT", VerticalTextAlignment = TextAlignment.Center, FontSize = 9 }, 0, 1); _grid1.Children.Add(_vtAlignmentElement, 1, 1); _grid1.Children.Add(new Xamarin.Forms.Label { Text = "Opt", VerticalTextAlignment = TextAlignment.Center, FontSize = 9 }, 0, 2); _grid1.Children.Add(_optionsElement, 1, 2); _grid1.Children.Add(new Xamarin.Forms.Label { Text = "Icon", VerticalTextAlignment = TextAlignment.Center, FontSize = 9 }, 0, 3); _grid1.Children.Add(_iconElement, 1, 3); _grid2.Children.Add(new Xamarin.Forms.Label { Text = "Spacing:" }, 0, 0); _grid2.Children.Add(_spacingSlider, 0, 1); _grid2.Children.Add(new Xamarin.Forms.Label { Text = "Imposed Ht:" }, 1, 0); _grid2.Children.Add(_imposedHeightSwitch, 1, 1); _grid2.Children.Add(_outlineWidthLabel, 2, 0); _grid2.Children.Add(_outlineWidthSlider, 2, 1); _grid2.Children.Add(_outlineRadiusLabel, 3, 0); _grid2.Children.Add(_outlineRadiusSlider, 3, 1); _grid3.Children.Add(new Xamarin.Forms.Label { Text = "HasShadow:" }, 0, 0); _grid3.Children.Add(_hasShadowSwitch, 0, 1); Padding = new Thickness(40, 20, 20, 20); Content = new Xamarin.Forms.ScrollView { Content = new Xamarin.Forms.StackLayout { Children = { new Xamarin.Forms.Label { Text = "version 0.9.15.1" }, new BoxView { HeightRequest = 1, Color = Color.Gray }, _grid1, new BoxView { HeightRequest = 1, Color = Color.Gray }, _grid2, new BoxView { HeightRequest = 1, Color = Color.Gray }, _grid3, new BoxView { HeightRequest = 1, Color = Color.Black }, _stateButton, new BoxView { HeightRequest = 1, Color = Color.Gray }, _button, new BoxView { HeightRequest = 1, Color = Color.Gray }, _hzSegmentsElement, new BoxView { HeightRequest = 1, Color = Color.Gray }, _vtSegmentsElement, new BoxView { HeightRequest = 1, Color = Color.Gray }, new Xamarin.Forms.Label { Text = "Display.Scale=[" + Display.Scale + "]" } } } }; _hasShadowSwitch.Toggled += (sender, e) => { _hzAlignmentElement.HasShadow = _hasShadowSwitch.IsToggled; _vtAlignmentElement.HasShadow = _hasShadowSwitch.IsToggled; _optionsElement.HasShadow = _hasShadowSwitch.IsToggled; _iconElement.HasShadow = _hasShadowSwitch.IsToggled; _button.HasShadow = _hasShadowSwitch.IsToggled; _stateButton.DefaultState.HasShadow = _hasShadowSwitch.IsToggled; _hzSegmentsElement.HasShadow = _hasShadowSwitch.IsToggled; _vtSegmentsElement.HasShadow = _hasShadowSwitch.IsToggled; }; _hzAlignmentElement.SegmentTapped += (sender, e) => { var buttonText = string.Concat(e.Segment.Text.ToUpper().Substring(0, 1), e.Segment.Text.ToLower().Substring(1)); if (!Enum.TryParse <TextAlignment>(buttonText, out TextAlignment alignment)) { throw new Exception("doh"); } _labelElement.HorizontalTextAlignment = alignment; _button.HorizontalTextAlignment = alignment; _stateButton.DefaultState.HorizontalTextAlignment = alignment; _hzSegmentsElement.HorizontalTextAlignment = alignment; _vtSegmentsElement.HorizontalTextAlignment = alignment; }; _vtAlignmentElement.SegmentTapped += (sender, e) => { var buttonText = string.Concat(e.Segment.Text.ToUpper().Substring(0, 1), e.Segment.Text.ToLower().Substring(1)); if (!Enum.TryParse <TextAlignment>(buttonText, out TextAlignment alignment)) { throw new Exception("doh"); } _labelElement.VerticalTextAlignment = alignment; _button.VerticalTextAlignment = alignment; _stateButton.DefaultState.VerticalTextAlignment = alignment; _hzSegmentsElement.VerticalTextAlignment = alignment; _vtSegmentsElement.VerticalTextAlignment = alignment; }; _optionsElement.SegmentTapped += (sender, e) => { var options = new List <string>(); foreach (var segment in _optionsElement.SelectedSegments) { options.Add(segment.Text.ToUpper()); } var hasTightSpacing = options.Contains("TIGHT"); var trailingIcon = options.Contains("TRAILING"); var orientation = options.Contains("VERTICAL") ? StackOrientation.Vertical : StackOrientation.Horizontal; _button.HasTightSpacing = hasTightSpacing; _button.TrailingIcon = trailingIcon; _button.Orientation = orientation; _stateButton.DefaultState.HasTightSpacing = hasTightSpacing; _stateButton.DefaultState.TrailingIcon = trailingIcon; _stateButton.DefaultState.Orientation = orientation; _hzSegmentsElement.HasTightSpacing = hasTightSpacing; _hzSegmentsElement.TrailingIcon = trailingIcon; _hzSegmentsElement.IntraSegmentOrientation = orientation; _vtSegmentsElement.HasTightSpacing = hasTightSpacing; _vtSegmentsElement.TrailingIcon = trailingIcon; _vtSegmentsElement.IntraSegmentOrientation = orientation; }; _iconElement.SegmentTapped += (sender, e) => { //if (e.Segment.IconImage != null) //{ /* * _iconTextAndTextButton.IconImage = new Forms9Patch.Image { Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.Info") }; * foreach (var segment in _hzSegmentsElement.Segments) * segment.IconImage = new Forms9Patch.Image { Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.Info") }; * foreach (var segment in _vtSegmentsElement.Segments) * segment.IconImage = new Forms9Patch.Image { Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.Info") }; */ SetIconImage(e.Segment.IconImage); //} //else SetIconText(e.Segment.HtmlText ?? e.Segment.Text); }; _spacingSlider.ValueChanged += (sender, e) => { _button.Spacing = _spacingSlider.Value; //_stateButton.Spacing = _spacingSlider.Value; _stateButton.DefaultState.Spacing = _spacingSlider.Value; _hzSegmentsElement.IntraSegmentSpacing = _spacingSlider.Value; _vtSegmentsElement.IntraSegmentSpacing = _spacingSlider.Value; }; _imposedHeightSwitch.Toggled += (sender, e) => { _button.HeightRequest = _imposedHeightSwitch.IsToggled ? 60 : -1; _stateButton.HeightRequest = _imposedHeightSwitch.IsToggled ? 60 : -1; _hzSegmentsElement.HeightRequest = _imposedHeightSwitch.IsToggled ? 60 : -1; _vtSegmentsElement.HeightRequest = _imposedHeightSwitch.IsToggled ? 180 : -1; _vtAlignmentElement.IsEnabled = _imposedHeightSwitch.IsToggled; if (!_vtAlignmentElement.IsEnabled) { _vtAlignmentElement.DeselectAll(); } }; _outlineRadiusSlider.ValueChanged += (sender, e) => { int value = (int)_outlineRadiusSlider.Value; _hzAlignmentElement.OutlineRadius = value; _vtAlignmentElement.OutlineRadius = value; _button.OutlineRadius = value; _stateButton.DefaultState.OutlineRadius = value; _optionsElement.OutlineRadius = value; _iconElement.OutlineRadius = value; _hzSegmentsElement.OutlineRadius = value; _vtSegmentsElement.OutlineRadius = value; _outlineRadiusLabel.Text = "line R: " + value; }; _outlineWidthSlider.Effects.Add(new Forms9Patch.SliderStepSizeEffect(0.5)); _outlineWidthSlider.ValueChanged += (sender, e) => { float value = (float)_outlineWidthSlider.Value; // (float)(Math.Round(_outlineWidthSlider.Value*2.0)/2.0); _hzAlignmentElement.OutlineWidth = value; _vtAlignmentElement.OutlineWidth = value; _button.OutlineWidth = value; _stateButton.DefaultState.OutlineWidth = value; _optionsElement.OutlineWidth = value; _iconElement.OutlineWidth = value; _hzSegmentsElement.OutlineWidth = value; _vtSegmentsElement.OutlineWidth = value; _outlineWidthLabel.Text = "line W: " + _outlineWidthSlider.Value;// + value; }; var defaultHzAlignment = _button.HorizontalTextAlignment; if (defaultHzAlignment == TextAlignment.Start) { _hzAlignmentElement.SelectIndex(0); } else if (defaultHzAlignment == TextAlignment.Center) { _hzAlignmentElement.SelectIndex(1); } else { _hzAlignmentElement.SelectIndex(2); } _iconElement.SelectIndex(0); _vtAlignmentElement.IsEnabled = false; }
protected ReusableLoginPage(string logoFileImageSource) { On <iOS>().SetUseSafeArea(true); BackgroundColor = Color.FromHex("#3498db"); Padding = GetPagePadding(); MainLayout = new RelativeLayout(); LogoFileImageSource = logoFileImageSource; _logoSlogan = new StyledLabel { Opacity = 0, Text = "Delighting Developers." }; _loginEntry = new StyledEntry { AutomationId = AutomationIdConstants.LoginPage_UsernameEntry, Placeholder = "Username", ReturnType = ReturnType.Next }; _passwordEntry = new StyledEntry { AutomationId = AutomationIdConstants.LoginPage_PasswordEntry, Placeholder = "Password", IsPassword = true, ReturnType = ReturnType.Go, ReturnCommand = new Command(() => HandleLoginButtonClicked(_passwordEntry, EventArgs.Empty)) }; _loginButton = new StyledButton(Borders.Thin) { AutomationId = AutomationIdConstants.LoginPage_LoginButton, Text = "Login", }; _loginButton.Clicked += HandleLoginButtonClicked; _newUserSignUpButton = new StyledButton(Borders.None) { AutomationId = AutomationIdConstants.LoginPage_NewUserSignUpButton, Text = "Sign-up", }; _newUserSignUpButton.Clicked += HandleNewUserSignUpButtonClicked; _forgotPasswordButton = new StyledButton(Borders.None) { AutomationId = AutomationIdConstants.LoginPage_ForgotPasswordButton, Text = "Forgot Password?", }; _forgotPasswordButton.Clicked += HandleForgotPasswordButtonClicked; MainLayout.Children.Add(_logo, Constraint.Constant(100), Constraint.Constant(250), Constraint.RelativeToParent(p => p.Width - 200)); MainLayout.Children.Add(_logoSlogan, Constraint.RelativeToParent(p => (p.Width / 2) - (getLogoSloganWidth(p) / 2)), Constraint.Constant(125)); MainLayout.Children.Add(_loginEntry, Constraint.Constant(40), Constraint.RelativeToView(_logoSlogan, (p, v) => v.Y + v.Height + _relativeLayoutPadding), Constraint.RelativeToParent(p => p.Width - 80)); MainLayout.Children.Add(_passwordEntry, Constraint.Constant(40), Constraint.RelativeToView(_loginEntry, (p, v) => v.Y + v.Height + _relativeLayoutPadding), Constraint.RelativeToParent(p => p.Width - 80)); MainLayout.Children.Add(_loginButton, Constraint.Constant(40), Constraint.RelativeToView(_passwordEntry, (p, v) => v.Y + v.Height + _relativeLayoutPadding), Constraint.RelativeToParent(p => p.Width - 80)); MainLayout.Children.Add(_newUserSignUpButton, Constraint.RelativeToParent(p => (p.Width / 2) - (getNewUserButtonWidth(p) / 2)), Constraint.RelativeToView(_loginButton, (p, v) => v.Y + _loginButton.Height + 15)); MainLayout.Children.Add(_forgotPasswordButton, Constraint.RelativeToParent(p => (p.Width / 2) - (getForgotButtonWidth(p) / 2)), Constraint.RelativeToView(_newUserSignUpButton, (p, v) => v.Y + _newUserSignUpButton.Height + _relativeLayoutPadding)); Content = new Xamarin.Forms.ScrollView { Content = MainLayout }; double getNewUserButtonWidth(RelativeLayout p) => _newUserSignUpButton.Measure(p.Width, p.Height).Request.Width; double getForgotButtonWidth(RelativeLayout p) => _forgotPasswordButton.Measure(p.Width, p.Height).Request.Width; double getLogoSloganWidth(RelativeLayout p) => _logoSlogan.Measure(p.Width, p.Height).Request.Width; }
public ScrollViewHandler(NativeComponentRenderer renderer, XF.ScrollView scrollViewControl) : base(renderer, scrollViewControl) { ScrollViewControl = scrollViewControl ?? throw new System.ArgumentNullException(nameof(scrollViewControl)); }
public Home() { On <iOS>().SetUseSafeArea(true); var mainLayout = new Grid { Padding = new Thickness(0, 16, 0, 0), RowSpacing = 0, BackgroundColor = Colors.NearWhite, RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = 150 }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Star } } }; var title = new Label { Margin = new Thickness(16, 0), VerticalTextAlignment = Xamarin.Forms.TextAlignment.End, TextColor = Colors.Primary, FontAttributes = FontAttributes.Bold, FontSize = 32, Text = "Hi Susan" }; var subTitle = new Label { Margin = new Thickness(16, 0), VerticalTextAlignment = Xamarin.Forms.TextAlignment.Start, TextColor = Colors.Gray, FontSize = 18, Text = "Select an animal to get started!" }; var animalsHeader = new Label { Margin = new Thickness(16, 24, 0, 0), VerticalTextAlignment = Xamarin.Forms.TextAlignment.End, TextColor = Colors.NearBlack, FontAttributes = FontAttributes.Bold, FontSize = 22, Text = "Animals" }; var animalsLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Spacing = 16 }; foreach (var animal in _animals) { animal.Tile.Clicked += (e, s) => { _animals.ForEach(x => x.SetSelected(false)); animal.SetSelected(true); Task.Run(async() => { List <Task> anims = new List <Task>(); anims.Add(FlyAwayExhibitCards()); await Task.Delay(1000); anims.Add(FlyInExhibitCards(animal.Color, animal.LightColor)); await Task.WhenAll(anims); }); }; animalsLayout.Children.Add(animal); } var animalScroll = new Xamarin.Forms.ScrollView { Padding = new Thickness(16, 0, 16, 16), Orientation = ScrollOrientation.Horizontal, HorizontalScrollBarVisibility = ScrollBarVisibility.Never, Content = animalsLayout }; var exhibitsHeader = new Label { Margin = new Thickness(16, 24, 0, 0), VerticalTextAlignment = Xamarin.Forms.TextAlignment.End, TextColor = Colors.NearBlack, FontAttributes = FontAttributes.Bold, FontSize = 22, Text = "Exhibits" }; var exhibitLayout = new StackLayout { Spacing = 18, Margin = new Thickness(0, 8) }; var exhibitScroll = new Xamarin.Forms.ScrollView { VerticalScrollBarVisibility = ScrollBarVisibility.Never, Content = exhibitLayout }; foreach (var card in _exhibits) { card.TapGestureRecognizer.Tapped += async(s, e) => await this.Navigation.PushAsync(new ExploreAuroras()); card.Opacity = 0; card.TranslationY = -32; exhibitLayout.Children.Add(card); } int row = 0; mainLayout.Children.Add(title, 0, row); ++row; mainLayout.Children.Add(subTitle, 0, row); ++row; mainLayout.Children.Add(animalsHeader, 0, row); ++row; mainLayout.Children.Add(animalScroll, 0, row); ++row; mainLayout.Children.Add(exhibitsHeader, 0, row); ++row; mainLayout.Children.Add(exhibitScroll, 0, row); Content = mainLayout; _animals[0].SetSelected(true); Task.Run(async() => await FadeInCards()); }
public MaterialButtonAndSegmentAlignments() { BackgroundColor = Color.White; _grid1.Children.Add(new Xamarin.Forms.Label { Text = "HZ", VerticalTextAlignment = TextAlignment.Center, FontSize = 9, TextColor = Color.Black }, 0, 0); _grid1.Children.Add(_hzAlignmentElement, 1, 0); _grid1.Children.Add(new Xamarin.Forms.Label { Text = "VT", VerticalTextAlignment = TextAlignment.Center, FontSize = 9, TextColor = Color.Black }, 0, 1); _grid1.Children.Add(_vtAlignmentElement, 1, 1); _grid1.Children.Add(new Xamarin.Forms.Label { Text = "Opt", VerticalTextAlignment = TextAlignment.Center, FontSize = 9, TextColor = Color.Black }, 0, 2); _grid1.Children.Add(_optionsElement, 1, 2); _grid1.Children.Add(new Xamarin.Forms.Label { Text = "Icon", VerticalTextAlignment = TextAlignment.Center, FontSize = 9, TextColor = Color.Black }, 0, 3); _grid1.Children.Add(_iconElement, 1, 3); _grid2.Children.Add(new Xamarin.Forms.Label { Text = "Spacing:", TextColor = Color.Black }, 0, 0); _grid2.Children.Add(_spacingSlider, 0, 1); _grid2.Children.Add(new Xamarin.Forms.Label { Text = "Imposed Ht:", TextColor = Color.Black }, 1, 0); _grid2.Children.Add(_imposedHeightSwitch, 1, 1); Padding = new Thickness(40, 20, 20, 20); Content = new Xamarin.Forms.ScrollView { Content = new Xamarin.Forms.StackLayout { Children = { _grid1, _grid2, new BoxView { HeightRequest = 1, Color = Color.Black }, _iconTextAndTextButton, _hzSegmentsElement, _vtSegmentsElement } } }; _hzAlignmentElement.SegmentTapped += (sender, e) => { TextAlignment alignment; var buttonText = string.Concat(e.Segment.Text.ToUpper().Substring(0, 1), e.Segment.Text.ToLower().Substring(1)); if (!Enum.TryParse <TextAlignment>(buttonText, out alignment)) { throw new Exception("doh"); } _labelElement.HorizontalTextAlignment = alignment; _iconTextAndTextButton.HorizontalTextAlignment = alignment; _hzSegmentsElement.HorizontalTextAlignment = alignment; _vtSegmentsElement.HorizontalTextAlignment = alignment; }; _vtAlignmentElement.SegmentTapped += (sender, e) => { TextAlignment alignment; var buttonText = string.Concat(e.Segment.Text.ToUpper().Substring(0, 1), e.Segment.Text.ToLower().Substring(1)); if (!Enum.TryParse <TextAlignment>(buttonText, out alignment)) { throw new Exception("doh"); } _labelElement.VerticalTextAlignment = alignment; _iconTextAndTextButton.VerticalTextAlignment = alignment; _hzSegmentsElement.VerticalTextAlignment = alignment; _vtSegmentsElement.VerticalTextAlignment = alignment; }; _optionsElement.SegmentTapped += (sender, e) => { var options = new List <string>(); foreach (var segment in _optionsElement.SelectedSegments) { options.Add(segment.Text.ToUpper()); } var hasTightSpacing = options.Contains("TIGHT"); var trailingImage = options.Contains("TRAILING"); var orientation = options.Contains("VERTICAL") ? StackOrientation.Vertical : StackOrientation.Horizontal; _iconTextAndTextButton.HasTightSpacing = hasTightSpacing; _iconTextAndTextButton.TrailingIcon = trailingImage; _iconTextAndTextButton.Orientation = orientation; _hzSegmentsElement.HasTightSpacing = hasTightSpacing; _hzSegmentsElement.TrailingIcon = trailingImage; _hzSegmentsElement.IntraSegmentOrientation = orientation; _vtSegmentsElement.HasTightSpacing = hasTightSpacing; _vtSegmentsElement.TrailingIcon = trailingImage; _vtSegmentsElement.IntraSegmentOrientation = orientation; }; _iconElement.SegmentTapped += (sender, e) => { if (e.Segment.IconImage != null) { _iconTextAndTextButton.IconImage = new Forms9Patch.Image("Forms9PatchDemo.Resources.Info"); foreach (var segment in _hzSegmentsElement.Segments) { segment.IconImage = new Forms9Patch.Image("Forms9PatchDemo.Resources.Info"); } foreach (var segment in _vtSegmentsElement.Segments) { segment.IconImage = new Forms9Patch.Image("Forms9PatchDemo.Resources.Info"); } } else { SetIconText(e.Segment.HtmlText); } }; _spacingSlider.ValueChanged += (sender, e) => { _iconTextAndTextButton.Spacing = _spacingSlider.Value; _hzSegmentsElement.IntraSegmentSpacing = _spacingSlider.Value; _vtSegmentsElement.IntraSegmentSpacing = _spacingSlider.Value; }; _imposedHeightSwitch.Toggled += (sender, e) => { _iconTextAndTextButton.HeightRequest = _imposedHeightSwitch.IsToggled ? 60 : -1; _hzSegmentsElement.HeightRequest = _imposedHeightSwitch.IsToggled ? 60 : -1; _vtSegmentsElement.HeightRequest = _imposedHeightSwitch.IsToggled ? 180 : -1; _vtAlignmentElement.IsEnabled = _imposedHeightSwitch.IsToggled; if (!_vtAlignmentElement.IsEnabled) { _vtAlignmentElement.DeselectAll(); } }; var defaultHzAlignment = _iconTextAndTextButton.HorizontalTextAlignment; if (defaultHzAlignment == TextAlignment.Start) { _hzAlignmentElement.SelectIndex(0); } else if (defaultHzAlignment == TextAlignment.Center) { _hzAlignmentElement.SelectIndex(1); } else { _hzAlignmentElement.SelectIndex(2); } _iconElement.SelectIndex(0); _vtAlignmentElement.IsEnabled = false; }
public NewUserSignUpPage() { ViewModel.SaveFailed += HandleSaveFailed; ViewModel.TakePhotoFailed += HandleTakePhotoFailed; ViewModel.SaveSuccessfullyCompleted += HandleSaveSuccessfullyCompleted; BackgroundColor = Color.FromHex("2980b9"); var passwordEntry = new StyledEntry(1) { Placeholder = "Password", IsPassword = true, HorizontalOptions = LayoutOptions.Fill, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Fill, PlaceholderColor = Color.FromHex("749FA8"), ReturnType = ReturnType.Done }; passwordEntry.ReturnCommand = new Command(() => passwordEntry.Unfocus()); passwordEntry.SetBinding(Xamarin.Forms.Entry.TextProperty, nameof(NewUserSignUpViewModel.PasswordEntryText)); var usernameEntry = new StyledEntry(1) { Placeholder = "Username", HorizontalOptions = LayoutOptions.Fill, HorizontalTextAlignment = TextAlignment.End, PlaceholderColor = Color.FromHex("749FA8"), ReturnType = ReturnType.Next, ReturnCommand = new Command(() => passwordEntry.Focus()) }; usernameEntry.SetBinding(Xamarin.Forms.Entry.TextProperty, nameof(NewUserSignUpViewModel.UsernameEntryText)); _saveUsernameButton = new StyledButton(Borders.Thin, 1) { Text = "Save User", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.EndAndExpand }; _saveUsernameButton.SetBinding(IsEnabledProperty, nameof(NewUserSignUpViewModel.IsInternetConnectionInactive)); _saveUsernameButton.SetBinding(Button.CommandProperty, nameof(NewUserSignUpViewModel.SaveButtonCommand)); _cancelButton = new StyledButton(Borders.Thin, 1) { Text = "Cancel", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.End }; _cancelButton.Clicked += HandleCancelButtonClicked; _cancelButton.SetBinding(IsEnabledProperty, nameof(NewUserSignUpViewModel.IsInternetConnectionInactive)); _takePhotoButton = new StyledButton(Borders.Thin, 1) { Text = "Take Photo", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.EndAndExpand }; _takePhotoButton.SetBinding(IsEnabledProperty, nameof(NewUserSignUpViewModel.IsInternetConnectionInactive)); _takePhotoButton.SetBinding(Button.CommandProperty, nameof(NewUserSignUpViewModel.TakePhotoButtonCommand)); var isFacialRecognitionCompletedDescriptionLabel = new StyledLabel { Text = "Facial Recognition Completed", VerticalTextAlignment = TextAlignment.Center }; var isFacialRecognitionCompletedLabel = new FontAwesomeIcon { TextColor = Color.White, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center }; isFacialRecognitionCompletedLabel.SetBinding(Label.TextProperty, nameof(NewUserSignUpViewModel.FontAwesomeLabelText)); if (Device.RuntimePlatform is Device.iOS) { isFacialRecognitionCompletedLabel.SetBinding(IsVisibleProperty, nameof(NewUserSignUpViewModel.IsInternetConnectionInactive)); } var activityIndicator = new ActivityIndicator { Color = Color.White, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.EndAndExpand, }; activityIndicator.SetBinding(IsVisibleProperty, nameof(NewUserSignUpViewModel.IsInternetConnectionActive)); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(NewUserSignUpViewModel.IsInternetConnectionActive)); var facialRecognitionStackLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, Children = { isFacialRecognitionCompletedDescriptionLabel, isFacialRecognitionCompletedLabel } }; var stackLayout = new StackLayout { Padding = new Thickness(20, 50, 20, 20), VerticalOptions = LayoutOptions.FillAndExpand, Children = { new Label { Text = "Please enter username", TextColor = Color.White, HorizontalOptions = LayoutOptions.Start }, usernameEntry, new Label { Text = "Please enter password", TextColor = Color.White, HorizontalOptions = LayoutOptions.Start }, passwordEntry, _takePhotoButton, facialRecognitionStackLayout, } }; switch (Device.RuntimePlatform) { case Device.iOS: facialRecognitionStackLayout.Children.Add(activityIndicator); break; case Device.Android: stackLayout.Children.Add(activityIndicator); break; default: throw new NotSupportedException("Device Runtime Unsupported"); } stackLayout.Children.Add(_saveUsernameButton); stackLayout.Children.Add(_cancelButton); Content = new Xamarin.Forms.ScrollView { Content = stackLayout }; On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); }
public SwipeTransitionModeGallery() { Title = "SwipeTransitionMode Gallery"; var scroll = new Xamarin.Forms.ScrollView(); var swipeLayout = new StackLayout { Margin = new Thickness(12) }; var instructions = new Label { BackgroundColor = Color.Black, TextColor = Color.White, Text = "This Gallery use a Platform Specific only available for Android and iOS." }; swipeLayout.Children.Add(instructions); var swipeItemSwipeTransitionModeLabel = new Label { FontSize = 10, Text = "SwipeTransitionMode:" }; swipeLayout.Children.Add(swipeItemSwipeTransitionModeLabel); var swipeItemSwipeTransitionModePicker = new Xamarin.Forms.Picker(); var swipeTransitionModes = Enum.GetNames(typeof(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode)).Select(t => t).ToList(); swipeItemSwipeTransitionModePicker.ItemsSource = swipeTransitionModes; swipeItemSwipeTransitionModePicker.SelectedIndex = 0; // Reveal swipeLayout.Children.Add(swipeItemSwipeTransitionModePicker); var deleteSwipeItem = new SwipeItem { BackgroundColor = Color.Red, IconImageSource = "delete.png", Text = "Delete" }; deleteSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Delete Invoked", "Ok"); }; var swipeItems = new SwipeItems { deleteSwipeItem }; swipeItems.Mode = SwipeMode.Reveal; var leftSwipeContent = new Grid { BackgroundColor = Color.Gray }; var leftSwipeLabel = new Label { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Text = "Swipe to Right" }; leftSwipeContent.Children.Add(leftSwipeLabel); var leftSwipeView = new Xamarin.Forms.SwipeView { HeightRequest = 60, WidthRequest = 300, LeftItems = swipeItems, Content = leftSwipeContent }; swipeLayout.Children.Add(leftSwipeView); var rightSwipeContent = new Grid { BackgroundColor = Color.Gray }; var rightSwipeLabel = new Label { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Text = "Swipe to Left" }; rightSwipeContent.Children.Add(rightSwipeLabel); var rightSwipeView = new Xamarin.Forms.SwipeView { HeightRequest = 60, WidthRequest = 300, RightItems = swipeItems, Content = rightSwipeContent }; swipeLayout.Children.Add(rightSwipeView); var topSwipeContent = new Grid { BackgroundColor = Color.Gray }; var topSwipeLabel = new Label { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Text = "Swipe to Top" }; topSwipeContent.Children.Add(topSwipeLabel); var topSwipeView = new Xamarin.Forms.SwipeView { HeightRequest = 60, WidthRequest = 300, BottomItems = swipeItems, Content = topSwipeContent }; swipeLayout.Children.Add(topSwipeView); var bottomSwipeContent = new Grid { BackgroundColor = Color.Gray }; var bottomSwipeLabel = new Label { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Text = "Swipe to Bottom" }; bottomSwipeContent.Children.Add(bottomSwipeLabel); var bottomSwipeView = new Xamarin.Forms.SwipeView { HeightRequest = 60, WidthRequest = 300, TopItems = swipeItems, Content = bottomSwipeContent }; swipeLayout.Children.Add(bottomSwipeView); swipeItemSwipeTransitionModePicker.SelectedIndexChanged += (sender, e) => { var swipeTransitionMode = swipeItemSwipeTransitionModePicker.SelectedItem; switch (swipeTransitionMode) { case "Drag": leftSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag); leftSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag); rightSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag); rightSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag); topSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag); topSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag); bottomSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag); bottomSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag); break; case "Reveal": leftSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Reveal); leftSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Reveal); rightSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag); rightSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag); topSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag); topSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag); bottomSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag); bottomSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag); break; } }; scroll.Content = swipeLayout; Content = scroll; }
//METHODS /********************************************************************** *********************************************************************/ void CreateContent() { // View var scrollView = new Xamarin.Forms.ScrollView { Margin = new Thickness(10) }; var stackLayout = new StackLayout(); this.Content = scrollView; scrollView.Content = stackLayout; //Wrap ScrollView around StackLayout to be able to scroll the content // Algorithm selection var l_Algorithm = new Label { Text = "Algorithm", FontSize = App._h3FontSize }; p_Algorithm = new Xamarin.Forms.Picker { Title = "Select a Strategy", FontSize = App._textFontSize }; p_Algorithm.Items.Add("First Fit"); p_Algorithm.Items.Add("Next Fit"); p_Algorithm.Items.Add("Best Fit"); p_Algorithm.Items.Add("Worst Fit"); p_Algorithm.Items.Add("Combined Fit"); p_Algorithm.SelectedIndex = 0; //pre selects First Fit var l_Space = new Label { Text = " " }; stackLayout.Children.Add(l_Algorithm); stackLayout.Children.Add(p_Algorithm); stackLayout.Children.Add(l_Space); // Fragmentation input var l_Fragmentation = new Label { Text = "Fragmentation", FontSize = App._h3FontSize }; e_Fragmentation = new Xamarin.Forms.Entry { Keyboard = Keyboard.Telephone, Text = "10,4,20,18,7,9,12,15", FontSize = App._textFontSize }; var b_Default = new Button { Text = "Default", HorizontalOptions = LayoutOptions.Start, BackgroundColor = App._buttonBackground, TextColor = App._buttonText, CornerRadius = App._buttonCornerRadius, FontSize = App._smallButtonFontSize }; b_Default.Clicked += (sender, e) => e_Fragmentation.Text = "10,4,20,18,7,9,12,15"; var l_Space2 = new Label { Text = " " }; stackLayout.Children.Add(l_Fragmentation); stackLayout.Children.Add(e_Fragmentation); stackLayout.Children.Add(b_Default); stackLayout.Children.Add(l_Space2); // Application Start var b_Start = new Button { Text = "Start", BackgroundColor = App._buttonBackground, TextColor = App._buttonText, CornerRadius = App._buttonCornerRadius, FontSize = App._buttonFontSize }; b_Start.Clicked += B_Start_Clicked; stackLayout.Children.Add(b_Start); }