static IControl SolidColorButton(Text text, Command cmd, Brush foreground, Brush background, Brush hoverColor, Brush altTextColor) { return(Button.Create(cmd, state => Label.Create( text, textAlignment: TextAlignment.Center, font: Theme.DescriptorFont, color: Theme.CurrentTheme.Select(theme => ( theme == Themes.OriginalDark ? altTextColor : foreground)) .Switch()) .Center() .WithBackground(Shapes.Rectangle( fill: Observable.CombineLatest( state.IsEnabled, state.IsHovered, (enabled, hovering) => hovering ? hoverColor : background) .Switch(), cornerRadius: Observable.Return(new CornerRadius(2))))) .WithHeight(DefaultButtonHeight) .SetCursor(Cursor.Pointing)); }
static IControl StrokeButton(Text text, Command cmd, Brush foreground, Brush background, Brush hoverColor) { return(Button.Create(cmd, state => Label.Create( text, textAlignment: TextAlignment.Center, font: Theme.DescriptorFont, color: Observable.CombineLatest( state.IsEnabled, state.IsHovered, (enabled, hovering) => hovering ? hoverColor : foreground) .Switch()) .CenterVertically() .WithBackground(Shapes.Rectangle( fill: background, cornerRadius: Observable.Return(new CornerRadius(2)), stroke: Stroke.Create(1, Observable.CombineLatest( state.IsEnabled, state.IsHovered, (enabled, hovering) => hovering ? hoverColor : foreground) .Switch())))) .WithHeight(DefaultButtonHeight) .SetCursor(Cursor.Pointing)); }
public static IControl TextButton(Text text, Command cmd, Brush color, Brush hoverColor, Font font) { return(Button.Create(cmd, state => Label.Create( text, textAlignment: TextAlignment.Left, font: font, color: Observable.CombineLatest( state.IsEnabled, state.IsHovered, (enabled, hovering) => hovering ? hoverColor : color) .Switch())) .SetCursor(Cursor.Pointing)); }