public EditorDemoPage() { Label header = new Label { Text = "Editor", Font = Font.BoldSystemFontOfSize(50), HorizontalOptions = LayoutOptions.Center }; Editor editor = new Editor { VerticalOptions = LayoutOptions.FillAndExpand }; // Accomodate iPhone status bar. this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); // Build the page. this.Content = new StackLayout { Children = { header, editor } }; }
void CreateControls() { _picker = new DatePicker { Format = "D" }; _manExpense = new Entry { Placeholder = "Exemple : 0,00", Keyboard = Keyboard.Numeric }; _manExpense.TextChanged += numberEntry_TextChanged; _womanExpense = new Entry { Placeholder = "Exemple : 0,00", Keyboard = Keyboard.Numeric }; _womanExpense.TextChanged += numberEntry_TextChanged; _details = new Editor { BackgroundColor = AppColors.Gray.MultiplyAlpha(0.15d), HeightRequest = 150 }; Content = new StackLayout { Padding = new Thickness(20), Spacing = 10, Children = { new Label { Text = "Date" }, _picker, new Label { Text = "Man expense" }, _manExpense, new Label { Text = "Woman expense" }, _womanExpense, new Label { Text = "Informations" }, _details } }; }
protected override void OnAppearing() { base.OnAppearing(); if (BindingContext == null) { BindingContext = _project; var grid = new Grid(); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition { Height = 150 }); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.VerticalOptions = LayoutOptions.StartAndExpand; grid.Children.Add(new Label { Text = "Name" }, 0, 0); var editor = new Editor(); editor.SetBinding(Editor.TextProperty, "Name"); grid.Children.Add(editor, 1, 0); label.IsVisible = false; label.Text = "Error in value"; label.TextColor = Color.Red; grid.Children.Add(label, 1, 1); grid.Children.Add(new Label { Text = "Description" }, 0, 2); grid.Children.Add(new Editor { Text = _project.Description }, 1, 2); grid.Children.Add(new Label { Text = "Started" }, 0, 3); grid.Children.Add(new Editor { Text = _project.Started.HasValue ? _project.Started.GetValueOrDefault().ToShortDateString() : string.Empty }, 1, 3); grid.Children.Add(new Label { Text = "Ended" }, 0, 4); grid.Children.Add(new Editor { Text = _project.Ended.HasValue ? _project.Ended.GetValueOrDefault().ToShortDateString() : string.Empty }, 1, 4); Content = grid; } }
public EditorDemoPage() { Label header = new Label { Text = "Editor", FontSize = 50, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center }; Editor editor = new Editor { VerticalOptions = LayoutOptions.FillAndExpand }; // Build the page. this.Content = new StackLayout { Children = { header, editor } }; }
private void AddDescriptionSection(TableView table) { const int HEIGHT = 150; var descriptionSection = new TableSection ("Description"); var descriptionGrid = new Grid { Padding = new Thickness(10), HeightRequest = HEIGHT, VerticalOptions = LayoutOptions.FillAndExpand, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) } } }; var descriptionEntry = new Editor { HeightRequest = HEIGHT }; descriptionEntry.SetBinding (Editor.TextProperty, "Description"); descriptionGrid.Children.Add (descriptionEntry, 0, 0); descriptionSection.Add (new ViewCell { View = descriptionGrid, Height = HEIGHT }); table.Root.Add (descriptionSection); }
} //end ctor private StackLayout BuildView() { Editor editor = new Editor(); editor.SetBinding(Editor.TextProperty, "Account.Notes"); TableView tblView = new TableView() { Root = new TableRoot() { new TableSection("NOTES") } }; StackLayout stack = new StackLayout() { Padding = 10, VerticalOptions = LayoutOptions.FillAndExpand, Children = { tblView, editor } }; return stack; } //end BuildView
public LandingPage () { editor = new Editor { WidthRequest = App.ScreenWidth, HeightRequest = App.ScreenHeight / 2 }; Button normalButton = new Button { Text = "Request Synchronously" }; Button asyncButton = new Button { Text = "Request Async" }; Content = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Padding = Device.OnPlatform( iOS: new Thickness(0,20,0,0), Android: new Thickness(0,0,0,0), WinPhone:new Thickness(0,0,0,0)), Children = { editor, normalButton, asyncButton } }; normalButton.Clicked += SynchronousButton; asyncButton.Clicked += AsyncButton; }
public CreatePage() { //SQL local database connection _notesDB = new NotesDB(); _notesQuery = new NotesQuery(); var noteEditor = new Editor { BackgroundColor = Color.White, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; var saveButton = new Button { Text = "SAVE", HorizontalOptions = LayoutOptions.FillAndExpand }; var cancelButton = new Button { Text = "CANCEL", HorizontalOptions = LayoutOptions.FillAndExpand }; saveButton.Clicked += (object sender, EventArgs e) => { _DateTime = DateTime.Now; try { InsertData(noteEditor.Text.ToString(), _DateTime.ToString()); DisplayAlert("Alert", "Saved Succesfully.", "OK"); Navigation.PushAsync(new HomePage()); } catch (Exception ex) { string error = ex.ToString(); DisplayAlert("Sorry...", "Something went wrong. Try after sometime.", "OK"); // Navigation.PushAsync(new HomePage()); } }; var btnStack = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { saveButton,cancelButton } }; cancelButton.Clicked += (sender, e) => { var NoteItem = (NotesDB)BindingContext; this.Navigation.PopAsync(); }; Content = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { noteEditor,btnStack } }; }
public ContactUsPage() { ch = new ColorHandler(); Title = "Contact Us"; Editor = new Editor { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, HeightRequest = 200, // Placeholder = "Message", // TextColor = ch.fromStringToColor("black"), BackgroundColor = ch.fromStringToColor("white") }; Button bCancel = new Button { Text = "X", TextColor = ch.fromStringToColor("white"), BackgroundColor = ch.fromStringToColor("lightGray"), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, HeightRequest = 100 }; bCancel.Clicked += BCancel_Clicked; Button bSend = new Button { Text = "Send", TextColor = ch.fromStringToColor("white"), BackgroundColor = ch.fromStringToColor("green"), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, HeightRequest = 100 }; bSend.Clicked += BSend_Clicked; Content = new StackLayout { Children = { Editor, new StackLayout { Children = { bCancel, bSend }, Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Spacing =10, Padding = new Thickness(10,10,10,10) } }, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(0, 0, 0, 70), BackgroundColor = ch.fromStringToColor("purple") }; }
public BorderEditControl() { ContentView border = new ContentView(); border.BackgroundColor = Color.Blue; Content = border; editor = new Editor(); editor.TextChanged += EditorTextChanged; border.Content = editor; }
public CSPage() { BindingContext = new ViewModel.PageViewModel(); var editor = new Editor { Text = "", HorizontalOptions = LayoutOptions.FillAndExpand }; editor.SetBinding(Editor.TextProperty, "Message"); switcher = new Switch { }; //switcher.SetBinding(Switch.IsToggledProperty, "Toggled"); switcher.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { sclabel.SetBinding(Label.TextProperty, new Binding("Message", converter: new Converters.StringCaseConverter(), converterParameter: switcher.IsToggled)); }; var label = new Label { Text = "", HorizontalOptions = LayoutOptions.FillAndExpand, FontSize = 30 }; label.SetBinding(Label.TextProperty, "Message"); sclabel = new Label { Text = "", HorizontalOptions = LayoutOptions.FillAndExpand, FontSize = 30 }; var sllabel = new Label { Text = "", HorizontalOptions = LayoutOptions.FillAndExpand, FontSize = 30 }; sllabel.SetBinding(Label.TextProperty, new Binding("Message", converter: new Converters.StringToLengthConverter(), stringFormat: "{0} letters")); Title = "Mvvm w/ C#"; Content = new StackLayout { Padding = new Thickness(20, 5), Children = { editor, switcher, label, sclabel, sllabel } }; }
private async Task InitializeComponents() { products = await ProductService.Instance.ReadAll (); clients = await ClientService.Instance.ReadAll (); StackLayout layout = new StackLayout (); priceEntry = new Entry () { Placeholder = "Precio", Keyboard = Keyboard.Numeric }; layout.Children.Add ( priceEntry ); quantityStepper = new Entry () { Placeholder = "Cantidad", Keyboard = Keyboard.Numeric }; layout.Children.Add ( quantityStepper ); detailsEditor = new Editor () { HeightRequest = 100, Text = "Detalles" }; layout.Children.Add ( detailsEditor ); productPicker = new Picker () { Title = "Elija un producto" }; foreach( var p in products ) { productPicker.Items.Add ( p.Name ); } layout.Children.Add ( productPicker ); clientPicker = new Picker () { Title = "Elija un cliente" }; foreach( var c in clients ) { clientPicker.Items.Add ( c.Name ); } layout.Children.Add ( clientPicker ); orderButton = new CustomButton () { Text = "Enviar", BackgroundImage = "blue-button-hi.png" }; layout.Children.Add ( orderButton ); Content = layout; orderButton.Clicked += OrderButton_Clicked; }
public FeedbackPage() { Title = "Feedback"; Button sendButton = new Button { Text = "Send", TextColor = Theme.LinkColor, BackgroundColor = Theme.ButtonBackgroundColor, BorderColor = Theme.FrameBorderColor }; Picker title = new Picker() { Items = { "Feedback", "Bug Report", "Feature Request" }, TextColor = Theme.TextColor, BackgroundColor = Theme.FrameColor, SelectedIndex = 0 }; Editor body = new Editor { VerticalOptions = LayoutOptions.FillAndExpand, }; sendButton.Clicked += async (sender, args) => { await DependencyService.Get<ISendMail>().SendMail(title.Items[title.SelectedIndex], body.Text); }; Content = new ScrollView { Content = new MarginFrame(10, Theme.BackgroundColor) { Content = new StackLayout { Children = { new Label { Text = "Subject:", TextColor = Theme.TextColor}, title, //new Label { Text = "From:", TextColor = Theme.TextColor}, //from, new Label { Text = "Message:", TextColor = Theme.TextColor}, body, sendButton } } } }; }
public async Task GetResponseFromUrl (string html, Editor editor) { var url = html; string json = ""; using (HttpClient client = new HttpClient (new NativeMessageHandler())) { var response = await client.GetAsync (url); json = await response.Content.ReadAsStringAsync (); } editor.Text = json; }
private void InitializeComponent() { this.LoadFromXaml(typeof(CreateFootballPlayerPage)); ImagePicker = this.FindByName <Image>("ImagePicker"); ImagePickerTapGesture = this.FindByName <TapGestureRecognizer>("ImagePickerTapGesture"); FirstNamelbl = this.FindByName <Entry>("FirstNamelbl"); LastNamelbl = this.FindByName <Entry>("LastNamelbl"); DateOfBirthPicker = this.FindByName <DatePicker>("DateOfBirthPicker"); CountryPicker = this.FindByName <Picker>("CountryPicker"); DescriptionEditor = this.FindByName <Editor>("DescriptionEditor"); SavePlayerProfileBTN = this.FindByName <Button>("SavePlayerProfileBTN"); }
public CSViewModelConverterPage() { BindingContext = new ViewModel.CommonViewModel(); var editor = new Editor { Text = "", HorizontalOptions = LayoutOptions.FillAndExpand, }; editor.SetBinding(Editor.TextProperty, "Message"); var label = new Label { Text = "", FontSize = 30, HorizontalOptions = LayoutOptions.FillAndExpand, }; label.SetBinding(Label.TextProperty, "Message"); var sclabel = new Label { Text = "", FontSize = 30, HorizontalOptions = LayoutOptions.FillAndExpand, }; sclabel.SetBinding(Label.TextProperty, new Binding("Message", converter: new Converters.StringCaseConverter(), converterParameter: "True")); var sllabel = new Label { Text = "", FontSize = 30, HorizontalOptions = LayoutOptions.FillAndExpand, }; sllabel.SetBinding(Label.TextProperty, new Binding("Message", converter: new Converters.StringToLengthConverter(), stringFormat: "{0} letters")); var stack = new StackLayout { Spacing = 20, Children = { editor, label, sclabel, sllabel, }, }; Padding = 30; Title = "ViewModel bindig (C#)"; Content = stack; }
/// <summary> /// Method that creates the page content /// </summary> public void SetContent() { var header = new Label { Text = "Bemærkning", TextColor = Color.FromHex(Definitions.TextColor), FontSize = Definitions.HeaderFontSize, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; var backButton = new BackButton(SendBackMessage); var saveButton = new SaveButton(SendSaveMessage); var headerstack = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.FromHex(Definitions.PrimaryColor), HeightRequest = Definitions.HeaderHeight, Children = { backButton, header, saveButton } }; _editor = new Editor { HeightRequest = Definitions.ScreenHeight - Definitions.HeaderHeight - 2 * Definitions.Padding, WidthRequest = Definitions.ScreenWidth, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; _editor.SetBinding(Editor.TextProperty, RemarkViewModel.RemarkProperty); var editorStack = new StackLayout { BackgroundColor = Color.FromHex(Definitions.BackgroundColor), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = Definitions.Padding, Children = { _editor } }; var layout = new StackLayout { BackgroundColor = Color.FromHex(Definitions.BackgroundColor), Children = { headerstack, editorStack} }; this.Content = layout; }
public TaskDetailPage(string fullDescription) { Title = fullDescription; NavigationPage.SetHasNavigationBar (this, true); var notesLabel = new Label { Text = "You can add notes about this Task Completion here:" }; var notesEntry = new Editor (); // cannot get just the right "look" that will be satisfactory for both Android and iOS //notesEntry.BackgroundColor = new Color (0, 0x10, 0x10); notesEntry.SetBinding (Editor.TextProperty, "Notes"); var saveButton = new Button { Text = "Save Notes", BorderWidth = 2, }; saveButton.Clicked += (sender, e) => { var taskItem = (Task)BindingContext; App.Database.SaveTask (taskItem); this.Navigation.PopAsync (); }; var deleteButton = new Button { Text = "Delete this entry and deduct points", BorderWidth = 2, }; deleteButton.Clicked += (sender, e) => { var taskItem = (Task)BindingContext; App.Database.DeleteTask (taskItem.ID); this.Navigation.PopAsync (); }; var cancelButton = new Button { Text = "Cancel", BorderWidth = 2, }; cancelButton.Clicked += (sender, e) => { this.Navigation.PopAsync (); }; var lineSeparator = new BoxView () { Color = Color.Black, WidthRequest = 100, HeightRequest = 2 }; Content = new StackLayout { //Orientation = StackOrientation.Horizontal, //HorizontalOptions = LayoutOptions.Center, Padding = new Thickness (5), Children = { notesLabel, notesEntry, lineSeparator, saveButton, deleteButton, // speakNotes, cancelButton, } }; }
public EditFilePage(string pageName, PageService pageService) { _pageName = pageName; _pageService = pageService; _originalText = pageService.GetTextOfPage(pageName); PersistedState.PageInEditMode = pageName; _editBox = new Editor { VerticalOptions = LayoutOptions.FillAndExpand, Text = _originalText, }; _editBox.TextChanged += (sender, args) => PersistedState.AutoSaveEditText = args.NewTextValue; Content = new ScrollView { Content = new StackLayout { Children = {_editBox} } }; ToolbarItems.Add(new ToolbarItem { Text = "Save", Icon = "ic_menu_save.png", Command = new Command(Save), Order = ToolbarItemOrder.Primary }); ToolbarItems.Add(new ToolbarItem { Text = "Clear", Icon = "ic_menu_clear_playlist.png", Command = new Command(Clear) }); ToolbarItems.Add(new ToolbarItem { Text = "Delete", Icon = "ic_menu_delete.png", Command = new Command(Delete), Order = ToolbarItemOrder.Secondary }); ToolbarItems.Add(new ToolbarItem { Text = "Cancel", Command = new Command(Cancel), Order = ToolbarItemOrder.Secondary }); }
public ReviewPage() { NavigationPage.SetHasNavigationBar (this, false); InitializeComponent (); var submit = new Button(); var text = new Editor (); var api = new Api (); submit.Text = "Send"; submit.HorizontalOptions = LayoutOptions.EndAndExpand; submit.Command = new Command(o => { api.LeaveReview(App.user, text.Text); var carouselPage = new CarouselPage (); var categories = App.api.getCategories (App.user); if (categories == null) { categories = new List<Category>(); } foreach (var category in categories) { carouselPage.Children.Add (new CategoryPage(category)); } App.MasterDetailPage.Detail.Navigation.PushAsync(new NavigationPage(carouselPage)); //Navigation.PushAsync (new CategoryPage ()); }); this.Padding = new Thickness (0, Device.OnPlatform (0, 0, 0), 0, 0); var headerLayout = new StackLayout{ Children = { new Label{ Text = "Написать нам", HorizontalOptions = LayoutOptions.Center; TextColor = Color.White } }, BackgroundColor = Color.FromHex("666666"), Padding = new Thickness(10,40,10,0), }; // Set the content for the page. this.Content = new StackLayout { Children = { headerLayout, new StackLayout{ Padding = new Thickness(10,20,10,0), Children = { text, submit } } } }; }
public EditorPageCode () { var layout = new StackLayout { Padding = new Thickness (5, 10) }; this.Title = "Editor Demo - Code"; layout.Children.Add (new Label{ Text = "This page demonstrates the Editor View. The Editor is used for collecting text that is expected to take more than one line." }); styledEditor = new Editor { Text = "Xamarin Blue", BackgroundColor = Color.FromHex ("#2c3e50"), HeightRequest = 100 }; layout.Children.Add (new Editor { Text = "Default starting text" }); layout.Children.Add (new Editor { IsEnabled = false, Text = "This is a disabled editor" }); this.Content = layout; }
internal static bool HasDefaultFont(this Xamarin.Forms.Editor element) { if (element.FontFamily != null || element.FontAttributes != FontAttributes.None) { return(false); } var getNamedSize = typeof(Device).GetRuntimeMethod("GetNamedSize", new Type[] { typeof(NamedSize), typeof(Type), typeof(bool) }); if (getNamedSize != null) { var result = (double)getNamedSize.Invoke(null, new object[] { NamedSize.Default, typeof(Label), true }); return(result == element.FontSize); } return(false); }
public EmbeddedResourceFontEffectPage() { var label = new Xamarin.Forms.Label { Text = "Xamarin.Forms.Label", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; //label.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect()); Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(label); var editor = new Xamarin.Forms.Editor { Text = "Xamarin.Forms.Editor", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; editor.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect()); var entry = new Xamarin.Forms.Entry { Text = "Xamarin.Forms.Entry", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; entry.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect()); var button = new Xamarin.Forms.Button { Text = "Xamarin.Forms.Button", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; button.Effects.Add(new Forms9Patch.EmbeddedResourceFontEffect()); Content = new StackLayout { Children = { label, editor, entry, button } }; }
public TestPage() { this.BindingContext = new TestPageViewModel(); var ed = new Editor { Text = "BindingTo TextValue" }; ed.SetBinding(Editor.TextProperty, "TextValue", mode: BindingMode.OneWayToSource); var lb = new Label { Text = "" }; lb.SetBinding(Label.TextProperty, "TextValue"); var sw = new Switch(); sw.SetBinding(Switch.IsToggledProperty, "BoolValue", mode: BindingMode.TwoWay); var sc = new SwitchCell { Text = "BindingTo BoolValue" }; sc.SetBinding(SwitchCell.OnProperty, "BoolValue", mode: BindingMode.TwoWay); var tc = new TextCell { Text = "" }; tc.SetBinding(TextCell.TextProperty, "BoolValue", stringFormat:"Value: {0}"); var tv = new TableView { Intent = TableIntent.Settings, Root = new TableRoot { new TableSection("TableView") { sc, tc, }, } }; Content = new StackLayout { Padding = 20, Children = { new Label { Text = "INotifyPropertyChanged Test", FontSize = 30, }, ed, lb, sw, tv, } }; }
public App() { markdownEditor = new Editor() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; markdownEditor.TextChanged += MarkdownEditor_TextChanged; markdownInputPage = new ContentPage() { Title = "Markdown Input", Content = new StackLayout() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new OnPlatform<Thickness>() { iOS = new Thickness(0, 20, 0, 0), }, Children = { markdownEditor, }, }, }; webView = new WebView() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; markdownPreviewPage = new ContentPage() { Title = "HTML Preview", Content = new StackLayout() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new OnPlatform<Thickness>() { iOS = new Thickness(0, 20, 0, 0), }, Children = { webView, }, }, }; var tabs = new TabbedPage() { Children = { markdownInputPage, markdownPreviewPage, }, }; MainPage = tabs; }
public CustomFontEffectPage() { var label = new Xamarin.Forms.Label { Text = "Xamarin.Forms.Label", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; label.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect")); var editor = new Xamarin.Forms.Editor { Text = "Xamarin.Forms.Editor", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; editor.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect")); var entry = new Xamarin.Forms.Entry { Text = "Xamarin.Forms.Entry", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; entry.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect")); var button = new Xamarin.Forms.Button { Text = "Xamarin.Forms.Button", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; button.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect")); Content = new StackLayout { Children = { label, editor, entry, button } }; }
public SaveAndLoadText () { var input = new Editor { Text = "" }; if (Device.OS == TargetPlatform.iOS) input.HeightRequest = 40; var output = new Label { Text = "" }; saveButton = new Button {Text = "Save"}; saveButton.Clicked += async (sender, e) => { loadButton.IsEnabled = saveButton.IsEnabled = false; // uses the Interface defined in this project, and the implementations that must // be written in the iOS, Android and WinPhone app projects to do the actual file manipulation await DependencyService.Get<ISaveAndLoad>().SaveTextAsync("temp.txt", input.Text); loadButton.IsEnabled = saveButton.IsEnabled = true; }; loadButton = new Button {Text = "Load"}; loadButton.Clicked += async (sender, e) => { loadButton.IsEnabled = saveButton.IsEnabled = false; // uses the Interface defined in this project, and the implementations that must // be written in the iOS, Android and WinPhone app projects to do the actual file manipulation output.Text = await DependencyService.Get<ISaveAndLoad>().LoadTextAsync("temp.txt"); loadButton.IsEnabled = saveButton.IsEnabled = true; }; var buttonLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.CenterAndExpand, Children = { saveButton, loadButton } }; Content = new StackLayout { Padding = new Thickness (0,20,0,0), VerticalOptions = LayoutOptions.StartAndExpand, Children = { new Label { Text = "Save and Load Text (PCL)", Font = Font.BoldSystemFontOfSize(NamedSize.Medium)}, new Label { Text = "Type below and press Save, then Load" }, input, buttonLayout, output } }; }
public SimpleContentPage() { var labTitulo = new Label { Text = "Registro", FontSize = 24 }; var entNombre = new Entry { Placeholder = "Cual es tu problema?" }; var entDesc = new Editor { Text = "Describe tu problema..." //Placeholder = "Describe tu problema..." }; var sliCat = new Slider { Minimum = 1, Maximum = 10 }; var sliLevel = new Slider { Minimum = 1, Maximum = 10 }; var btnEnviar = new Button { Text = "Enviar" }; Content = new StackLayout { Padding = 30, Spacing = 10, Children = { labTitulo, entNombre, entDesc, sliCat, sliLevel, btnEnviar } }; }
public ModelCheckerPage() : base() { var button = this.TopButton; button.Text = "Check TF Lite Model"; button.Clicked += OnButtonClicked; DisplayImage.IsVisible = false; //MessageLabel.MaxLines = -1; //MessageLabel.BackgroundColor = Color.Aqua; _editor = new Editor(); //_editor.BackgroundColor = Color.BlueViolet; MainLayout.Children.Add(_editor); SetMessage("Please select a .tflite file to see the model parameters."); }
public AddReviewView () { viewModel = new AddReviewsViewModel (Navigation); BindingContext = viewModel; Title = "Add New Review"; var email = new Entry () { Placeholder = "Email Address" }; email.SetBinding (Entry.TextProperty, "Email"); var cheeseType = new Entry () { Placeholder = "Cheese Type" }; cheeseType.SetBinding (Entry.TextProperty, "CheeseType"); var dairy = new Entry () { Placeholder = "Dairy" }; dairy.SetBinding (Entry.TextProperty, "DairyName"); var comments = new Editor (); comments.BackgroundColor = Color.FromRgb (255, 255, 229); comments.VerticalOptions = LayoutOptions.FillAndExpand; comments.SetBinding (Editor.TextProperty, "Comments"); var saveButton = new ToolbarItem () { Text = "Save" }; saveButton.SetBinding (ToolbarItem.CommandProperty, "AddCommand"); ToolbarItems.Add (saveButton); Content = new StackLayout { Padding= new Thickness(10,10,10,10), Children = { email, cheeseType, dairy, new Label{ Text = "Comments:" }, comments } }; }
protected override void OnAttached() { if(this.Element is Xamarin.Forms.Label) { _formsLabel = (Xamarin.Forms.Label)this.Element; UpdateLabelFont(); } if(this.Element is Xamarin.Forms.Entry) { _formsEntry = (Xamarin.Forms.Entry)this.Element; UpdateEntryFont(); } if(this.Element is Xamarin.Forms.Editor) { _formsEditor = (Xamarin.Forms.Editor)this.Element; UpdateEditorFont(); } }
protected override void OnAppearing() { base.OnAppearing(); if (BindingContext == null) { BindingContext = _project; var grid = new Grid(); grid.VerticalOptions = LayoutOptions.StartAndExpand; grid.Children.Add(new Label { Text = "Name" }, 0, 0); var editor = new Editor(); editor.SetBinding(Editor.TextProperty, "Name"); grid.Children.Add(editor, 1, 0); grid.Children.Add(new Label { Text = "Description" }, 0, 1); grid.Children.Add(new Editor { Text = _project.Description }, 1, 1); grid.Children.Add(new Label { Text = "Started" }, 0, 2); grid.Children.Add(new Editor { Text = _project.Started.ToString() }, 1, 2); grid.Children.Add(new Label { Text = "Ended" }, 0, 3); grid.Children.Add(new Editor { Text = _project.Ended.ToString() }, 1, 3); Content = grid; } }
public NotePage(Note note) { this.note = note; Title = "New Note"; // Create Entry and Editor views. Entry entry = new Entry { Placeholder = "Title (optional)" }; Editor editor = new Editor { Keyboard = Keyboard.Create(KeyboardFlags.All), BackgroundColor = Device.OnPlatform(Color.Default, Color.Default, Color.White), VerticalOptions = LayoutOptions.FillAndExpand }; // Set data bindings. this.BindingContext = note; entry.SetBinding(Entry.TextProperty, "Title"); editor.SetBinding(Editor.TextProperty, "Text"); // Assemble page. this.Content = new StackLayout { Children = { new Label { Text = "Title:" }, entry, new Label { Text = "Note:" }, editor, } }; }
public ChrisEmbeddedResourceFontEffectPage() { var label = new Xamarin.Forms.Label { Text = "Xamarin.Forms.Label", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(label); var editor = new Xamarin.Forms.Editor { Text = "Xamarin.Forms.Editor", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(editor); var entry = new Xamarin.Forms.Entry { Text = "Xamarin.Forms.Entry", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(entry); var button = new Xamarin.Forms.Button { Text = "Xamarin.Forms.Button", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; Forms9Patch.EmbeddedResourceFontEffect.ApplyTo(button); var F9Plabel1 = new Forms9Patch.Label { Text = "Forms9Patch.Label - luximb", FontFamily = "Forms9PatchDemo.Resources.Fonts.luximb.ttf", //TextColor = Color.Black }; var F9Plabel2 = new Forms9Patch.Label { Text = "Forms9Patch.Label - CPMono", FontFamily = "Forms9PatchDemo.Resources.Fonts.CPMono_v07_Bold.otf", //TextColor = Color.Black }; var F9Plabel3 = new Forms9Patch.Label { Text = "Forms9Patch.Label - default FontFamily", // FontFamily = "Forms9PatchDemo.Resources.Fonts.CPMono_v07 Bold.otf" //TextColor = Color.Black }; Content = new StackLayout { Children = { label, editor, entry, button, F9Plabel1, F9Plabel2, F9Plabel3 } }; }
public ChrisEmbeddedResourceFontEffectPage() { var label = new Xamarin.Forms.Label { Text = "Xamarin.Forms.Label", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; label.Effects.Add(Effect.Resolve("Forms9Patch.EmbeddedResourceFontEffect")); var editor = new Xamarin.Forms.Editor { Text = "Xamarin.Forms.Editor", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; editor.Effects.Add(Effect.Resolve("Forms9Patch.EmbeddedResourceFontEffect")); var entry = new Xamarin.Forms.Entry { Text = "Xamarin.Forms.Entry", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; entry.Effects.Add(Effect.Resolve("Forms9Patch.EmbeddedResourceFontEffect")); var button = new Xamarin.Forms.Button { Text = "Xamarin.Forms.Button", FontFamily = "Forms9PatchDemo.Resources.Fonts.Pacifico.ttf" }; button.Effects.Add(Effect.Resolve("Forms9Patch.EmbeddedResourceFontEffect")); var F9Plabel1 = new Forms9Patch.Label { Text = "Forms9Patch.Label - luximb", FontFamily = "Forms9PatchDemo.Resources.Fonts.luximb.ttf" }; var F9Plabel2 = new Forms9Patch.Label { Text = "Forms9Patch.Label - CPMono", FontFamily = "Forms9PatchDemo.Resources.Fonts.CPMono_v07_Bold.otf" }; var F9Plabel3 = new Forms9Patch.Label { Text = "Forms9Patch.Label - default FontFamily", // FontFamily = "Forms9PatchDemo.Resources.Fonts.CPMono_v07 Bold.otf" }; Content = new StackLayout { Children = { label, editor, entry, button, F9Plabel1, F9Plabel2, F9Plabel3 } }; }