public KeyValueItemBar() { this.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); this.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(2, GridUnitType.Star) }); this.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(40, GridUnitType.Absolute) }); { ETkey = new MyEntry(); ETkey.SetBinding(MyEntry.TextProperty, "Key", BindingMode.TwoWay); this.Children.Add(ETkey, 0, 0); } { ETvalue = new MyEntry(); ETvalue.SetBinding(MyEntry.TextProperty, "Value", BindingMode.TwoWay); this.Children.Add(ETvalue, 1, 0); } { BTNcancel = new MyButton("\u2716");//✖ BTNcancel.Clicked += async delegate { if (this.BindingContext != null) // && await MyLogger.Ask($"Remove this item?\r\nKey: {ETkey.Text}\r\nValue: {ETvalue.Text}")) { await(this.BindingContext as MyControls.BarsListPanel.MyDisposable).OnDisposed(); } }; this.Children.Add(BTNcancel, 2, 0); } System.Threading.SemaphoreSlim semaphoreSlim = new System.Threading.SemaphoreSlim(1, 1); this.Appeared += async(sender) => { this.Opacity = 0; await semaphoreSlim.WaitAsync(); //this.Opacity = 1; await this.FadeTo(1, 500); lock (semaphoreSlim) semaphoreSlim.Release(); }; this.Disappearing = new Func <Task>(async() => { await semaphoreSlim.WaitAsync(); //this.Opacity = 0; await this.FadeTo(0, 500); lock (semaphoreSlim) semaphoreSlim.Release(); }); }
public StackLayout AssignValues() { BindingContext = new ContractorViewModel(); var label = new Label { Text = "Refer a contractor", BackgroundColor = Color.Black, Font = Font.SystemFontOfSize(NamedSize.Large), TextColor = Color.White, VerticalOptions = LayoutOptions.Center, XAlign = TextAlignment.Center, // Center the text in the blue box. YAlign = TextAlignment.Center, // Center the text in the blue box. }; var firstNameLabel = new Label { HorizontalOptions = LayoutOptions.Fill }; firstNameLabel.Text = "First Name"; var firstName = new MyEntry() { HorizontalOptions = LayoutOptions.FillAndExpand }; firstName.SetBinding(MyEntry.TextProperty, ContractorViewModel.ContractorFirstNamePropertyName); var lastNameLabel = new Label { HorizontalOptions = LayoutOptions.Fill }; lastNameLabel.Text = "Last Name"; var lastName = new MyEntry() { HorizontalOptions = LayoutOptions.FillAndExpand }; lastName.SetBinding(MyEntry.TextProperty, ContractorViewModel.ContractorLastNamePropertyName); var phoneNoLabel = new Label { HorizontalOptions = LayoutOptions.Fill }; phoneNoLabel.Text = "Phone"; var phoneNo = new Entry() { HorizontalOptions = LayoutOptions.FillAndExpand }; phoneNo.SetBinding(Entry.TextProperty, ContractorViewModel.ContractorPhonePropertyName); phoneNo.Keyboard = Keyboard.Telephone; var emailLabel = new Label { HorizontalOptions = LayoutOptions.Fill }; emailLabel.Text = "Email"; var email = new Entry() { HorizontalOptions = LayoutOptions.FillAndExpand }; email.SetBinding(Entry.TextProperty, ContractorViewModel.ContractorEmailPropertyName); email.Keyboard = Keyboard.Email; var additionalInfoLabel = new Label { HorizontalOptions = LayoutOptions.Fill }; additionalInfoLabel.Text = "Additional Information"; var additionalInfo = new MyEntry() { HorizontalOptions = LayoutOptions.FillAndExpand }; additionalInfo.SetBinding(MyEntry.TextProperty, ContractorViewModel.ContractorAdditionalInfoPropertyName); var chkInvite = new CheckBox(); chkInvite.SetBinding(CheckBox.CheckedProperty, ContractorViewModel.isCheckedPropertyName, BindingMode.TwoWay); chkInvite.DefaultText = "I Agree to the terms and condition"; Button btnSubmitContractor = new Button { HorizontalOptions = LayoutOptions.Fill, BackgroundColor = Color.FromHex("22498a"), Text = "Submit" }; btnSubmitContractor.SetBinding(Button.CommandProperty, ContractorViewModel.SubmitCommandPropertyName); var downloadButton = new Button { Text = "Download Terms and Conditions", BackgroundColor = Color.FromHex("f7941d"), TextColor = Color.White }; downloadButton.Clicked += (object sender, EventArgs e) => { DependencyService.Get <FormSample.Helpers.Utility.IUrlService> ().OpenUrl(Utility.PDFURL); }; var contactUsButton = new Button { Text = "Contact Us", BackgroundColor = Color.FromHex("0d9c00"), TextColor = Color.White }; contactUsButton.Clicked += (object sender, EventArgs e) => { App.RootPage.NavigateTo("Contact us"); }; var labelStakeLayout = new StackLayout() { Children = { label }, Orientation = StackOrientation.Vertical }; var cotrolStakeLayout = new StackLayout() { Padding = new Thickness(Device.OnPlatform(5, 5, 5), 0, Device.OnPlatform(5, 5, 5), 0), //new Thickness(5,0,5,0), VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.Fill, Orientation = StackOrientation.Vertical, Children = { firstNameLabel, firstName, lastNameLabel, lastName, phoneNoLabel, phoneNo, emailLabel, email, additionalInfoLabel, additionalInfo, chkInvite } }; var scrollableContentLayout = new ScrollView() { Content = cotrolStakeLayout, Orientation = ScrollOrientation.Vertical, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.FillAndExpand }; var buttonLayout = new StackLayout() { Padding = new Thickness(Device.OnPlatform(5, 5, 5), 0, Device.OnPlatform(5, 5, 5), 0), //new Thickness(5,0,5,0), HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Vertical, Children = { btnSubmitContractor, downloadButton, contactUsButton } }; var nameLayout = new StackLayout() { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Vertical, Children = { labelStakeLayout, scrollableContentLayout, buttonLayout } }; return(new StackLayout { Children = { nameLayout } }); }
public StackLayout AssignValues() { BindingContext = new AgentViewModel(Navigation, this.ilm); var label = new Label { Text = "Registration", BackgroundColor = Color.Black, Font = Font.SystemFontOfSize(NamedSize.Large), TextColor = Color.White, VerticalOptions = LayoutOptions.Center, XAlign = TextAlignment.Center, // Center the text in the blue box. YAlign = TextAlignment.Center // Center the text in the blue box. }; var emailLabel = new Label { HorizontalOptions = LayoutOptions.Fill }; emailLabel.Text = "Email"; var emailText = new Entry() { HorizontalOptions = LayoutOptions.FillAndExpand }; emailText.SetBinding(Entry.TextProperty, AgentViewModel.AgentEmailPropertyName); emailText.Keyboard = Keyboard.Email; var firstNameLabel = new Label { HorizontalOptions = LayoutOptions.Fill }; firstNameLabel.Text = "First Name"; var firstName = new MyEntry() { HorizontalOptions = LayoutOptions.FillAndExpand }; firstName.SetBinding(MyEntry.TextProperty, AgentViewModel.FirstNamePropertyName); var lastNameLabel = new Label { HorizontalOptions = LayoutOptions.Fill }; lastNameLabel.Text = "Last Name"; var lastName = new MyEntry() { HorizontalOptions = LayoutOptions.FillAndExpand }; lastName.SetBinding(MyEntry.TextProperty, AgentViewModel.LastNamePropertyName); var agencyLabel = new Label { HorizontalOptions = LayoutOptions.Fill }; agencyLabel.Text = "Agency"; var agencyText = new MyEntry() { HorizontalOptions = LayoutOptions.FillAndExpand }; agencyText.SetBinding(MyEntry.TextProperty, AgentViewModel.AgencyNamePropertyName); var phoneLabel = new Label { HorizontalOptions = LayoutOptions.Fill }; phoneLabel.Text = "Phone number"; var phoneText = new Entry() { HorizontalOptions = LayoutOptions.FillAndExpand }; phoneText.SetBinding(Entry.TextProperty, AgentViewModel.PhonePropertyName); phoneText.Keyboard = Keyboard.Telephone; var chkInvite = new CheckBox(); chkInvite.SetBinding(CheckBox.CheckedProperty, AgentViewModel.isCheckedPropertyName, BindingMode.TwoWay); chkInvite.DefaultText = "I Agree to the terms and condition"; chkInvite.IsVisible = true; Button btnRegister = new Button { HorizontalOptions = LayoutOptions.Fill, BackgroundColor = Color.FromHex("22498a"), Text = "Register" }; btnRegister.SetBinding(Button.CommandProperty, AgentViewModel.SubmitCommandPropertyName); var loginButton = new Button { Text = "I already have a recruiter account...", BackgroundColor = Color.FromHex("3b73b9"), TextColor = Color.White }; loginButton.SetBinding(Button.CommandProperty, AgentViewModel.GotoLoginCommandPropertyName); var downloadButton = new Button { Text = "Download Terms and Conditions", BackgroundColor = Color.FromHex("f7941d"), TextColor = Color.White }; downloadButton.Clicked += (object sender, EventArgs e) => { DependencyService.Get <FormSample.Helpers.Utility.IUrlService>().OpenUrl(Utility.PDFURL); }; var lableStakelayout = new StackLayout() { Children = { label }, Orientation = StackOrientation.Vertical }; var controlLayout = new StackLayout() { Padding = new Thickness(Device.OnPlatform(5, 5, 5), 0, Device.OnPlatform(5, 5, 5), 0), //new Thickness(5,0,5,0), VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.Fill, Orientation = StackOrientation.Vertical, Children = { emailLabel, emailText, firstNameLabel, firstName, lastNameLabel, lastName, agencyLabel, agencyText, phoneLabel, phoneText, chkInvite } }; var scrollableContentLayout = new ScrollView() { Content = controlLayout, Orientation = ScrollOrientation.Vertical, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.FillAndExpand }; var buttonLayout = new StackLayout() { Padding = new Thickness(Device.OnPlatform(5, 5, 5), 0, Device.OnPlatform(5, 5, 5), 0), //new Thickness(5,0,5,0), HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Vertical, Children = { btnRegister, loginButton, downloadButton } }; var nameLayout = new StackLayout() { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Vertical, Children = { lableStakelayout, scrollableContentLayout, buttonLayout } }; return(new StackLayout { Children = { nameLayout } }); }
public Page1() { this.BindingContext = new Page1ViewModel(); // mask: 01/03/2015 //var maskEntry3= new MyEntry (); //maskEntry3.Text = ""; ////maskEntry3.Keyboard = Keyboard.Text; //maskEntry3.Keyboard = Keyboard.Numeric; //maskEntry3.FormatCharacters = "/"; //maskEntry3.Mask = new System.Collections.Generic.List<MaskRules> ( // new[] { // // 01 [characters: 0,1] // new MaskRules { Start = 0, End = 2, Mask = "{0:2}" }, // // 01/03 [characters: 0,1]-[characters: 2,3] // new MaskRules { Start = 2, End = 4, Mask = "{0:2}/{2:2}"}, // // 01/01/2015 [characters: 0,1]-[characters: 2,3]-characters: 4,5,6,7] // // max length: end=8 // // {0:2} : take substring (0, 1): 01 // // {2:2} : take substring (2, 2): 03 // // {5:} : take substring (5) : 2015 // new MaskRules { Start = 4, End = 8, Mask = "{0:2}/{2:2}/{4:}"} // }); //maskEntry3.SetBinding (MyEntry.TextProperty, new Binding("Text1", BindingMode.TwoWay)); //maskEntry3.SetBinding (MyEntry.TextUpdateProperty, new Binding("TextUpdate", BindingMode.OneWay)); //this.Content = new StackLayout { // Children = { // new Label { Text = "MVVM Sample" }, // new Button { // Text = "Update Text", // Command = new Command( () => { // Model.ButtonClick.Execute(null); // }) // }, // maskEntry3 // } //}; // mask: 01/03/2015 var maskEntry3 = new MyEntry(); maskEntry3.Text = ""; maskEntry3.Keyboard = Keyboard.Text; maskEntry3.FormatCharacters = "/"; maskEntry3.Mask = new System.Collections.Generic.List <MaskRules>( new[] { // 01 [characters: 0,1] new MaskRules { Start = 0, End = 2, Mask = "{0:2}" }, // 01/03 [characters: 0,1]-[characters: 2,3] new MaskRules { Start = 2, End = 4, Mask = "{0:2}/{2:2}" }, // 01/01/2015 [characters: 0,1]-[characters: 2,3]-characters: 4,5,6,7] // max length: end=8 // {0:2} : take substring (0, 1): 01 // {2:2} : take substring (2, 2): 03 // {5:} : take substring (5) : 2015 new MaskRules { Start = 4, End = 8, Mask = "{0:2}/{2:2}/{4:}" } }); maskEntry3.SetBinding(MyEntry.TextProperty, new Binding("Text1", BindingMode.TwoWay)); this.Content = new StackLayout { Children = { new Label { Text = "MVVM Sample" }, new Button { Text = "Update Text", Command = new Command(async() =>{ var text = Model.Text1; await DisplayAlert(null, text, "OK"); }) }, maskEntry3 } }; }