Control WindowStateDropDown() { var control = new EnumDropDown <WindowState?>(); control.SelectedValueBinding.Bind(this, c => c.DialogWindowState); return(control); }
Control DisplayModeDropDown() { var control = new EnumDropDown <DialogDisplayMode?>(); control.SelectedValueBinding.Bind(this, c => c.DisplayMode); return(control); }
Control CreateBorderType(TreeGridView grid) { var borderType = new EnumDropDown <BorderType>(); borderType.SelectedValueBinding.Bind(grid, g => g.Border); return(borderType); }
private DynamicLayout GenRadSettingsPanel() { //radiant system var radFaceType = new EnumDropDown <HoneybeeSchema.RadiantFaceTypes>(); radFaceType.Bind(_ => _.SelectedValue, _vm, _ => _.RadiantFaceType); //radFaceType.Bind(_ => _.Visible, _vm, _ => _.RadiantVisable); var minOptTime = new NumericStepper() { MinValue = 0, MaxValue = 24, MaximumDecimalPlaces = 1, Increment = 1 }; var switchOverTime = new NumericStepper() { MinValue = 0, MaxValue = 24, MaximumDecimalPlaces = 1, Increment = 1 }; minOptTime.Bind(_ => _.Value, _vm, _ => _.MinOptTime); //minOptTime.Bind(_ => _.Visible, _vm, _ => _.RadiantVisable); switchOverTime.Bind(_ => _.Value, _vm, _ => _.SwitchTime); //switchOverTime.Bind(_ => _.Visible, _vm, _ => _.RadiantVisable); var radSettings = new DynamicLayout(); radSettings.DefaultSpacing = new Size(5, 2); radSettings.Bind(_ => _.Visible, _vm, _ => _.RadiantVisable); radSettings.AddRow("Radiant Face Type:"); radSettings.AddRow(radFaceType); radSettings.AddRow("Minimum Operation Time:"); radSettings.AddRow(minOptTime); radSettings.AddRow("Switch Over Time:"); radSettings.AddRow(switchOverTime); return(radSettings); }
public StepperSection() { var stepper = new Stepper(); LogEvents(stepper); var enabledCheckBox = new CheckBox { Text = "Enabled" }; enabledCheckBox.CheckedBinding.Bind(stepper, s => s.Enabled); var validDirectionsDropDown = new EnumDropDown <StepperValidDirections>(); validDirectionsDropDown.SelectedValueBinding.Bind(stepper, s => s.ValidDirection); Content = new StackLayout { Padding = 10, Spacing = 5, Items = { "Stepper", enabledCheckBox, validDirectionsDropDown, stepper } }; }
Control DisplayModeDropDown() { var control = new EnumDropDown <DialogDisplayMode>(); control.SelectedValueBinding.Bind(() => DisplayMode, val => DisplayMode = val); return(control); }
Control TabPositionControl() { var control = new EnumDropDown <DockPosition>(); control.SelectedValueBinding.Bind(tabControl, t => t.TabPosition); return(control); }
Control ImagePositionControl() { var control = new EnumDropDown <ButtonImagePosition>(); control.Bind(r => r.SelectedValue, this, r => r.ImagePosition); return(control); }
Control GridLinesDropDown(GridView grid) { var control = new EnumDropDown <GridLines>(); control.SelectedValueBinding.Bind(grid, r => r.GridLines); return(control); }
Control MessageBoxTypeCombo() { var control = new EnumDropDown<MessageBoxType>(); var binding = new BindableBinding<MessageBoxSection, MessageBoxType>(this, r => r.MessageBoxType, (r, val) => r.MessageBoxType = val); control.SelectedValueBinding.Bind(binding); return control; }
public PixelOffsetTransforms() { HorizontalContentAlignment = HorizontalAlignment.Stretch; Spacing = 5; var canvas = new TestCanvas(); var offsetMode = new EnumDropDown<PixelOffsetMode>(); offsetMode.SelectedValueBinding.Bind(canvas, c => c.PixelOffsetMode); var testDropDown = new DropDown(); testDropDown.ItemTextBinding = Binding.Property((TestInfo t) => t.Name); testDropDown.SelectedValueBinding.Cast<TestInfo>().Bind(canvas, c => c.Test); testDropDown.DataStore = tests; testDropDown.SelectedIndex = 0; var options = new StackLayout { Orientation = Orientation.Horizontal, VerticalContentAlignment = VerticalAlignment.Center, Spacing = 5, Padding = new Padding(10), Items = { "PixelOffsetMode", offsetMode, "Test", testDropDown } }; Items.Add(options); Items.Add(new StackLayoutItem(canvas, true)); }
public PixelOffsetModeSection() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; var pixelLayoutMode = new EnumDropDown <PixelOffsetMode> { SelectedValue = PixelOffsetMode.None }; var drawable = new Drawable { Size = new Size(600, 250) }; drawable.Paint += (sender, pe) => { pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle); pe.Graphics.PixelOffsetMode = pixelLayoutMode.SelectedValue; Draw(pe.Graphics); }; pixelLayoutMode.SelectedValueChanged += (sender, e) => drawable.Invalidate(); layout.AddCentered(pixelLayoutMode); layout.Add(drawable); Content = layout; }
Control PenCapControl() { var control = new EnumDropDown<PenLineCap>(); control.Bind(c => c.SelectedValue, this, r => r.LineCap); control.SelectedValueChanged += Refresh; return control; }
static Control PrintSelection() { var control = new EnumDropDown <PrintSelection>(); control.SelectedValueBinding.BindDataContext <PrintSettings>(r => r.PrintSelection, (r, v) => r.PrintSelection = v); return(control); }
Control MessageBoxDefaultButtonCombo() { var control = new EnumDropDown<MessageBoxDefaultButton>(); var binding = new ControlBinding<MessageBoxSection, MessageBoxDefaultButton>(this, r => r.MessageBoxDefaultButton, (r, val) => r.MessageBoxDefaultButton = val); control.SelectedValueBinding.Bind(binding); return control; }
Control PenJoinControl() { var control = new EnumDropDown <PenLineJoin>(); control.SelectedValueBinding.Bind(() => LineJoin, val => { LineJoin = val; Refresh(); }); return(control); }
Control PenCapControl() { var control = new EnumDropDown <PenLineCap>(); control.SelectedValueBinding.Bind(() => LineCap, val => { LineCap = val; Refresh(); }); return(control); }
Control EnumCombo() { var control = new EnumDropDown <Keys>(); LogEvents(control); control.SelectedKey = ((int)Keys.E).ToString(); return(control); }
Control MessageBoxTypeCombo() { var control = new EnumDropDown <MessageBoxType>(); var binding = new BindableBinding <MessageBoxSection, MessageBoxType>(this, r => r.MessageBoxType, (r, val) => r.MessageBoxType = val); control.SelectedValueBinding.Bind(binding); return(control); }
Control UserLevelControl() { var control = userLevel = new EnumDropDown <UserLevel> { }; return(control); }
Control PenCapControl() { var control = new EnumDropDown <PenLineCap>(); control.Bind(c => c.SelectedValue, this, r => r.LineCap); control.SelectedValueChanged += Refresh; return(control); }
Control MessageBoxButtonsCombo() { var control = new EnumDropDown <MessageBoxButtons>(); var binding = new ControlBinding <MessageBoxSection, MessageBoxButtons>(this, r => r.MessageBoxButtons, (r, val) => r.MessageBoxButtons = val); control.SelectedValueBinding.Bind(binding); return(control); }
Control UseGraphicsPathClipControl() { var control = new EnumDropDown <ClearClipMode>(); control.SelectedValueBinding.Bind(this, r => r.ClipMode); return(new StackLayout { Orientation = Orientation.Horizontal, Items = { "Clip Mode:", control } }); }
private Container GroupDeviceSettings() { return(new Panel { Visible = false, //Text = "Device Settings", Content = new TableLayout { //Padding = 5, Spacing = new Size(5, 5), Rows = { new TableRow { Cells = { new Label { Text = "Baud Rate", TextAlignment = TextAlignment.Center }, new Label { Text = "Handshake", TextAlignment = TextAlignment.Center }, new Label { Text = "Parity", TextAlignment = TextAlignment.Center }, new Label { Text = "Data Bits", TextAlignment = TextAlignment.Center }, new Label { Text = "Stop Bits", TextAlignment = TextAlignment.Center }, null, }, }, new TableRow { Cells = { (_dropDownBaudRate = new ComboBox{ }), (_dropDownHandshake = new EnumDropDown <Handshake>{ }), (_dropDownParity = new EnumDropDown <Parity>{ }), (_radDataBits = new DropDown{ }), (_radStopBits = new EnumDropDown <StopBits>{ }), null, }, }, null, } } }); }
Control OrientationDropDown(RadioButtonList list) { var control = new EnumDropDown<Orientation>(); control.SelectedValue = list.Orientation; control.SelectedValueChanged += delegate { list.Orientation = control.SelectedValue; }; return TableLayout.AutoSized(control, centered: true); }
Control SetAlignment(TextArea text) { var control = new EnumDropDown<HorizontalAlign>(); control.SelectedValueBinding.Bind(text, t => t.HorizontalAlign); return new TableLayout { Padding = Padding.Empty, Spacing = new Size(5, 5), Rows = { new TableRow(new Label { Text = "Alignment", VerticalAlign = VerticalAlign.Middle }, control) } }; }
static Control SetAlignment(TextArea text) { var control = new EnumDropDown<TextAlignment>(); control.SelectedValueBinding.Bind(text, t => t.TextAlignment); return new TableLayout { Padding = Padding.Empty, Spacing = new Size(5, 5), Rows = { new TableRow(new Label { Text = "Alignment", VerticalAlignment = VerticalAlignment.Center }, control) } }; }
Control WrapLabel() { const string text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; var label = new Label { Text = text }; var wrapDropDown = new EnumDropDown <WrapMode>(); wrapDropDown.SelectedValueBinding.Bind(label, l => l.Wrap); var textAlignmentDropDown = new EnumDropDown <TextAlignment>(); textAlignmentDropDown.SelectedValueBinding.Bind(label, l => l.TextAlignment); var verticalAlignmentDropDown = new EnumDropDown <VerticalAlignment>(); verticalAlignmentDropDown.SelectedValueBinding.Bind(label, l => l.VerticalAlignment); var testVerticalAlignment = new CheckBox { Text = "Test VerticalAlignment" }; testVerticalAlignment.CheckedChanged += (sender, e) => label.Size = new Size(-1, testVerticalAlignment.Checked == true ? 200 : -1); testVerticalAlignment.CheckedBinding.Bind(verticalAlignmentDropDown, c => c.Enabled, DualBindingMode.OneWayToSource); var fontSelector = new FontPicker(); fontSelector.Bind(c => c.Value, label, l => l.Font); Func <Control> spacer = () => new Panel { BackgroundColor = Colors.DarkGray, Size = new Size(10, 10) }; return(new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Items = { TableLayout.Horizontal(5, null, "Wrap:", wrapDropDown, "Font:", fontSelector, null), TableLayout.Horizontal(5, null, testVerticalAlignment, verticalAlignmentDropDown, "TextAlignment:", textAlignmentDropDown, null), spacer(), new TableLayout( new TableRow( spacer(), new TableCell(label, true), spacer() ) ), spacer() } }); }
Control OrientationDropDown(CheckBoxList list) { var control = new EnumDropDown <Orientation>(); control.SelectedValue = list.Orientation; control.SelectedValueChanged += delegate { list.Orientation = control.SelectedValue; }; return(TableLayout.AutoSized(control, centered: true)); }
Control GradientWrapControl() { var control = new EnumDropDown <GradientWrapMode>(); control.SelectedValueBinding.Bind(() => GradientWrap, v => { GradientWrap = v; Refresh(); }); return(control); }
private DynamicLayout GenGeneralPanel() { var layout = new DynamicLayout(); layout.DefaultSpacing = new Size(4, 4); layout.DefaultPadding = new Padding(4); var id = new Label() { Width = 255 }; id.TextBinding.Bind(_vm, (_) => _.Identifier); id.Bind(_ => _.ToolTip, _vm, _ => _.Identifier); layout.AddRow("ID:", id); layout.AddRow(null, new Label() { Visible = false }); // add space var nameTB = new StringText(); nameTB.TextBinding.Bind(_vm, (_) => _.DisplayName); layout.AddRow("Name:", nameTB); var faceTypeText = new TextBox(); faceTypeText.Bind(_ => _.Text, _vm, _ => _.FaceTypeText); var faceTypeDP = new EnumDropDown <HB.FaceType>() { Height = 24 }; faceTypeDP.SelectedValueBinding.Bind(_vm, (_) => _.FaceType); faceTypeDP.Visible = false; faceTypeText.MouseDown += (s, e) => { faceTypeText.Visible = false; faceTypeDP.Visible = true; }; faceTypeDP.LostFocus += (s, e) => { faceTypeText.Visible = true; faceTypeDP.Visible = false; }; var typeDp = new DynamicLayout(); typeDp.AddRow(faceTypeText); typeDp.AddRow(faceTypeDP); layout.AddRow("Face Type:", typeDp); return(layout); }
Control WrapLabel() { var label = new Label { Text = Utility.LoremText }; var wrapDropDown = new EnumDropDown <WrapMode>(); wrapDropDown.SelectedValueBinding.Bind(label, l => l.Wrap); var textAlignmentDropDown = new EnumDropDown <TextAlignment>(); textAlignmentDropDown.SelectedValueBinding.Bind(label, l => l.TextAlignment); var verticalAlignmentDropDown = new EnumDropDown <VerticalAlignment>(); verticalAlignmentDropDown.SelectedValueBinding.Bind(label, l => l.VerticalAlignment); var testVerticalAlignment = new CheckBox { Text = "Test VerticalAlignment" }; testVerticalAlignment.CheckedChanged += (sender, e) => label.Size = new Size(-1, testVerticalAlignment.Checked == true ? 200 : -1); testVerticalAlignment.CheckedBinding.Bind(verticalAlignmentDropDown, c => c.Enabled, DualBindingMode.OneWayToSource); var fontSelector = new FontPicker(); fontSelector.Bind(c => c.Value, label, l => l.Font); Func <Control> spacer = () => new Panel { BackgroundColor = Colors.DarkGray, Size = new Size(10, 10) }; return(new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Items = { TableLayout.Horizontal(5, null, "Wrap:", wrapDropDown, "Font:", fontSelector, null), TableLayout.Horizontal(5, null, testVerticalAlignment, verticalAlignmentDropDown, "TextAlignment:", textAlignmentDropDown, null), spacer(), new TableLayout( new TableRow( spacer(), new TableCell(label, true), spacer() ) ), spacer() } }); }
Control GridLinesDropDown(GridView grid) { var control = new EnumDropDown <GridLines>(); control.SelectedValueBinding.Bind(grid, r => r.GridLines); return(new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { "GridLines", control } }); }
Control DisplayModeDropDown() { dialogDisplayModeDropDown = new EnumDropDown <DialogDisplayMode?>(); dialogDisplayModeDropDown.Bind(c => c.Enabled, typeRadio, Binding.Property((RadioButtonList t) => t.SelectedKey).ToBool("dialog")); dialogDisplayModeDropDown.SelectedValueChanged += (sender, e) => { if (child is Dialog dlg) { dlg.DisplayMode = dialogDisplayModeDropDown.SelectedValue ?? DialogDisplayMode.Default; } }; return(dialogDisplayModeDropDown); }
Control AutoSelectModeDropDown(GridView grid) { var control = new EnumDropDown <AutoSelectMode>(); var textBoxCell = grid.Columns.Select(r => r.DataCell).OfType <TextBoxCell>().First(); control.SelectedValueBinding.Bind(textBoxCell, c => c.AutoSelectMode); var imageTextCell = grid.Columns.Select(r => r.DataCell).OfType <ImageTextCell>().First(); control.SelectedValueBinding.Bind(imageTextCell, c => c.AutoSelectMode); return(control); }
Control TabPositionControl() { var control = new EnumDropDown<DockPosition>(); control.SelectedValueBinding.Bind(tabControl, t => t.TabPosition); return control; }
Control EnumCombo() { var control = new EnumDropDown<Keys>(); LogEvents(control); control.SelectedKey = ((int)Keys.E).ToString(); return control; }
Control WrapLabel() { const string text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum"; var label = new Label { Text = text }; var wrapDropDown = new EnumDropDown<WrapMode>(); wrapDropDown.SelectedValueBinding.Bind(label, l => l.Wrap); var textAlignmentDropDown = new EnumDropDown<TextAlignment>(); textAlignmentDropDown.SelectedValueBinding.Bind(label, l => l.TextAlignment); Func<Control> spacer = () => new Panel { BackgroundColor = Colors.DarkGray, Size = new Size(10, 10) }; return new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Items = { new StackLayoutItem(new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { "Wrap:", wrapDropDown, "TextAlignment:", textAlignmentDropDown } }, HorizontalAlignment.Center), spacer(), new TableLayout( new TableRow( spacer(), new TableCell(label, true), spacer() ) ), spacer() } }; }
Control GradientWrapControl() { var control = new EnumDropDown<GradientWrapMode>(); control.SelectedValueBinding.Bind(() => GradientWrap, v => { GradientWrap = v; Refresh(); }); return control; }
public RichTextAreaSection() { var richText = new RichTextArea(); richText.Size = new Size(-1, 300); richText.Text = LoremText; var range = new Range<int>(6, 10); var buffer = richText.Buffer; buffer.SetFont(range, Fonts.Cursive(20, FontStyle.Bold, FontDecoration.Underline)); buffer.SetForeground(range, Colors.Blue); buffer.SetBackground(range, Colors.Yellow); buffer.SetBold(new Range<int>(11, 16), true); buffer.SetItalic(new Range<int>(18, 20), true); buffer.SetUnderline(new Range<int>(22, 25), true); buffer.SetStrikethrough(new Range<int>(28, 38), true); richText.CaretIndex = LoremText.Length - 1; richText.SelectionChanged += (sender, e) => { UpdateBindings(BindingUpdateMode.Destination); Log.Write(sender, "SelectionChanged: {0}", richText.Selection); }; var boldButton = new CheckBox { Text = "Bold" }; boldButton.CheckedBinding.Bind(richText, r => r.SelectionBold); boldButton.CheckedChanged += (sender, e) => { richText.Focus(); UpdateBindings(BindingUpdateMode.Destination); }; var italicButton = new CheckBox { Text = "Italic" }; italicButton.CheckedBinding.Bind(richText, r => r.SelectionItalic); italicButton.CheckedChanged += (sender, e) => { richText.Focus(); UpdateBindings(BindingUpdateMode.Destination); }; var underlineButton = new CheckBox { Text = "Underline" }; underlineButton.CheckedBinding.Bind(richText, r => r.SelectionUnderline); underlineButton.CheckedChanged += (sender, e) => richText.Focus(); var strikethroughButton = new CheckBox { Text = "Strikethrough" }; strikethroughButton.CheckedBinding.Bind(richText, r => r.SelectionStrikethrough); strikethroughButton.CheckedChanged += (sender, e) => richText.Focus(); var backgroundButton = new ColorPicker { }; backgroundButton.ValueBinding.Bind(() => richText.SelectionBackground, val => richText.SelectionBackground = val, h => Binding.AddPropertyEvent(richText, r => r.SelectionBackground, h), h => Binding.RemovePropertyEvent(richText, h)); backgroundButton.ValueChanged += (sender, e) => richText.Focus(); var foregroundButton = new ColorPicker { }; foregroundButton.ValueBinding.Bind(richText, r => r.SelectionForeground); foregroundButton.ValueChanged += (sender, e) => richText.Focus(); var fontButton = new Button(); fontButton.Bind(c => c.Text, new DelegateBinding<string>(() => { var font = richText.SelectionFont; if (font == null) return "<No Font>"; return string.Format("{0}, {1}, {2:0.00}pt", font.FamilyName, font.Typeface.Name, font.Size); })); var fd = new FontDialog(); fontButton.Click += (sender, e) => { fd.Font = richText.SelectionFont; fd.FontChanged += (s, ee) => { richText.SelectionFont = fd.Font; UpdateBindings(BindingUpdateMode.Destination); }; if (fd.ShowDialog(this) == DialogResult.Ok) richText.Focus(); }; var familyDropDown = new DropDown(); familyDropDown.DataStore = Fonts.AvailableFontFamilies.OrderBy(r => r.Name); familyDropDown.SelectedValueBinding.Bind(richText, r => r.SelectionFamily); familyDropDown.SelectedValueChanged += (sender, e) => { richText.Focus(); UpdateBindings(BindingUpdateMode.Destination); }; var formatEnum = new EnumDropDown<RichTextAreaFormat>(); formatEnum.SelectedValue = RichTextAreaFormat.Rtf; var loadButton = new Button { Text = "Load" }; loadButton.Enabled = buffer.SupportedFormats.Contains(formatEnum.SelectedValue); loadButton.Click += (sender, e) => buffer.Load(new MemoryStream(Encoding.UTF8.GetBytes(formatEnum.SelectedValue == RichTextAreaFormat.Rtf ? RtfString : LoremText)), formatEnum.SelectedValue); var saveButton = new Button { Text = "Save" }; saveButton.Enabled = buffer.SupportedFormats.Contains(formatEnum.SelectedValue); saveButton.Click += (sender, e) => { var stream = new MemoryStream(); buffer.Save(stream, formatEnum.SelectedValue); stream.Position = 0; Log.Write(richText, "Saved {0}:\n{1}", formatEnum.SelectedValue, new StreamReader(stream).ReadToEnd()); }; formatEnum.SelectedValueChanged += (sender, e) => saveButton.Enabled = loadButton.Enabled = buffer.SupportedFormats.Contains(formatEnum.SelectedValue); var clearButton = new Button { Text = "Clear" }; clearButton.Click += (sender, e) => buffer.Clear(); var formatting1 = new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { null, boldButton, italicButton, underlineButton, strikethroughButton, null } }; var formatting2 = new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { null, new Label { Text = "Foreground", VerticalAlignment = VerticalAlignment.Center }, TableLayout.AutoSized(foregroundButton, centered: true), new Label { Text = "Background", VerticalAlignment = VerticalAlignment.Center }, TableLayout.AutoSized(backgroundButton, centered: true), null } }; var formatting3 = new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { null, fontButton, familyDropDown, null } }; var buttons = new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { null, formatEnum, loadButton, saveButton, clearButton, null } }; Content = new StackLayout { Padding = new Padding(10), Spacing = 5, HorizontalContentAlignment = HorizontalAlignment.Stretch, Items = { buttons, TextAreaSection.TextAreaOptions(richText), TextAreaSection.TextAreaOptions2(richText), TextAreaSection.TextAreaOptions3(richText), formatting1, formatting2, formatting3, new StackLayoutItem(richText, expand: true) } }; }
Control ImagePositionControl() { var control = new EnumDropDown<ButtonImagePosition>(); control.Bind(r => r.SelectedValue, this, r => r.ImagePosition); return control; }
static Control PrintSelection() { var control = new EnumDropDown<PrintSelection>(); control.SelectedValueBinding.BindDataContext<PrintSettings>(r => r.PrintSelection, (r, v) => r.PrintSelection = v); return control; }
Control DisplayModeDropDown() { var control = new EnumDropDown<DialogDisplayMode>(); control.SelectedValueBinding.Bind(() => DisplayMode, val => DisplayMode = val); return control; }
Control UseGraphicsPathClipControl() { var control = new EnumDropDown<ClearClipMode>(); control.SelectedValueBinding.Bind(this, r => r.ClipMode); return new StackLayout { Orientation = Orientation.Horizontal, Items = { "Clip Mode:", control } }; }
Control PenJoinControl() { var control = new EnumDropDown<PenLineJoin>(); control.SelectedValueBinding.Bind(() => LineJoin, val => { LineJoin = val; Refresh(); }); return control; }
Control PenCapControl() { var control = new EnumDropDown<PenLineCap>(); control.SelectedValueBinding.Bind(() => LineCap, val => { LineCap = val; Refresh(); }); return control; }
Control GridLinesDropDown(GridView grid) { var control = new EnumDropDown<GridLines>(); control.SelectedValueBinding.Bind(grid, r => r.GridLines); return new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { "GridLines", control } }; }
/// <summary> /// Tính số ngày phép năm được cộng thêm do thâm niên theo quy định. /// </summary> /// <param name="monthYearEval">Tháng tính</param> /// <param name="monthYearEffect">Ngày áp dụng quy định</param> /// <param name="dateHire">Ngày vào làm của một nhân viên</param> /// <param name="optionReceive"></param> /// <param name="seniorityConfig">Số năm thâm niên tối thiểu</param> /// <param name="totalDayAnnualLeaveOnYear">Tổng số ngày phép năm</param> /// <returns></returns> public static double GetAnnualBySeniority(DateTime monthYearEval, DateTime monthYearEffect, DateTime? dateHire, EnumDropDown.OptionReceive optionReceive, double? seniorityConfig, double? totalDayAnnualLeaveOnYear) { double result = 0D; if (dateHire.HasValue && seniorityConfig.HasValue) { dateHire = dateHire.Value.Date.AddDays(1 - dateHire.Value.Day); monthYearEffect = monthYearEffect.Date.AddDays(1 - monthYearEffect.Day); dateHire = dateHire.Value < monthYearEffect ? monthYearEffect : dateHire; monthYearEval = monthYearEval.Date.AddDays(1 - monthYearEval.Day); int seniority = Convert.ToInt16(seniorityConfig.Value); DateTime seniorityYear = dateHire.Value.AddYears(seniority); if (optionReceive == EnumDropDown.OptionReceive.E_FULLMONTH) { while (seniorityYear <= monthYearEval) { seniorityYear = seniorityYear.AddYears(seniority); result++; } } else if (optionReceive == EnumDropDown.OptionReceive.E_FULLYEAR || optionReceive == EnumDropDown.OptionReceive.E_RATEBYMONTH) { while (seniorityYear.Year <= monthYearEval.Year) { seniorityYear = seniorityYear.AddYears(seniority); result++; } if (optionReceive == EnumDropDown.OptionReceive.E_RATEBYMONTH) { if (seniorityYear.Month > 1 && seniorityYear.Year == monthYearEval.Year) { totalDayAnnualLeaveOnYear = totalDayAnnualLeaveOnYear.HasValue ? totalDayAnnualLeaveOnYear.Value : 0; double rateSeniority = (1 / totalDayAnnualLeaveOnYear.Value) * (12 - dateHire.Value.Month); result += Math.Round(rateSeniority, 1); } } } else if (optionReceive == EnumDropDown.OptionReceive.E_NEXTYEAR) { //Trường hợp đặc biệt nếu nhân viên vào làm tháng 1 thì tính qua năm sau. while ((seniorityYear.Year == monthYearEval.Year && seniorityYear.Month == 1) || seniorityYear.Year < monthYearEval.Year) { seniorityYear = seniorityYear.AddYears(seniority); result++; } } } return result; }
public ScrollableSection() { var scrollable = CreateScrollable(); var borderType = new EnumDropDown<BorderType>(); borderType.SelectedValueBinding.Bind(scrollable, r => r.Border); var expandWidth = new CheckBox { Text = "Width" }; expandWidth.CheckedBinding.Bind(scrollable, r => r.ExpandContentWidth); var expandHeight = new CheckBox { Text = "Height" }; expandHeight.CheckedBinding.Bind(scrollable, r => r.ExpandContentHeight); var sizeMode = new DropDown { Items = { "Auto", "800x800", "30x30", "1x1" }, SelectedIndex = 0 }; sizeMode.SelectedIndexChanged += (sender, e) => { switch (sizeMode.SelectedIndex) { case 0: scrollable.Content.Size = new Size(-1, -1); break; case 1: scrollable.Content.Size = new Size(800, 800); break; case 2: scrollable.Content.Size = new Size(30, 30); break; case 3: scrollable.Content.Size = new Size(1, 1); break; } }; var options = new StackLayout { Orientation = Orientation.Horizontal, VerticalContentAlignment = VerticalAlignment.Center, Spacing = 5, Items = { "Border:", borderType, "Expand:", expandWidth, expandHeight, "Content Size:", sizeMode } }; Content = new StackLayout { Padding = 10, Spacing = 5, HorizontalContentAlignment = HorizontalAlignment.Stretch, Items = { new StackLayoutItem(options, HorizontalAlignment.Center), new StackLayoutItem(scrollable, true) } }; }
Button TestHiding() { var control = new Button { Text = "Test Hiding" }; control.Click += (sender, e) => { var form = new Form(); using (Context) { var splitter = new Splitter { Orientation = Orientation.Horizontal, FixedPanel = SplitterFixedPanel.None, RelativePosition = 0.5, Panel1 = new Panel { Padding = 20, BackgroundColor = Colors.Red, Content = new Panel { BackgroundColor = Colors.White, Size = new Size(200, 400) } }, Panel2 = new Panel { Padding = 20, BackgroundColor = Colors.Blue, Content = new Panel { BackgroundColor = Colors.White, Size = new Size(200, 400) } } }; var showPanel1 = new CheckBox { Text = "Panel1.Visible" }; showPanel1.CheckedBinding.Bind(splitter.Panel1, r => r.Visible); var showPanel2 = new CheckBox { Text = "Panel2.Visible" }; showPanel2.CheckedBinding.Bind(splitter.Panel2, r => r.Visible); var fixedPanel = new EnumDropDown<SplitterFixedPanel>(); fixedPanel.SelectedValueBinding.Bind(splitter, r => r.FixedPanel); var orientation = new EnumDropDown<Orientation>(); orientation.SelectedValueBinding.Bind(splitter, r => r.Orientation); var splitPanel = new Panel { Content = splitter }; var showSplitter = new CheckBox { Text = "Show Splitter", Checked = true }; showSplitter.CheckedChanged += (sender2, e2) => { if (showSplitter.Checked == true) splitPanel.Content = splitter; else splitPanel.Content = null; }; var buttons = new StackLayout { Orientation = Orientation.Horizontal, Items = { showSplitter, showPanel1, showPanel2, fixedPanel, orientation } }; form.Content = new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Items = { buttons, new StackLayoutItem(splitPanel, true) } }; } form.Show(); }; return control; }