private void UpdateButtonStyle() { if (Control != null) { var style = FluentButton.GetButtonStyle(Element); var newStyle = MSFButtonStyle.PrimaryFilled; switch (style) { case FluentButtonStyle.PrimaryFilled: newStyle = MSFButtonStyle.PrimaryFilled; break; case FluentButtonStyle.PrimaryOutLine: newStyle = MSFButtonStyle.PrimaryOutline; break; case FluentButtonStyle.SecondaryOutLine: newStyle = MSFButtonStyle.SecondaryOutline; break; case FluentButtonStyle.TertiaryOutline: newStyle = MSFButtonStyle.TertiaryOutline; break; case FluentButtonStyle.Borderless: newStyle = MSFButtonStyle.Borderless; break; } ((MSFButton)Control).Style = newStyle; } }
public FluentButton Button(Action <FluentButton> viewInstance = null) { var builder = new FluentButton(); viewInstance?.Invoke(builder); _view(builder); return(builder); }
private FluentButton createButton(ButtonStyle style, bool isEnabled = true, bool hasIcon = true, bool hasText = true) { var button = new FluentButton { Style = style, AutoSizeAxes = Axes.X, }; button.Enabled.Value = isEnabled; if (hasText) { button.Text = "Button"; } if (hasIcon) { button.Icon = FluentSystemIcons.Circle24; } return(button); }
public CalculatorPage() { this.BackgroundColor(Color.Black).Title("Calculator").Padding(3) .GridContent(grid => { Button AddNumberButton(string number, int x, int y, int columnSpan = 1) => grid.Add(x, y, columnSpan: columnSpan).Button() .Text(text: number, size: 36) .BackgroundColor(Color.White).OnClicked(NumberSelected); Button AddOperatorButton(string operator_, int x, int y, int columnSpan = 1) => grid.Add(x, y, columnSpan: columnSpan).Button() .Text(text: operator_, size: 36) .BackgroundColor(Color.FromRgb(0xff, 0xa5, 0)).OnClicked(OperatorSelected); var test = new FluentButton().Margin(0); grid.Add(columnSpan: 4).Label() .Margin(5) .TextAlign(hAlign: TextAlignment.End, vAlign: TextAlignment.Center) .Text("0", size: 48, fontAttribute: FontAttributes.Bold, color: Color.White) .Reference(out _resultLabel); //Row 0 AddNumberButton("7", 1, 0); //Row 1 AddNumberButton("8", 1, 1); AddNumberButton("9", 1, 2); AddOperatorButton("÷", 1, 3); AddNumberButton("4", 2, 0); //Row 2 AddNumberButton("5", 2, 1); AddNumberButton("6", 2, 2); AddOperatorButton("x", 2, 3); AddNumberButton("1", 3, 0); //Row 3 AddNumberButton("2", 3, 1); AddNumberButton("3", 3, 2); AddOperatorButton("-", 3, 3); AddNumberButton("0", 4, 0, columnSpan: 3); //Row 4 AddOperatorButton("+", 4, 3); AddOperatorButton("C", 5, 0).BackgroundColor(Color.LightGray); //Row 5 AddOperatorButton("=", 5, 1, columnSpan: 3); }); }