diff --git a/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/Popup.generated.cs b/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/Popup.generated.cs
index 3cd3f81d..e06af0f4 100644
--- a/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/Popup.generated.cs
+++ b/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/Popup.generated.cs
@@ -63,13 +63,13 @@ static Popup()
///
[Parameter] public MMP.LayoutAlignment? VerticalOptions { get; set; }
///
- /// Property that represents the Window that's showing the Popup.
- ///
- [Parameter] public MC.Window Window { get; set; }
- ///
/// Gets or sets the content to render in the Popup.
///
[Parameter] public RenderFragment ChildContent { get; set; }
+ ///
+ /// Property that represents the Window that's showing the Popup.
+ ///
+ [Parameter] public RenderFragment Window { get; set; }
[Parameter] public EventCallback OnClosed { get; set; }
[Parameter] public EventCallback OnOpened { get; set; }
@@ -137,16 +137,12 @@ protected override void HandleParameter(string name, object value)
NativeControl.VerticalOptions = VerticalOptions ?? (MMP.LayoutAlignment)CMV.Popup.VerticalOptionsProperty.DefaultValue;
}
break;
- case nameof(Window):
- if (!Equals(Window, value))
- {
- Window = (MC.Window)value;
- NativeControl.Window = Window;
- }
- break;
case nameof(ChildContent):
ChildContent = (RenderFragment)value;
break;
+ case nameof(Window):
+ Window = (RenderFragment)value;
+ break;
case nameof(OnClosed):
if (!Equals(OnClosed, value))
{
@@ -178,6 +174,7 @@ protected override void RenderAdditionalElementContent(RenderTreeBuilder builder
{
base.RenderAdditionalElementContent(builder, ref sequence);
RenderTreeBuilderHelper.AddContentProperty(builder, sequence++, ChildContent, (x, value) => x.Content = (MC.View)value);
+ RenderTreeBuilderHelper.AddContentProperty(builder, sequence++, Window, (x, value) => x.Window = (MC.Window)value);
}
static partial void RegisterAdditionalHandlers();
diff --git a/samples/ThirdPartyControlsSample/Elements/Material.Components/MDNavigationBar.generated.cs b/samples/ThirdPartyControlsSample/Elements/Material.Components/MDNavigationBar.generated.cs
index 58823edf..12f21164 100644
--- a/samples/ThirdPartyControlsSample/Elements/Material.Components/MDNavigationBar.generated.cs
+++ b/samples/ThirdPartyControlsSample/Elements/Material.Components/MDNavigationBar.generated.cs
@@ -27,6 +27,7 @@ static MDNavigationBar()
[Parameter] public bool? HasLabel { get; set; }
[Parameter] public int? SelectedIndex { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
+ [Parameter] public EventCallback OnSelectedItemChanged { get; set; }
public new MCM.NavigationBar NativeControl => (MCM.NavigationBar)((BindableObject)this).NativeControl;
@@ -53,6 +54,16 @@ protected override void HandleParameter(string name, object value)
case nameof(ChildContent):
ChildContent = (RenderFragment)value;
break;
+ case nameof(OnSelectedItemChanged):
+ if (!Equals(OnSelectedItemChanged, value))
+ {
+ void NativeControlSelectedItemChanged(object sender, MC.SelectedItemChangedEventArgs e) => InvokeEventCallback(OnSelectedItemChanged, e);
+
+ OnSelectedItemChanged = (EventCallback)value;
+ NativeControl.SelectedItemChanged -= NativeControlSelectedItemChanged;
+ NativeControl.SelectedItemChanged += NativeControlSelectedItemChanged;
+ }
+ break;
default:
base.HandleParameter(name, value);
diff --git a/samples/ThirdPartyControlsSample/Elements/Material.Components/MDNavigationDrawer.generated.cs b/samples/ThirdPartyControlsSample/Elements/Material.Components/MDNavigationDrawer.generated.cs
index 976091ca..d30b76a2 100644
--- a/samples/ThirdPartyControlsSample/Elements/Material.Components/MDNavigationDrawer.generated.cs
+++ b/samples/ThirdPartyControlsSample/Elements/Material.Components/MDNavigationDrawer.generated.cs
@@ -35,6 +35,7 @@ static MDNavigationDrawer()
[Parameter] public Color ToolBarBackGroundColour { get; set; }
[Parameter] public RenderFragment FooterItems { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
+ [Parameter] public EventCallback OnSelectedItemChanged { get; set; }
public new MCM.NavigationDrawer NativeControl => (MCM.NavigationDrawer)((BindableObject)this).NativeControl;
@@ -106,6 +107,16 @@ protected override void HandleParameter(string name, object value)
case nameof(ChildContent):
ChildContent = (RenderFragment)value;
break;
+ case nameof(OnSelectedItemChanged):
+ if (!Equals(OnSelectedItemChanged, value))
+ {
+ void NativeControlSelectedItemChanged(object sender, MC.SelectedItemChangedEventArgs e) => InvokeEventCallback(OnSelectedItemChanged, e);
+
+ OnSelectedItemChanged = (EventCallback)value;
+ NativeControl.SelectedItemChanged -= NativeControlSelectedItemChanged;
+ NativeControl.SelectedItemChanged += NativeControlSelectedItemChanged;
+ }
+ break;
default:
base.HandleParameter(name, value);
diff --git a/samples/ThirdPartyControlsSample/Elements/Material.Components/MDSplitView.generated.cs b/samples/ThirdPartyControlsSample/Elements/Material.Components/MDSplitView.generated.cs
index 52b54480..5c740665 100644
--- a/samples/ThirdPartyControlsSample/Elements/Material.Components/MDSplitView.generated.cs
+++ b/samples/ThirdPartyControlsSample/Elements/Material.Components/MDSplitView.generated.cs
@@ -28,6 +28,7 @@ static MDSplitView()
[Parameter] public bool? IsPaneOpen { get; set; }
[Parameter] public RenderFragment Content { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
+ [Parameter] public EventCallback OnContentChanged { get; set; }
public new MCM.SplitView NativeControl => (MCM.SplitView)((BindableObject)this).NativeControl;
@@ -57,6 +58,16 @@ protected override void HandleParameter(string name, object value)
case nameof(ChildContent):
ChildContent = (RenderFragment)value;
break;
+ case nameof(OnContentChanged):
+ if (!Equals(OnContentChanged, value))
+ {
+ void NativeControlContentChanged(object sender, MCM.Core.ValueChangedEventArgs e) => InvokeEventCallback(OnContentChanged, e);
+
+ OnContentChanged = (EventCallback)value;
+ NativeControl.ContentChanged -= NativeControlContentChanged;
+ NativeControl.ContentChanged += NativeControlContentChanged;
+ }
+ break;
default:
base.HandleParameter(name, value);
diff --git a/samples/ThirdPartyControlsSample/Elements/Material.Components/MDTabs.generated.cs b/samples/ThirdPartyControlsSample/Elements/Material.Components/MDTabs.generated.cs
index 7f7d5efd..6de8852c 100644
--- a/samples/ThirdPartyControlsSample/Elements/Material.Components/MDTabs.generated.cs
+++ b/samples/ThirdPartyControlsSample/Elements/Material.Components/MDTabs.generated.cs
@@ -31,6 +31,7 @@ static MDTabs()
[Parameter] public bool? HasLabel { get; set; }
[Parameter] public int? SelectedIndex { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
+ [Parameter] public EventCallback OnSelectedItemChanged { get; set; }
public new MCM.Tabs NativeControl => (MCM.Tabs)((BindableObject)this).NativeControl;
@@ -78,6 +79,16 @@ protected override void HandleParameter(string name, object value)
case nameof(ChildContent):
ChildContent = (RenderFragment)value;
break;
+ case nameof(OnSelectedItemChanged):
+ if (!Equals(OnSelectedItemChanged, value))
+ {
+ void NativeControlSelectedItemChanged(object sender, MC.SelectedItemChangedEventArgs e) => InvokeEventCallback(OnSelectedItemChanged, e);
+
+ OnSelectedItemChanged = (EventCallback)value;
+ NativeControl.SelectedItemChanged -= NativeControlSelectedItemChanged;
+ NativeControl.SelectedItemChanged += NativeControlSelectedItemChanged;
+ }
+ break;
default:
base.HandleParameter(name, value);
diff --git a/src/BlazorBindings.Maui.ComponentGenerator/GeneratedPropertyInfo.EventCallback.cs b/src/BlazorBindings.Maui.ComponentGenerator/GeneratedPropertyInfo.EventCallback.cs
index 3edec7a4..87a9954d 100644
--- a/src/BlazorBindings.Maui.ComponentGenerator/GeneratedPropertyInfo.EventCallback.cs
+++ b/src/BlazorBindings.Maui.ComponentGenerator/GeneratedPropertyInfo.EventCallback.cs
@@ -124,10 +124,7 @@ internal static GeneratedPropertyInfo[] GetEventCallbackProperties(GeneratedType
.Where(e => e.DeclaredAccessibility == Accessibility.Public && e.IsBrowsable())
.Select(eventInfo =>
{
- var isBindEvent = IsBindEvent(eventInfo, out var bindedProperty);
-
- if (isBindEvent && IsRenderFragmentPropertySymbol(containingType, bindedProperty))
- return null;
+ var isBindEvent = IsBindEvent(eventInfo, containingType, out var bindedProperty);
var eventCallbackName = isBindEvent ? $"{bindedProperty.Name}Changed" : GetEventCallbackName(eventInfo);
@@ -178,10 +175,11 @@ private static string GetEventCallbackName(IEventSymbol eventSymbol)
};
}
- private static bool IsBindEvent(IEventSymbol eventSymbol, out IPropertySymbol property)
+ private static bool IsBindEvent(IEventSymbol eventSymbol, GeneratedTypeInfo containingType, out IPropertySymbol property)
{
- var properties = eventSymbol.ContainingType.GetMembers().OfType()
- .Where(p => IsPublicProperty(p) && HasPublicSetter(p));
+ var properties = eventSymbol.ContainingType.GetMembers()
+ .OfType()
+ .Where(p => IsValueProperty(p, containingType));
property = properties.FirstOrDefault(p =>
eventSymbol.Name == $"{p.Name}Changed" // e.g. Value - ValueChanged
diff --git a/src/BlazorBindings.Maui.ComponentGenerator/GeneratedPropertyInfo.cs b/src/BlazorBindings.Maui.ComponentGenerator/GeneratedPropertyInfo.cs
index 9f8ecddb..a1388c00 100644
--- a/src/BlazorBindings.Maui.ComponentGenerator/GeneratedPropertyInfo.cs
+++ b/src/BlazorBindings.Maui.ComponentGenerator/GeneratedPropertyInfo.cs
@@ -149,15 +149,8 @@ string GetConvertedProperty(ITypeSymbol propertyType, string propName)
internal static GeneratedPropertyInfo[] GetValueProperties(GeneratedTypeInfo generatedType)
{
- var componentInfo = generatedType.Settings;
-
- var props = GetMembers(componentInfo.TypeSymbol, generatedType.Settings.Include)
- .Where(p => !componentInfo.Exclude.Contains(p.Name))
- .Where(p => !componentInfo.ContentProperties.Contains(p.Name))
- .Where(IsPublicProperty)
- .Where(HasPublicSetter)
- .Where(prop => IsExplicitlyAllowed(prop, generatedType) || !DisallowedComponentTypes.Contains(prop.Type.GetFullName()))
- .Where(prop => prop.Type.GetFullName() == "Microsoft.Maui.Controls.Brush" || !IsRenderFragmentPropertySymbol(generatedType, prop))
+ var props = GetMembers(generatedType.Settings.TypeSymbol, generatedType.Settings.Include)
+ .Where(p => IsValueProperty(p, generatedType))
.OrderBy(prop => prop.Name, StringComparer.OrdinalIgnoreCase);
return props.Select(prop =>
@@ -186,6 +179,20 @@ internal static GeneratedPropertyInfo[] GetValueProperties(GeneratedTypeInfo gen
.ToArray();
}
+ private static bool IsValueProperty(IPropertySymbol prop, GeneratedTypeInfo generatedType)
+ {
+ if (generatedType.Settings.Exclude.Contains(prop.Name))
+ return false;
+
+ if (generatedType.Settings.ContentProperties.Contains(prop.Name))
+ return false;
+
+ return IsPublicProperty(prop)
+ && HasPublicSetter(prop)
+ && (IsExplicitlyAllowed(prop, generatedType) || !DisallowedComponentTypes.Contains(prop.Type.GetFullName()))
+ && (prop.Type.GetFullName() == "Microsoft.Maui.Controls.Brush" || !IsRenderFragmentPropertySymbol(generatedType, prop));
+ }
+
private static string GetComponentPropertyTypeName(IPropertySymbol propertySymbol, GeneratedTypeInfo containingType, bool isRenderFragmentProperty = false, bool makeNullable = false)
{
diff --git a/src/BlazorBindings.Maui/Elements/TabbedPage.generated.cs b/src/BlazorBindings.Maui/Elements/TabbedPage.generated.cs
index ecbcef5f..4515863b 100644
--- a/src/BlazorBindings.Maui/Elements/TabbedPage.generated.cs
+++ b/src/BlazorBindings.Maui/Elements/TabbedPage.generated.cs
@@ -10,6 +10,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.Maui.Graphics;
+using System;
using System.Collections.Specialized;
using System.Threading.Tasks;
@@ -45,6 +46,7 @@ static TabbedPage()
[Parameter] public Color UnselectedTabColor { get; set; }
[Parameter] public RenderFragment BarBackground { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
+ [Parameter] public EventCallback OnCurrentPageChanged { get; set; }
[Parameter] public EventCallback OnPagesChanged { get; set; }
public new MC.TabbedPage NativeControl => (MC.TabbedPage)((BindableObject)this).NativeControl;
@@ -89,6 +91,16 @@ protected override void HandleParameter(string name, object value)
case nameof(ChildContent):
ChildContent = (RenderFragment)value;
break;
+ case nameof(OnCurrentPageChanged):
+ if (!Equals(OnCurrentPageChanged, value))
+ {
+ void NativeControlCurrentPageChanged(object sender, EventArgs e) => InvokeEventCallback(OnCurrentPageChanged);
+
+ OnCurrentPageChanged = (EventCallback)value;
+ NativeControl.CurrentPageChanged -= NativeControlCurrentPageChanged;
+ NativeControl.CurrentPageChanged += NativeControlCurrentPageChanged;
+ }
+ break;
case nameof(OnPagesChanged):
if (!Equals(OnPagesChanged, value))
{