One of my reservations about how BlazorBindings was implemented is how much work it will take to bring third party controls onboard.
I have a development that takes another approach entirely by allowing any third party library to work with BlazorBindings. It uses a generator to generate binding codes bridge between the controls and Blazor component.
public partial class Button : ComponentToMAUIBridge<Microsoft.Maui.Controls.Button, Button>
{
public Button()
{
}
public Button(Microsoft.Maui.Controls.Button _element):base(_element)
{
}
[Parameter] public System.EventHandler Clicked { set => P.Clicked += value; }
EventCallback _onClicked;
[Parameter] public EventCallback OnClicked { set { if (!_onClicked.HasDelegate) { P.Clicked += (s, e) => _onClicked.InvokeAsync(e); } _onClicked = value; } }
[Parameter] public System.EventHandler Pressed { set => P.Pressed += value; }
EventCallback _onPressed;
[Parameter] public EventCallback OnPressed { set { if (!_onPressed.HasDelegate) { P.Pressed += (s, e) => _onPressed.InvokeAsync(e); } _onPressed = value; } }
[Parameter] public System.EventHandler Released { set => P.Released += value; }
EventCallback _onReleased;
[Parameter] public EventCallback OnReleased { set { if (!_onReleased.HasDelegate) { P.Released += (s, e) => _onReleased.InvokeAsync(e); } _onReleased = value; } }
[Parameter] public System.EventHandler ChildrenReordered { set => P.ChildrenReordered += value; }
EventCallback _onChildrenReordered;
[Parameter] public EventCallback OnChildrenReordered { set { if (!_onChildrenReordered.HasDelegate) { P.ChildrenReordered += (s, e) => _onChildrenReordered.InvokeAsync(e); } _onChildrenReordered = value; } }
[Parameter] public System.EventHandler<Microsoft.Maui.Controls.FocusEventArgs> Focused { set => P.Focused += value; }
EventCallback<Microsoft.Maui.Controls.FocusEventArgs> _onFocused;
[Parameter] public EventCallback<Microsoft.Maui.Controls.FocusEventArgs> OnFocused { set { if (!_onFocused.HasDelegate) { P.Focused += (s, e) => _onFocused.InvokeAsync(e); } _onFocused = value; } }
[Parameter] public System.EventHandler MeasureInvalidated { set => P.MeasureInvalidated += value; }
EventCallback _onMeasureInvalidated;
[Parameter] public EventCallback OnMeasureInvalidated { set { if (!_onMeasureInvalidated.HasDelegate) { P.MeasureInvalidated += (s, e) => _onMeasureInvalidated.InvokeAsync(e); } _onMeasureInvalidated = value; } }
[Parameter] public System.EventHandler SizeChanged { set => P.SizeChanged += value; }
EventCallback _onSizeChanged;
[Parameter] public EventCallback OnSizeChanged { set { if (!_onSizeChanged.HasDelegate) { P.SizeChanged += (s, e) => _onSizeChanged.InvokeAsync(e); } _onSizeChanged = value; } }
[Parameter] public System.EventHandler<Microsoft.Maui.Controls.FocusEventArgs> Unfocused { set => P.Unfocused += value; }
EventCallback<Microsoft.Maui.Controls.FocusEventArgs> _onUnfocused;
[Parameter] public EventCallback<Microsoft.Maui.Controls.FocusEventArgs> OnUnfocused { set { if (!_onUnfocused.HasDelegate) { P.Unfocused += (s, e) => _onUnfocused.InvokeAsync(e); } _onUnfocused = value; } }
[Parameter] public System.EventHandler<Microsoft.Maui.Controls.Internals.EventArg<Microsoft.Maui.Controls.VisualElement>> BatchCommitted { set => P.BatchCommitted += value; }
EventCallback<Microsoft.Maui.Controls.Internals.EventArg<Microsoft.Maui.Controls.VisualElement>> _onBatchCommitted;
[Parameter] public EventCallback<Microsoft.Maui.Controls.Internals.EventArg<Microsoft.Maui.Controls.VisualElement>> OnBatchCommitted { set { if (!_onBatchCommitted.HasDelegate) { P.BatchCommitted += (s, e) => _onBatchCommitted.InvokeAsync(e); } _onBatchCommitted = value; } }
[Parameter] public System.EventHandler<Microsoft.Maui.Controls.VisualElement.FocusRequestArgs> FocusChangeRequested { set => P.FocusChangeRequested += value; }
EventCallback<Microsoft.Maui.Controls.VisualElement.FocusRequestArgs> _onFocusChangeRequested;
[Parameter] public EventCallback<Microsoft.Maui.Controls.VisualElement.FocusRequestArgs> OnFocusChangeRequested { set { if (!_onFocusChangeRequested.HasDelegate) { P.FocusChangeRequested += (s, e) => _onFocusChangeRequested.InvokeAsync(e); } _onFocusChangeRequested = value; } }
[Parameter] public System.EventHandler Loaded { set => P.Loaded += value; }
EventCallback _onLoaded;
[Parameter] public EventCallback OnLoaded { set { if (!_onLoaded.HasDelegate) { P.Loaded += (s, e) => _onLoaded.InvokeAsync(e); } _onLoaded = value; } }
[Parameter] public System.EventHandler Unloaded { set => P.Unloaded += value; }
EventCallback _onUnloaded;
[Parameter] public EventCallback OnUnloaded { set { if (!_onUnloaded.HasDelegate) { P.Unloaded += (s, e) => _onUnloaded.InvokeAsync(e); } _onUnloaded = value; } }
[Parameter] public System.EventHandler<Microsoft.Maui.Controls.ElementEventArgs> ChildAdded { set => P.ChildAdded += value; }
EventCallback<Microsoft.Maui.Controls.ElementEventArgs> _onChildAdded;
[Parameter] public EventCallback<Microsoft.Maui.Controls.ElementEventArgs> OnChildAdded { set { if (!_onChildAdded.HasDelegate) { P.ChildAdded += (s, e) => _onChildAdded.InvokeAsync(e); } _onChildAdded = value; } }
[Parameter] public System.EventHandler<Microsoft.Maui.Controls.ElementEventArgs> ChildRemoved { set => P.ChildRemoved += value; }
EventCallback<Microsoft.Maui.Controls.ElementEventArgs> _onChildRemoved;
[Parameter] public EventCallback<Microsoft.Maui.Controls.ElementEventArgs> OnChildRemoved { set { if (!_onChildRemoved.HasDelegate) { P.ChildRemoved += (s, e) => _onChildRemoved.InvokeAsync(e); } _onChildRemoved = value; } }
[Parameter] public System.EventHandler<Microsoft.Maui.Controls.ElementEventArgs> DescendantAdded { set => P.DescendantAdded += value; }
EventCallback<Microsoft.Maui.Controls.ElementEventArgs> _onDescendantAdded;
[Parameter] public EventCallback<Microsoft.Maui.Controls.ElementEventArgs> OnDescendantAdded { set { if (!_onDescendantAdded.HasDelegate) { P.DescendantAdded += (s, e) => _onDescendantAdded.InvokeAsync(e); } _onDescendantAdded = value; } }
[Parameter] public System.EventHandler<Microsoft.Maui.Controls.ElementEventArgs> DescendantRemoved { set => P.DescendantRemoved += value; }
EventCallback<Microsoft.Maui.Controls.ElementEventArgs> _onDescendantRemoved;
[Parameter] public EventCallback<Microsoft.Maui.Controls.ElementEventArgs> OnDescendantRemoved { set { if (!_onDescendantRemoved.HasDelegate) { P.DescendantRemoved += (s, e) => _onDescendantRemoved.InvokeAsync(e); } _onDescendantRemoved = value; } }
[Parameter] public System.EventHandler<Microsoft.Maui.Controls.ParentChangingEventArgs> ParentChanging { set => P.ParentChanging += value; }
EventCallback<Microsoft.Maui.Controls.ParentChangingEventArgs> _onParentChanging;
[Parameter] public EventCallback<Microsoft.Maui.Controls.ParentChangingEventArgs> OnParentChanging { set { if (!_onParentChanging.HasDelegate) { P.ParentChanging += (s, e) => _onParentChanging.InvokeAsync(e); } _onParentChanging = value; } }
[Parameter] public System.EventHandler ParentChanged { set => P.ParentChanged += value; }
EventCallback _onParentChanged;
[Parameter] public EventCallback OnParentChanged { set { if (!_onParentChanged.HasDelegate) { P.ParentChanged += (s, e) => _onParentChanged.InvokeAsync(e); } _onParentChanged = value; } }
[Parameter] public System.EventHandler<Microsoft.Maui.Controls.HandlerChangingEventArgs> HandlerChanging { set => P.HandlerChanging += value; }
EventCallback<Microsoft.Maui.Controls.HandlerChangingEventArgs> _onHandlerChanging;
[Parameter] public EventCallback<Microsoft.Maui.Controls.HandlerChangingEventArgs> OnHandlerChanging { set { if (!_onHandlerChanging.HasDelegate) { P.HandlerChanging += (s, e) => _onHandlerChanging.InvokeAsync(e); } _onHandlerChanging = value; } }
[Parameter] public System.EventHandler HandlerChanged { set => P.HandlerChanged += value; }
EventCallback _onHandlerChanged;
[Parameter] public EventCallback OnHandlerChanged { set { if (!_onHandlerChanged.HasDelegate) { P.HandlerChanged += (s, e) => _onHandlerChanged.InvokeAsync(e); } _onHandlerChanged = value; } }
[Parameter] public System.EventHandler BindingContextChanged { set => P.BindingContextChanged += value; }
EventCallback _onBindingContextChanged;
[Parameter] public EventCallback OnBindingContextChanged { set { if (!_onBindingContextChanged.HasDelegate) { P.BindingContextChanged += (s, e) => _onBindingContextChanged.InvokeAsync(e); } _onBindingContextChanged = value; } }
[Parameter] public Microsoft.Maui.Thickness Padding { set => P.Padding = value; get => P.Padding; }
[Parameter] public Microsoft.Maui.Controls.Binding BindPadding { set { P.SetBinding(Microsoft.Maui.Controls.Button.PaddingProperty, value); } }
[Parameter] public Microsoft.Maui.LineBreakMode LineBreakMode { set => P.LineBreakMode = value; get => P.LineBreakMode; }
[Parameter] public Microsoft.Maui.Controls.Binding BindLineBreakMode { set { P.SetBinding(Microsoft.Maui.Controls.Button.LineBreakModeProperty, value); } }
[Parameter] public Microsoft.Maui.Graphics.Color BorderColor { set => P.BorderColor = value; get => P.BorderColor; }
[Parameter] public Microsoft.Maui.Controls.Binding BindBorderColor { set { P.SetBinding(Microsoft.Maui.Controls.Button.BorderColorProperty, value); } }
[Parameter] public System.Int32 CornerRadius { set => P.CornerRadius = value; get => P.CornerRadius; }
[Parameter] public Microsoft.Maui.Controls.Binding BindCornerRadius { set { P.SetBinding(Microsoft.Maui.Controls.Button.CornerRadiusProperty, value); } }
[Parameter] public System.Double BorderWidth { set => P.BorderWidth = value; get => P.BorderWidth; }
[Parameter] public Microsoft.Maui.Controls.Binding BindBorderWidth { set { P.SetBinding(Microsoft.Maui.Controls.Button.BorderWidthProperty, value); } }
[Parameter] public Microsoft.Maui.Controls.Button.ButtonContentLayout ContentLayout { set => P.ContentLayout = value; get => P.ContentLayout; }
[Parameter] public Microsoft.Maui.Controls.Binding BindContentLayout { set { P.SetBinding(Microsoft.Maui.Controls.Button.ContentLayoutProperty, value); } }
[Parameter] public System.Windows.Input.ICommand Command { set => P.Command = value; get => P.Command; }
[Parameter] public Microsoft.Maui.Controls.Binding BindCommand { set { P.SetBinding(Microsoft.Maui.Controls.Button.CommandProperty, value); } }
[Parameter] public EventCallback OnCommand { set { Command = new Microsoft.Maui.Controls.Command(async () => { await value.InvokeAsync(this); }); } }
[Parameter] public System.Object CommandParameter { set => P.CommandParameter = value; get => P.CommandParameter; }
[Parameter] public Microsoft.Maui.Controls.Binding BindCommandParameter { set { P.SetBinding(Microsoft.Maui.Controls.Button.CommandParameterProperty, value); } }
[Parameter] public Microsoft.Maui.Controls.ImageSource ImageSource { set => P.ImageSource = value; get => P.ImageSource; }
[Parameter] public Microsoft.Maui.Controls.Binding BindImageSource { set { P.SetBinding(Microsoft.Maui.Controls.Button.ImageSourceProperty, value); } }
[Parameter] public System.String Text { set => P.Text = value; get => P.Text; }
[Parameter] public Microsoft.Maui.Controls.Binding BindText { set { P.SetBinding(Microsoft.Maui.Controls.Button.TextProperty, value); } }
[Parameter] public Microsoft.Maui.Graphics.Color TextColor { set => P.TextColor = value; get => P.TextColor; }
[Parameter] public Microsoft.Maui.Controls.Binding BindTextColor { set { P.SetBinding(Microsoft.Maui.Controls.Button.TextColorProperty, value); } }
[Parameter] public System.Double CharacterSpacing { set => P.CharacterSpacing = value; get => P.CharacterSpacing; }
[Parameter] public Microsoft.Maui.Controls.Binding BindCharacterSpacing { set { P.SetBinding(Microsoft.Maui.Controls.Button.CharacterSpacingProperty, value); } }
[Parameter] public Microsoft.Maui.Controls.FontAttributes FontAttributes { set => P.FontAttributes = value; get => P.FontAttributes; }
[Parameter] public Microsoft.Maui.Controls.Binding BindFontAttributes { set { P.SetBinding(Microsoft.Maui.Controls.Button.FontAttributesProperty, value); } }
[Parameter] public System.String FontFamily { set => P.FontFamily = value; get => P.FontFamily; }
[Parameter] public Microsoft.Maui.Controls.Binding BindFontFamily { set { P.SetBinding(Microsoft.Maui.Controls.Button.FontFamilyProperty, value); } }
[Parameter] public System.Double FontSize { set => P.FontSize = value; get => P.FontSize; }
[Parameter] public Microsoft.Maui.Controls.Binding BindFontSize { set { P.SetBinding(Microsoft.Maui.Controls.Button.FontSizeProperty, value); } }
[Parameter] public System.Boolean FontAutoScalingEnabled { set => P.FontAutoScalingEnabled = value; get => P.FontAutoScalingEnabled; }
[Parameter] public Microsoft.Maui.Controls.Binding BindFontAutoScalingEnabled { set { P.SetBinding(Microsoft.Maui.Controls.Button.FontAutoScalingEnabledProperty, value); } }
[Parameter] public Microsoft.Maui.TextTransform TextTransform { set => P.TextTransform = value; get => P.TextTransform; }
[Parameter] public Microsoft.Maui.Controls.Binding BindTextTransform { set { P.SetBinding(Microsoft.Maui.Controls.Button.TextTransformProperty, value); } }
[Parameter] public Microsoft.Maui.Controls.LayoutOptions HorizontalOptions { set => P.HorizontalOptions = value; get => P.HorizontalOptions; }
[Parameter] public Microsoft.Maui.Controls.Binding BindHorizontalOptions { set { P.SetBinding(Microsoft.Maui.Controls.Button.HorizontalOptionsProperty, value); } }
[Parameter] public Microsoft.Maui.Thickness Margin { set => P.Margin = value; get => P.Margin; }
[Parameter] public Microsoft.Maui.Controls.Binding BindMargin { set { P.SetBinding(Microsoft.Maui.Controls.Button.MarginProperty, value); } }
[Parameter] public Microsoft.Maui.Controls.LayoutOptions VerticalOptions { set => P.VerticalOptions = value; get => P.VerticalOptions; }
[Parameter] public Microsoft.Maui.Controls.Binding BindVerticalOptions { set { P.SetBinding(Microsoft.Maui.Controls.Button.VerticalOptionsProperty, value); } }
[Parameter] public Microsoft.Maui.Graphics.Rect Frame { set => P.Frame = value; get => P.Frame; }
[Parameter] public Microsoft.Maui.IViewHandler Handler { set => P.Handler = value; get => P.Handler; }
[Parameter] public Microsoft.Maui.Controls.Shadow Shadow { set => P.Shadow = value; get => P.Shadow; }
[Parameter] public Microsoft.Maui.Controls.Binding BindShadow { set { P.SetBinding(Microsoft.Maui.Controls.Button.ShadowProperty, value); } }
[Parameter] public System.Int32 ZIndex { set => P.ZIndex = value; get => P.ZIndex; }
[Parameter] public Microsoft.Maui.Controls.IVisual Visual { set => P.Visual = value; get => P.Visual; }
[Parameter] public Microsoft.Maui.Controls.Binding BindVisual { set { P.SetBinding(Microsoft.Maui.Controls.Button.VisualProperty, value); } }
[Parameter] public Microsoft.Maui.FlowDirection FlowDirection { set => P.FlowDirection = value; get => P.FlowDirection; }
[Parameter] public Microsoft.Maui.Controls.Binding BindFlowDirection { set { P.SetBinding(Microsoft.Maui.Controls.Button.FlowDirectionProperty, value); } }
[Parameter] public System.Double AnchorX { set => P.AnchorX = value; get => P.AnchorX; }
[Parameter] public Microsoft.Maui.Controls.Binding BindAnchorX { set { P.SetBinding(Microsoft.Maui.Controls.Button.AnchorXProperty, value); } }
[Parameter] public System.Double AnchorY { set => P.AnchorY = value; get => P.AnchorY; }
[Parameter] public Microsoft.Maui.Controls.Binding BindAnchorY { set { P.SetBinding(Microsoft.Maui.Controls.Button.AnchorYProperty, value); } }
[Parameter] public Microsoft.Maui.Graphics.Color BackgroundColor { set => P.BackgroundColor = value; get => P.BackgroundColor; }
[Parameter] public Microsoft.Maui.Controls.Binding BindBackgroundColor { set { P.SetBinding(Microsoft.Maui.Controls.Button.BackgroundColorProperty, value); } }
[Parameter] public Microsoft.Maui.Controls.Brush Background { set => P.Background = value; get => P.Background; }
[Parameter] public Microsoft.Maui.Controls.Binding BindBackground { set { P.SetBinding(Microsoft.Maui.Controls.Button.BackgroundProperty, value); } }
[Parameter] public System.Double HeightRequest { set => P.HeightRequest = value; get => P.HeightRequest; }
[Parameter] public Microsoft.Maui.Controls.Binding BindHeightRequest { set { P.SetBinding(Microsoft.Maui.Controls.Button.HeightRequestProperty, value); } }
[Parameter] public System.Boolean InputTransparent { set => P.InputTransparent = value; get => P.InputTransparent; }
[Parameter] public Microsoft.Maui.Controls.Binding BindInputTransparent { set { P.SetBinding(Microsoft.Maui.Controls.Button.InputTransparentProperty, value); } }
[Parameter] public System.Boolean IsEnabled { set => P.IsEnabled = value; get => P.IsEnabled; }
[Parameter] public Microsoft.Maui.Controls.Binding BindIsEnabled { set { P.SetBinding(Microsoft.Maui.Controls.Button.IsEnabledProperty, value); } }
[Parameter] public System.Boolean IsVisible { set => P.IsVisible = value; get => P.IsVisible; }
[Parameter] public Microsoft.Maui.Controls.Binding BindIsVisible { set { P.SetBinding(Microsoft.Maui.Controls.Button.IsVisibleProperty, value); } }
[Parameter] public System.Double MinimumHeightRequest { set => P.MinimumHeightRequest = value; get => P.MinimumHeightRequest; }
[Parameter] public Microsoft.Maui.Controls.Binding BindMinimumHeightRequest { set { P.SetBinding(Microsoft.Maui.Controls.Button.MinimumHeightRequestProperty, value); } }
[Parameter] public System.Double MinimumWidthRequest { set => P.MinimumWidthRequest = value; get => P.MinimumWidthRequest; }
[Parameter] public Microsoft.Maui.Controls.Binding BindMinimumWidthRequest { set { P.SetBinding(Microsoft.Maui.Controls.Button.MinimumWidthRequestProperty, value); } }
[Parameter] public System.Double MaximumHeightRequest { set => P.MaximumHeightRequest = value; get => P.MaximumHeightRequest; }
[Parameter] public Microsoft.Maui.Controls.Binding BindMaximumHeightRequest { set { P.SetBinding(Microsoft.Maui.Controls.Button.MaximumHeightRequestProperty, value); } }
[Parameter] public System.Double MaximumWidthRequest { set => P.MaximumWidthRequest = value; get => P.MaximumWidthRequest; }
[Parameter] public Microsoft.Maui.Controls.Binding BindMaximumWidthRequest { set { P.SetBinding(Microsoft.Maui.Controls.Button.MaximumWidthRequestProperty, value); } }
[Parameter] public System.Double Opacity { set => P.Opacity = value; get => P.Opacity; }
[Parameter] public Microsoft.Maui.Controls.Binding BindOpacity { set { P.SetBinding(Microsoft.Maui.Controls.Button.OpacityProperty, value); } }
[Parameter] public System.Double Rotation { set => P.Rotation = value; get => P.Rotation; }
[Parameter] public Microsoft.Maui.Controls.Binding BindRotation { set { P.SetBinding(Microsoft.Maui.Controls.Button.RotationProperty, value); } }
[Parameter] public System.Double RotationX { set => P.RotationX = value; get => P.RotationX; }
[Parameter] public Microsoft.Maui.Controls.Binding BindRotationX { set { P.SetBinding(Microsoft.Maui.Controls.Button.RotationXProperty, value); } }
[Parameter] public System.Double RotationY { set => P.RotationY = value; get => P.RotationY; }
[Parameter] public Microsoft.Maui.Controls.Binding BindRotationY { set { P.SetBinding(Microsoft.Maui.Controls.Button.RotationYProperty, value); } }
[Parameter] public System.Double Scale { set => P.Scale = value; get => P.Scale; }
[Parameter] public Microsoft.Maui.Controls.Binding BindScale { set { P.SetBinding(Microsoft.Maui.Controls.Button.ScaleProperty, value); } }
[Parameter] public System.Double ScaleX { set => P.ScaleX = value; get => P.ScaleX; }
[Parameter] public Microsoft.Maui.Controls.Binding BindScaleX { set { P.SetBinding(Microsoft.Maui.Controls.Button.ScaleXProperty, value); } }
[Parameter] public System.Double ScaleY { set => P.ScaleY = value; get => P.ScaleY; }
[Parameter] public Microsoft.Maui.Controls.Binding BindScaleY { set { P.SetBinding(Microsoft.Maui.Controls.Button.ScaleYProperty, value); } }
[Parameter] public System.Double TranslationX { set => P.TranslationX = value; get => P.TranslationX; }
[Parameter] public Microsoft.Maui.Controls.Binding BindTranslationX { set { P.SetBinding(Microsoft.Maui.Controls.Button.TranslationXProperty, value); } }
[Parameter] public System.Double TranslationY { set => P.TranslationY = value; get => P.TranslationY; }
[Parameter] public Microsoft.Maui.Controls.Binding BindTranslationY { set { P.SetBinding(Microsoft.Maui.Controls.Button.TranslationYProperty, value); } }
[Parameter] public System.Double WidthRequest { set => P.WidthRequest = value; get => P.WidthRequest; }
[Parameter] public Microsoft.Maui.Controls.Binding BindWidthRequest { set { P.SetBinding(Microsoft.Maui.Controls.Button.WidthRequestProperty, value); } }
[Parameter] public Microsoft.Maui.Controls.Shapes.Geometry Clip { set => P.Clip = value; get => P.Clip; }
[Parameter] public Microsoft.Maui.Controls.Binding BindClip { set { P.SetBinding(Microsoft.Maui.Controls.Button.ClipProperty, value); } }
[Parameter] public System.Boolean DisableLayout { set => P.DisableLayout = value; get => P.DisableLayout; }
[Parameter] public System.Boolean IsInPlatformLayout { set => P.IsInPlatformLayout = value; get => P.IsInPlatformLayout; }
[Parameter] public System.Boolean IsPlatformStateConsistent { set => P.IsPlatformStateConsistent = value; get => P.IsPlatformStateConsistent; }
[Parameter] public System.Boolean IsPlatformEnabled { set => P.IsPlatformEnabled = value; get => P.IsPlatformEnabled; }
[Parameter] public Microsoft.Maui.Controls.ResourceDictionary Resources { set => P.Resources = value; get => P.Resources; }
[Parameter] public Microsoft.Maui.Controls.Style Style { set => P.Style = value; get => P.Style; }
[Parameter] public Microsoft.Maui.Controls.Binding BindStyle { set { P.SetBinding(Microsoft.Maui.Controls.Button.StyleProperty, value); } }
[Parameter] public System.Collections.Generic.IList<System.String> StyleClass { set => P.StyleClass = value; get => P.StyleClass; }
[Parameter] public System.Collections.Generic.IList<System.String> @class { set => P.@class = value; get => P.@class; }
[Parameter] public System.String AutomationId { set => P.AutomationId = value; get => P.AutomationId; }
[Parameter] public Microsoft.Maui.Controls.Binding BindAutomationId { set { P.SetBinding(Microsoft.Maui.Controls.Button.AutomationIdProperty, value); } }
[Parameter] public System.String ClassId { set => P.ClassId = value; get => P.ClassId; }
[Parameter] public Microsoft.Maui.Controls.Binding BindClassId { set { P.SetBinding(Microsoft.Maui.Controls.Button.ClassIdProperty, value); } }
[Parameter] public System.String StyleId { set => P.StyleId = value; get => P.StyleId; }
[Parameter] public Microsoft.Maui.Controls.Element Parent { set => P.Parent = value; get => P.Parent; }
[Parameter] public Microsoft.Maui.Controls.IEffectControlProvider EffectControlProvider { set => P.EffectControlProvider = value; get => P.EffectControlProvider; }
[Parameter] public System.Object BindingContext { set => P.BindingContext = value; get => P.BindingContext; }
[Parameter] public Microsoft.Maui.Controls.Binding BindBindingContext { set { P.SetBinding(Microsoft.Maui.Controls.Button.BindingContextProperty, value); } }
public override Task SetParametersAsync(ParameterView parameters)
{
foreach (var parameter in parameters)
{
switch (parameter.Name)
{
case nameof(Clicked):
Clicked = (System.EventHandler)parameter.Value;
break;
case nameof(OnClicked):
OnClicked = (EventCallback)parameter.Value;
break;
case nameof(Pressed):
Pressed = (System.EventHandler)parameter.Value;
break;
case nameof(OnPressed):
OnPressed = (EventCallback)parameter.Value;
break;
case nameof(Released):
Released = (System.EventHandler)parameter.Value;
break;
case nameof(OnReleased):
OnReleased = (EventCallback)parameter.Value;
break;
case nameof(ChildrenReordered):
ChildrenReordered = (System.EventHandler)parameter.Value;
break;
case nameof(OnChildrenReordered):
OnChildrenReordered = (EventCallback)parameter.Value;
break;
case nameof(Focused):
Focused = (System.EventHandler<Microsoft.Maui.Controls.FocusEventArgs>)parameter.Value;
break;
case nameof(OnFocused):
OnFocused = (EventCallback<Microsoft.Maui.Controls.FocusEventArgs>)parameter.Value;
break;
case nameof(MeasureInvalidated):
MeasureInvalidated = (System.EventHandler)parameter.Value;
break;
case nameof(OnMeasureInvalidated):
OnMeasureInvalidated = (EventCallback)parameter.Value;
break;
case nameof(SizeChanged):
SizeChanged = (System.EventHandler)parameter.Value;
break;
case nameof(OnSizeChanged):
OnSizeChanged = (EventCallback)parameter.Value;
break;
case nameof(Unfocused):
Unfocused = (System.EventHandler<Microsoft.Maui.Controls.FocusEventArgs>)parameter.Value;
break;
case nameof(OnUnfocused):
OnUnfocused = (EventCallback<Microsoft.Maui.Controls.FocusEventArgs>)parameter.Value;
break;
case nameof(BatchCommitted):
BatchCommitted = (System.EventHandler<Microsoft.Maui.Controls.Internals.EventArg<Microsoft.Maui.Controls.VisualElement>>)parameter.Value;
break;
case nameof(OnBatchCommitted):
OnBatchCommitted = (EventCallback<Microsoft.Maui.Controls.Internals.EventArg<Microsoft.Maui.Controls.VisualElement>>)parameter.Value;
break;
case nameof(FocusChangeRequested):
FocusChangeRequested = (System.EventHandler<Microsoft.Maui.Controls.VisualElement.FocusRequestArgs>)parameter.Value;
break;
case nameof(OnFocusChangeRequested):
OnFocusChangeRequested = (EventCallback<Microsoft.Maui.Controls.VisualElement.FocusRequestArgs>)parameter.Value;
break;
case nameof(Loaded):
Loaded = (System.EventHandler)parameter.Value;
break;
case nameof(OnLoaded):
OnLoaded = (EventCallback)parameter.Value;
break;
case nameof(Unloaded):
Unloaded = (System.EventHandler)parameter.Value;
break;
case nameof(OnUnloaded):
OnUnloaded = (EventCallback)parameter.Value;
break;
case nameof(ChildAdded):
ChildAdded = (System.EventHandler<Microsoft.Maui.Controls.ElementEventArgs>)parameter.Value;
break;
case nameof(OnChildAdded):
OnChildAdded = (EventCallback<Microsoft.Maui.Controls.ElementEventArgs>)parameter.Value;
break;
case nameof(ChildRemoved):
ChildRemoved = (System.EventHandler<Microsoft.Maui.Controls.ElementEventArgs>)parameter.Value;
break;
case nameof(OnChildRemoved):
OnChildRemoved = (EventCallback<Microsoft.Maui.Controls.ElementEventArgs>)parameter.Value;
break;
case nameof(DescendantAdded):
DescendantAdded = (System.EventHandler<Microsoft.Maui.Controls.ElementEventArgs>)parameter.Value;
break;
case nameof(OnDescendantAdded):
OnDescendantAdded = (EventCallback<Microsoft.Maui.Controls.ElementEventArgs>)parameter.Value;
break;
case nameof(DescendantRemoved):
DescendantRemoved = (System.EventHandler<Microsoft.Maui.Controls.ElementEventArgs>)parameter.Value;
break;
case nameof(OnDescendantRemoved):
OnDescendantRemoved = (EventCallback<Microsoft.Maui.Controls.ElementEventArgs>)parameter.Value;
break;
case nameof(ParentChanging):
ParentChanging = (System.EventHandler<Microsoft.Maui.Controls.ParentChangingEventArgs>)parameter.Value;
break;
case nameof(OnParentChanging):
OnParentChanging = (EventCallback<Microsoft.Maui.Controls.ParentChangingEventArgs>)parameter.Value;
break;
case nameof(ParentChanged):
ParentChanged = (System.EventHandler)parameter.Value;
break;
case nameof(OnParentChanged):
OnParentChanged = (EventCallback)parameter.Value;
break;
case nameof(HandlerChanging):
HandlerChanging = (System.EventHandler<Microsoft.Maui.Controls.HandlerChangingEventArgs>)parameter.Value;
break;
case nameof(OnHandlerChanging):
OnHandlerChanging = (EventCallback<Microsoft.Maui.Controls.HandlerChangingEventArgs>)parameter.Value;
break;
case nameof(HandlerChanged):
HandlerChanged = (System.EventHandler)parameter.Value;
break;
case nameof(OnHandlerChanged):
OnHandlerChanged = (EventCallback)parameter.Value;
break;
case nameof(BindingContextChanged):
BindingContextChanged = (System.EventHandler)parameter.Value;
break;
case nameof(OnBindingContextChanged):
OnBindingContextChanged = (EventCallback)parameter.Value;
break;
case nameof(Padding):
Padding = (Microsoft.Maui.Thickness)parameter.Value;
break;
case nameof(BindPadding):
BindPadding = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(LineBreakMode):
LineBreakMode = (Microsoft.Maui.LineBreakMode)parameter.Value;
break;
case nameof(BindLineBreakMode):
BindLineBreakMode = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(BorderColor):
BorderColor = (Microsoft.Maui.Graphics.Color)parameter.Value;
break;
case nameof(BindBorderColor):
BindBorderColor = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(CornerRadius):
CornerRadius = (System.Int32)parameter.Value;
break;
case nameof(BindCornerRadius):
BindCornerRadius = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(BorderWidth):
BorderWidth = (System.Double)parameter.Value;
break;
case nameof(BindBorderWidth):
BindBorderWidth = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(ContentLayout):
ContentLayout = (Microsoft.Maui.Controls.Button.ButtonContentLayout)parameter.Value;
break;
case nameof(BindContentLayout):
BindContentLayout = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(Command):
Command = (System.Windows.Input.ICommand)parameter.Value;
break;
case nameof(BindCommand):
BindCommand = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(OnCommand):
OnCommand = (EventCallback)parameter.Value;
break;
case nameof(CommandParameter):
CommandParameter = (System.Object)parameter.Value;
break;
case nameof(BindCommandParameter):
BindCommandParameter = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(ImageSource):
ImageSource = (Microsoft.Maui.Controls.ImageSource)parameter.Value;
break;
case nameof(BindImageSource):
BindImageSource = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(Text):
Text = (System.String)parameter.Value;
break;
case nameof(BindText):
BindText = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(TextColor):
TextColor = (Microsoft.Maui.Graphics.Color)parameter.Value;
break;
case nameof(BindTextColor):
BindTextColor = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(CharacterSpacing):
CharacterSpacing = (System.Double)parameter.Value;
break;
case nameof(BindCharacterSpacing):
BindCharacterSpacing = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(FontAttributes):
FontAttributes = (Microsoft.Maui.Controls.FontAttributes)parameter.Value;
break;
case nameof(BindFontAttributes):
BindFontAttributes = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(FontFamily):
FontFamily = (System.String)parameter.Value;
break;
case nameof(BindFontFamily):
BindFontFamily = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(FontSize):
FontSize = (System.Double)parameter.Value;
break;
case nameof(BindFontSize):
BindFontSize = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(FontAutoScalingEnabled):
FontAutoScalingEnabled = (System.Boolean)parameter.Value;
break;
case nameof(BindFontAutoScalingEnabled):
BindFontAutoScalingEnabled = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(TextTransform):
TextTransform = (Microsoft.Maui.TextTransform)parameter.Value;
break;
case nameof(BindTextTransform):
BindTextTransform = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(HorizontalOptions):
HorizontalOptions = (Microsoft.Maui.Controls.LayoutOptions)parameter.Value;
break;
case nameof(BindHorizontalOptions):
BindHorizontalOptions = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(Margin):
Margin = (Microsoft.Maui.Thickness)parameter.Value;
break;
case nameof(BindMargin):
BindMargin = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(VerticalOptions):
VerticalOptions = (Microsoft.Maui.Controls.LayoutOptions)parameter.Value;
break;
case nameof(BindVerticalOptions):
BindVerticalOptions = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(Frame):
Frame = (Microsoft.Maui.Graphics.Rect)parameter.Value;
break;
case nameof(Handler):
Handler = (Microsoft.Maui.IViewHandler)parameter.Value;
break;
case nameof(Shadow):
Shadow = (Microsoft.Maui.Controls.Shadow)parameter.Value;
break;
case nameof(BindShadow):
BindShadow = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(ZIndex):
ZIndex = (System.Int32)parameter.Value;
break;
case nameof(Visual):
Visual = (Microsoft.Maui.Controls.IVisual)parameter.Value;
break;
case nameof(BindVisual):
BindVisual = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(FlowDirection):
FlowDirection = (Microsoft.Maui.FlowDirection)parameter.Value;
break;
case nameof(BindFlowDirection):
BindFlowDirection = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(AnchorX):
AnchorX = (System.Double)parameter.Value;
break;
case nameof(BindAnchorX):
BindAnchorX = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(AnchorY):
AnchorY = (System.Double)parameter.Value;
break;
case nameof(BindAnchorY):
BindAnchorY = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(BackgroundColor):
BackgroundColor = (Microsoft.Maui.Graphics.Color)parameter.Value;
break;
case nameof(BindBackgroundColor):
BindBackgroundColor = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(Background):
Background = (Microsoft.Maui.Controls.Brush)parameter.Value;
break;
case nameof(BindBackground):
BindBackground = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(HeightRequest):
HeightRequest = (System.Double)parameter.Value;
break;
case nameof(BindHeightRequest):
BindHeightRequest = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(InputTransparent):
InputTransparent = (System.Boolean)parameter.Value;
break;
case nameof(BindInputTransparent):
BindInputTransparent = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(IsEnabled):
IsEnabled = (System.Boolean)parameter.Value;
break;
case nameof(BindIsEnabled):
BindIsEnabled = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(IsVisible):
IsVisible = (System.Boolean)parameter.Value;
break;
case nameof(BindIsVisible):
BindIsVisible = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(MinimumHeightRequest):
MinimumHeightRequest = (System.Double)parameter.Value;
break;
case nameof(BindMinimumHeightRequest):
BindMinimumHeightRequest = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(MinimumWidthRequest):
MinimumWidthRequest = (System.Double)parameter.Value;
break;
case nameof(BindMinimumWidthRequest):
BindMinimumWidthRequest = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(MaximumHeightRequest):
MaximumHeightRequest = (System.Double)parameter.Value;
break;
case nameof(BindMaximumHeightRequest):
BindMaximumHeightRequest = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(MaximumWidthRequest):
MaximumWidthRequest = (System.Double)parameter.Value;
break;
case nameof(BindMaximumWidthRequest):
BindMaximumWidthRequest = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(Opacity):
Opacity = (System.Double)parameter.Value;
break;
case nameof(BindOpacity):
BindOpacity = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(Rotation):
Rotation = (System.Double)parameter.Value;
break;
case nameof(BindRotation):
BindRotation = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(RotationX):
RotationX = (System.Double)parameter.Value;
break;
case nameof(BindRotationX):
BindRotationX = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(RotationY):
RotationY = (System.Double)parameter.Value;
break;
case nameof(BindRotationY):
BindRotationY = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(Scale):
Scale = (System.Double)parameter.Value;
break;
case nameof(BindScale):
BindScale = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(ScaleX):
ScaleX = (System.Double)parameter.Value;
break;
case nameof(BindScaleX):
BindScaleX = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(ScaleY):
ScaleY = (System.Double)parameter.Value;
break;
case nameof(BindScaleY):
BindScaleY = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(TranslationX):
TranslationX = (System.Double)parameter.Value;
break;
case nameof(BindTranslationX):
BindTranslationX = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(TranslationY):
TranslationY = (System.Double)parameter.Value;
break;
case nameof(BindTranslationY):
BindTranslationY = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(WidthRequest):
WidthRequest = (System.Double)parameter.Value;
break;
case nameof(BindWidthRequest):
BindWidthRequest = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(Clip):
Clip = (Microsoft.Maui.Controls.Shapes.Geometry)parameter.Value;
break;
case nameof(BindClip):
BindClip = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(DisableLayout):
DisableLayout = (System.Boolean)parameter.Value;
break;
case nameof(IsInPlatformLayout):
IsInPlatformLayout = (System.Boolean)parameter.Value;
break;
case nameof(IsPlatformStateConsistent):
IsPlatformStateConsistent = (System.Boolean)parameter.Value;
break;
case nameof(IsPlatformEnabled):
IsPlatformEnabled = (System.Boolean)parameter.Value;
break;
case nameof(Resources):
Resources = (Microsoft.Maui.Controls.ResourceDictionary)parameter.Value;
break;
case nameof(Style):
Style = (Microsoft.Maui.Controls.Style)parameter.Value;
break;
case nameof(BindStyle):
BindStyle = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(StyleClass):
StyleClass = (System.Collections.Generic.IList<System.String>)parameter.Value;
break;
case nameof(@class):
@class = (System.Collections.Generic.IList<System.String>)parameter.Value;
break;
case nameof(AutomationId):
AutomationId = (System.String)parameter.Value;
break;
case nameof(BindAutomationId):
BindAutomationId = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(ClassId):
ClassId = (System.String)parameter.Value;
break;
case nameof(BindClassId):
BindClassId = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
case nameof(StyleId):
StyleId = (System.String)parameter.Value;
break;
case nameof(Parent):
Parent = (Microsoft.Maui.Controls.Element)parameter.Value;
break;
case nameof(EffectControlProvider):
EffectControlProvider = (Microsoft.Maui.Controls.IEffectControlProvider)parameter.Value;
break;
case nameof(BindingContext):
BindingContext = (System.Object)parameter.Value;
break;
case nameof(BindBindingContext):
BindBindingContext = (Microsoft.Maui.Controls.Binding)parameter.Value;
break;
}
}
return base.SetParametersAsync(parameters);
}
}
This works rather well for us and I am thinking perhaps merging this into this library. Let me know your thoughts