public View CreateDatePickerFor(string propertyName, LayoutOptions layout) { DatePicker iiDatePicker = new DatePicker { HorizontalOptions = layout, BackgroundColor = Helper.Color.iiGreen.ToFormsColor(), }; iiDatePicker.SetBinding(DatePicker.DateProperty, propertyName); return iiDatePicker; }
public View CreateLabelFor(string propertyName, LayoutOptions layout) { Label iiLabel = new Label { TextColor = Color.White.ToFormsColor(), Text = propertyName, YAlign = TextAlignment.Center, HorizontalOptions = layout, }; return iiLabel; }
public View CreateLabelFor(string propertyName, LayoutOptions layout,string id ="") { iiLabel iiLabel = new iiLabel { TextColor = Color.White.ToFormsColor(), Text = propertyName, HorizontalOptions = layout, HeightRequest=45, FontSize=20, ClassId=id, }; return iiLabel; }
public View CreateButtonFor(string propertyName, Color color, LayoutOptions layout) { Button iiButton = new Button { //HorizontalOptions = LayoutOptions.FillAndExpand, TextColor = color.ToFormsColor(), Text = "Send", BorderWidth = 10, WidthRequest = 100, HeightRequest = 50, HorizontalOptions = layout, }; iiButton.SetBinding(Button.TextColorProperty, propertyName); return iiButton; }
public View CreateLabelFor(string propertyName, LayoutOptions layout, string id = "") { iiLabel iiLabel = new iiLabel { TextColor = Color.White.ToFormsColor(), Text = propertyName, HorizontalOptions = layout, HeightRequest = 25, WidthRequest = 120, FontSize = 10, ClassId = id, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, }; return iiLabel; }
public static View CreatePickerFor(string propertyName, LayoutOptions layout) { iiPicker iiPicker = new iiPicker { HorizontalOptions = layout, Title = "Leave Type", HeightRequest = 50, WidthRequest = 50, }; iiPicker.Items.Add("Casual Leave"); iiPicker.Items.Add("Medical Leave"); iiPicker.Items.Add("Paid Leave"); //iiPicker.SetBinding(Picker.TitleProperty, propertyName); iiPicker.SelectedIndex = 0; return iiPicker; }
internal override void ComputeConstraintForView(View view) { LayoutOptions vOptions = view.VerticalOptions; LayoutOptions hOptions = view.HorizontalOptions; var result = LayoutConstraint.None; if (vOptions.Alignment == LayoutAlignment.Fill) { result |= LayoutConstraint.VerticallyFixed; } if (hOptions.Alignment == LayoutAlignment.Fill) { result |= LayoutConstraint.HorizontallyFixed; } view.ComputedConstraint = result; }
public View CreateLabelFor(string propertyName, Color color, LayoutOptions layout, string id = "", bool isHeader = false) { iiLabel iiLabel = new iiLabel { TextColor = isHeader ? Color.White.ToFormsColor() : Color.DarkBlue.ToFormsColor(), Text = propertyName, HorizontalOptions = layout, HeightRequest = 25, WidthRequest = 130, FontSize = 10, ClassId = id, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, BackgroundColor = color.ToFormsColor(), }; return iiLabel; }
private StackLayout SyncLabel (string text, LayoutOptions horizontalOptions, Thickness padding = new Thickness ()) { return new StackLayout () { Padding = padding, Spacing = 2, Orientation = StackOrientation.Horizontal, HorizontalOptions = horizontalOptions, Children = { new Label () { Style = AppStyle.SettingSyncSliderTimeLabel, Text = text }, new Label () { Text = "min", Style = AppStyle.SettingSyncSliderMinLabel, } } }; }
private static string GetValueExpression(object declaredDefaultValue, List <UsingStatement> usings) { if (declaredDefaultValue is null) { throw new ArgumentNullException(nameof(declaredDefaultValue)); } return(declaredDefaultValue switch { bool boolValue => boolValue ? "true" : "false", int intValue => GetIntValueExpression(intValue), float floatValue => floatValue.ToString("F", CultureInfo.InvariantCulture) + "f", // "Fixed-Point": https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#the-fixed-point-f-format-specifier double doubleValue => doubleValue.ToString("F", CultureInfo.InvariantCulture), // "Fixed-Point": https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#the-fixed-point-f-format-specifier Enum enumValue => GetTypeNameAndAddNamespace(enumValue.GetType(), usings) + "." + Enum.GetName(enumValue.GetType(), declaredDefaultValue), XF.LayoutOptions layoutOptionsValue => GetLayoutOptionsValueExpression(layoutOptionsValue), string stringValue => $@"""{stringValue}""", // TODO: More types here _ => null, });
public static ContentView Wrap(this View item, Thickness padding = default (Thickness), LayoutOptions horizontalLayoutOptions = default(LayoutOptions), LayoutOptions verticalLayoutOptions = default(LayoutOptions)) { if(padding == default (Thickness)) { padding = new Thickness(10, 10, 10, 10); } var f = new ContentView { Padding = padding, Content = item, HorizontalOptions = horizontalLayoutOptions, VerticalOptions = verticalLayoutOptions }; return f; }
private static string GetValueExpression(object declaredDefaultValue, List <UsingStatement> usings) { if (declaredDefaultValue is null) { throw new ArgumentNullException(nameof(declaredDefaultValue)); } return(declaredDefaultValue switch { bool boolValue => boolValue ? "true" : "false", int intValue => GetIntValueExpression(intValue), float floatValue => floatValue.ToString("F", CultureInfo.InvariantCulture) + "f", // "Fixed-Point": https://docs.microsoft.com/dotnet/standard/base-types/standard-numeric-format-strings#the-fixed-point-f-format-specifier double doubleValue => doubleValue.ToString("F", CultureInfo.InvariantCulture), // "Fixed-Point": https://docs.microsoft.com/dotnet/standard/base-types/standard-numeric-format-strings#the-fixed-point-f-format-specifier Enum enumValue => GetTypeNameAndAddNamespace(enumValue.GetType(), usings) + "." + Enum.GetName(enumValue.GetType(), declaredDefaultValue), XF.GridLength gridLengthValue => GetGridLengthValueExpression(gridLengthValue, usings), XF.LayoutOptions layoutOptionsValue => GetLayoutOptionsValueExpression(layoutOptionsValue, usings), string stringValue => $@"""{stringValue}""", DateTime dateTimeValue => $"global::System.DateTime.Parse(\"{dateTimeValue.ToString("o", CultureInfo.InvariantCulture)}\", null, global::System.Globalization.DateTimeStyles.RoundtripKind)", // "Round-trip": https://docs.microsoft.com/dotnet/standard/base-types/how-to-round-trip-date-and-time-values TimeSpan timeSpanValue => timeSpanValue.Ticks.ToString(CultureInfo.InvariantCulture), // TODO: More types here _ => null, });
void AddButton(string text, LayoutOptions options) { var button = new Button { Text = text, VerticalOptions = options, HeightRequest = Device.OnPlatform(20, 40, 40), BackgroundColor = Device.OnPlatform(Color.White, Color.White, Color.Aqua) }; button.Clicked += (sender, e) => { Title = "StackLayout: " + text; stackLayout.VerticalOptions = options; }; stackLayout.Children.Add(button); stackLayout.Children.Add(new BoxView { BackgroundColor = Color.Yellow, HeightRequest = 1 }); }
public static View CreateEditorFor(string propertyName, LayoutOptions layout, string id = "") { iiEditor iiEditTextBox = new iiEditor { HorizontalOptions = layout, HeightRequest = 200, WidthRequest = 400, ClassId=id, }; iiEditTextBox.SetBinding(Editor.TextProperty, propertyName); return iiEditTextBox; }
public static View CreateEditorFor(string propertyName, LayoutOptions layout) { Editor iiEditTextBox = new Editor { HorizontalOptions = layout, BackgroundColor = Helper.Color.iiPurple.ToFormsColor(), HeightRequest = 200, WidthRequest = 400, }; iiEditTextBox.SetBinding(Editor.TextProperty, propertyName); return iiEditTextBox; }
internal override void ComputeConstraintForView(View view) { LayoutOptions vOptions = view.VerticalOptions; LayoutOptions hOptions = view.HorizontalOptions; var result = LayoutConstraint.None; if (_rows == null || _columns == null) { EnsureRowsColumnsInitialized(); } if (vOptions.Alignment == LayoutAlignment.Fill) { int row = GetRow(view); int rowSpan = GetRowSpan(view); List <RowDefinition> rowDefinitions = _rows; var canFix = true; for (int i = row; i < row + rowSpan && i < rowDefinitions.Count; i++) { GridLength height = rowDefinitions[i].Height; if (height.IsAuto) { canFix = false; break; } if ((Constraint & LayoutConstraint.VerticallyFixed) == 0 && height.IsStar) { canFix = false; break; } } if (canFix) { result |= LayoutConstraint.VerticallyFixed; } } if (hOptions.Alignment == LayoutAlignment.Fill) { int col = GetColumn(view); int colSpan = GetColumnSpan(view); List <ColumnDefinition> columnDefinitions = _columns; var canFix = true; for (int i = col; i < col + colSpan && i < columnDefinitions.Count; i++) { GridLength width = columnDefinitions[i].Width; if (width.IsAuto) { canFix = false; break; } if ((Constraint & LayoutConstraint.HorizontallyFixed) == 0 && width.IsStar) { canFix = false; break; } } if (canFix) { result |= LayoutConstraint.HorizontallyFixed; } } view.ComputedConstraint = result; }
/// <summary> /// Searches the vertical options changed. /// </summary> /// <param name="obj">The object.</param> /// <param name="oldValue">The old value.</param> /// <param name="newValue">The new value.</param> private static void SearchVerticalOptionsChanged(BindableObject obj, LayoutOptions oldValue, LayoutOptions newValue) { var autoCompleteView = obj as AutoCompleteView; if (autoCompleteView != null) { autoCompleteView._btnSearch.VerticalOptions = newValue; } }
internal override void ComputeConstraintForView(View view) { LayoutOptions vOptions = view.VerticalOptions; LayoutOptions hOptions = view.HorizontalOptions; var result = LayoutConstraint.None; // grab a snapshot of this grid's structure for computing the constraints var structure = new GridStructure(this); if (vOptions.Alignment == LayoutAlignment.Fill) { int row = GetRow(view); int rowSpan = GetRowSpan(view); List<RowDefinition> rowDefinitions = structure.Rows; var canFix = true; for (int i = row; i < row + rowSpan && i < rowDefinitions.Count; i++) { GridLength height = rowDefinitions[i].Height; if (height.IsAuto) { canFix = false; break; } if ((Constraint & LayoutConstraint.VerticallyFixed) == 0 && height.IsStar) { canFix = false; break; } } if (canFix) result |= LayoutConstraint.VerticallyFixed; } if (hOptions.Alignment == LayoutAlignment.Fill) { int col = GetColumn(view); int colSpan = GetColumnSpan(view); List<ColumnDefinition> columnDefinitions = structure.Columns; var canFix = true; for (int i = col; i < col + colSpan && i < columnDefinitions.Count; i++) { GridLength width = columnDefinitions[i].Width; if (width.IsAuto) { canFix = false; break; } if ((Constraint & LayoutConstraint.HorizontallyFixed) == 0 && width.IsStar) { canFix = false; break; } } if (canFix) result |= LayoutConstraint.HorizontallyFixed; } view.ComputedConstraint = result; }
/// <summary> /// Texts the horizontal options changed. /// </summary> /// <param name="obj">The object.</param> /// <param name="oldValue">The old value.</param> /// <param name="newValue">The new value.</param> private static void TextHorizontalOptionsChanged(BindableObject obj, LayoutOptions oldValue, LayoutOptions newValue) { var autoCompleteView = obj as AutoCompleteView; if (autoCompleteView != null) { autoCompleteView._entText.VerticalOptions = newValue; } }
public static Label GenerateLabelWithLayoutOption(string text, LayoutOptions layoutOption) { return new Label { Text = text, HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = DefaultAppStyles.DefaultTextColor, FontSize = DefaultAppStyles.DefaultFontSize, }; }
public View CreateButtonFor(string propertyName, LayoutOptions layout, string id = "") { iiButton iiButton = new iiButton { //HorizontalOptions = LayoutOptions.FillAndExpand, // Image=(FileImageSource)ImageSource.FromFile(imgscr), BackgroundColor = Xamarin.Forms.Color.Transparent, BorderColor = Xamarin.Forms.Color.White, BorderWidth = 2, WidthRequest = 70, HeightRequest = 40, HorizontalOptions = layout, ClassId = id, }; //iiButton.SetBinding(Button.TextColorProperty, propertyName); return iiButton; }
public static View CreateEntryFor(string propertyName, Color color, LayoutOptions layout) { Entry iiEditTextBox = new Entry { HorizontalOptions = LayoutOptions.FillAndExpand, TextColor = color.ToFormsColor(), Placeholder = propertyName, HeightRequest = 300, }; iiEditTextBox.SetBinding(Entry.TextProperty, propertyName); return iiEditTextBox; }