diff --git a/src/Compatibility/Core/src/AppHostBuilderExtensions.cs b/src/Compatibility/Core/src/AppHostBuilderExtensions.cs
index 80404fffab26..4ee7966e3121 100644
--- a/src/Compatibility/Core/src/AppHostBuilderExtensions.cs
+++ b/src/Compatibility/Core/src/AppHostBuilderExtensions.cs
@@ -36,6 +36,7 @@
using OpenGLViewRenderer = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.DefaultRenderer;
using StreamImagesourceHandler = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.StreamImageSourceHandler;
using ImageLoaderSourceHandler = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.UriImageSourceHandler;
+using DefaultRenderer = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.DefaultRenderer;
#endif
using Microsoft.Maui.Hosting;
diff --git a/src/Compatibility/Core/src/Compatibility.csproj b/src/Compatibility/Core/src/Compatibility.csproj
index 128a1fb51181..060667a9263f 100644
--- a/src/Compatibility/Core/src/Compatibility.csproj
+++ b/src/Compatibility/Core/src/Compatibility.csproj
@@ -64,7 +64,7 @@
-
+
diff --git a/src/Compatibility/Core/src/MauiHandlersCollectionExtensions.cs b/src/Compatibility/Core/src/MauiHandlersCollectionExtensions.cs
index 9f6e2f1dcc3e..1a12b1f58964 100644
--- a/src/Compatibility/Core/src/MauiHandlersCollectionExtensions.cs
+++ b/src/Compatibility/Core/src/MauiHandlersCollectionExtensions.cs
@@ -49,7 +49,7 @@ public static IMauiHandlersCollection AddCompatibilityRenderer(view) ?? new DefaultRenderer();
-
- // SetupRenderer(renderer);
- // }
-
- // if (VisualElementRenderer.Element != view)
- // {
- // VisualElementRenderer.SetElement((VisualElement)view);
- // }
- // else
- // {
- // base.SetVirtualView(view);
- // }
-
- // Platform.Tizen.Platform.SetRenderer(VisualElementRenderer.Element, VisualElementRenderer);
- //}
-
- //public override void UpdateValue(string property)
- //{
- // base.UpdateValue(property);
- // if (property == "Frame")
- // {
- // NativeArrange(VisualElementRenderer.Element.Bounds);
- // }
- //}
}
}
diff --git a/src/Compatibility/Core/src/Tizen/ExportCellAttribute.cs b/src/Compatibility/Core/src/Tizen/ExportCellAttribute.cs
deleted file mode 100644
index fd6844112e7a..000000000000
--- a/src/Compatibility/Core/src/Tizen/ExportCellAttribute.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace Microsoft.Maui.Controls.Compatibility
-{
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- public sealed class ExportCellAttribute : HandlerAttribute
- {
- public ExportCellAttribute(Type handler, Type target) : base(handler, target)
- {
- }
- }
-}
diff --git a/src/Compatibility/Core/src/Tizen/ExportHandlerAttribute.cs b/src/Compatibility/Core/src/Tizen/ExportHandlerAttribute.cs
deleted file mode 100644
index 17a126abb362..000000000000
--- a/src/Compatibility/Core/src/Tizen/ExportHandlerAttribute.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace Microsoft.Maui.Controls.Compatibility
-{
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- public sealed class ExportHandlerAttribute : HandlerAttribute
- {
- public ExportHandlerAttribute(Type handler, Type target) : base(handler, target)
- {
- }
- }
-}
diff --git a/src/Compatibility/Core/src/Tizen/ExportImageSourceHandlerAttribute.cs b/src/Compatibility/Core/src/Tizen/ExportImageSourceHandlerAttribute.cs
deleted file mode 100644
index fb680b156ef4..000000000000
--- a/src/Compatibility/Core/src/Tizen/ExportImageSourceHandlerAttribute.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace Microsoft.Maui.Controls.Compatibility
-{
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- public sealed class ExportImageSourceHandlerAttribute : HandlerAttribute
- {
- public ExportImageSourceHandlerAttribute(Type handler, Type target) : base(handler, target)
- {
- }
- }
-}
diff --git a/src/Compatibility/Core/src/Tizen/ExportRendererAttribute.cs b/src/Compatibility/Core/src/Tizen/ExportRendererAttribute.cs
deleted file mode 100644
index f07feb8da86b..000000000000
--- a/src/Compatibility/Core/src/Tizen/ExportRendererAttribute.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using Microsoft.Maui.Controls.Compatibility.Platform.Tizen;
-
-namespace Microsoft.Maui.Controls.Compatibility
-{
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- public sealed class ExportRendererAttribute : HandlerAttribute
- {
- TargetIdiom Target { get; set; }
-
- public ExportRendererAttribute(Type handler, Type target) : this(handler, target, null)
- {
- }
-
- public ExportRendererAttribute(Type handler, Type target, Type[] supportedVisuals) : base(handler, target, supportedVisuals)
- {
- }
-
- public ExportRendererAttribute(Type handler, Type target, TargetIdiom targetIdiom) : this(handler, target, null, targetIdiom)
- {
- }
-
- public ExportRendererAttribute(Type handler, Type target, Type[] supportedVisuals, TargetIdiom targetIdiom) : base(handler, target, supportedVisuals)
- {
- Target = targetIdiom;
- }
-
- public override bool ShouldRegister()
- {
- if (Target == TargetIdiom.Unsupported)
- return true;
-
- return (Target == Device.Idiom);
- }
- }
-}
diff --git a/src/Compatibility/Core/src/Tizen/Forms.cs b/src/Compatibility/Core/src/Tizen/Forms.cs
index 7063db0dc0ba..eab449d16dcd 100644
--- a/src/Compatibility/Core/src/Tizen/Forms.cs
+++ b/src/Compatibility/Core/src/Tizen/Forms.cs
@@ -499,9 +499,6 @@ static void SetupInit(IMauiContext context, InitializationOptions options = null
Device.SetIdiom(TargetIdiom.Unsupported);
}
- if (options?.Flags.HasFlag(InitializationFlags.SkipRenderers) != true)
- RegisterCompatRenderers(options);
-
Application.AccentColor = GetAccentColor(profile);
ExpressionSearch.Default = new TizenExpressionSearch();
@@ -511,124 +508,6 @@ static void SetupInit(IMauiContext context, InitializationOptions options = null
IsInitialized = true;
}
- // Once we get essentials/cg converted to using startup.cs
- // we will delete all the renderer code inside this file
- internal static void RenderersRegistered()
- {
- IsInitializedRenderers = true;
- }
-
- internal static void RegisterCompatRenderers(InitializationOptions options)
- {
- if (!IsInitializedRenderers)
- {
- IsInitializedRenderers = true;
- if (options != null)
- {
- s_platformType = options.PlatformType;
- s_useMessagingCenter = options.UseMessagingCenter;
- UseSkiaSharp = options.UseSkiaSharp;
- UseFastLayout = options.UseFastLayout;
-
- // renderers
- if (options.Handlers != null)
- {
- Registrar.RegisterRenderers(options.Handlers);
- }
- else
- {
- // static registrar
- if (options.StaticRegistarStrategy != StaticRegistrarStrategy.None)
- {
- s_staticRegistrarStrategy = options.StaticRegistarStrategy;
- StaticRegistrar.RegisterHandlers(options.CustomHandlers);
-
- if (options.StaticRegistarStrategy == StaticRegistrarStrategy.All)
- {
- Registrar.RegisterAll(new Type[]
- {
- typeof(ExportRendererAttribute),
- typeof(ExportImageSourceHandlerAttribute),
- typeof(ExportCellAttribute),
- typeof(ExportHandlerAttribute),
- typeof(ExportFontAttribute)
- });
-
- if (UseSkiaSharp)
- RegisterSkiaSharpRenderers();
- }
- }
- else
- {
- Registrar.RegisterAll(new Type[]
- {
- typeof(ExportRendererAttribute),
- typeof(ExportImageSourceHandlerAttribute),
- typeof(ExportCellAttribute),
- typeof(ExportHandlerAttribute),
- typeof(ExportFontAttribute)
- });
-
- if (UseSkiaSharp)
- RegisterSkiaSharpRenderers();
-
- if (UseFastLayout)
- Registrar.Registered.Register(typeof(Layout), typeof(FastLayoutRenderer));
- }
- }
-
- // effects
- var effectScopes = options.EffectScopes;
- if (effectScopes != null)
- {
- for (var i = 0; i < effectScopes.Length; i++)
- {
- var effectScope = effectScopes[0];
- Registrar.RegisterEffects(effectScope.Name, effectScope.Effects);
- }
- }
-
- // css
- Registrar.RegisterStylesheets(options.Flags);
- }
- else
- {
- Registrar.RegisterAll(new Type[]
- {
- typeof(ExportRendererAttribute),
- typeof(ExportImageSourceHandlerAttribute),
- typeof(ExportCellAttribute),
- typeof(ExportHandlerAttribute),
- typeof(ExportFontAttribute)
- });
- }
- }
- }
-
- internal static void RegisterCompatRenderers(
- Assembly[] assemblies,
- Assembly defaultRendererAssembly,
- Action viewRegistered)
- {
- if (IsInitializedRenderers)
- return;
-
- IsInitializedRenderers = true;
-
- // Only need to do this once
- Controls.Internals.Registrar.RegisterAll(
- assemblies,
- defaultRendererAssembly,
- new[] {
- typeof(ExportRendererAttribute),
- typeof(ExportImageSourceHandlerAttribute),
- typeof(ExportCellAttribute),
- typeof(ExportHandlerAttribute),
- typeof(ExportFontAttribute)
- }, default(InitializationFlags),
- viewRegistered);
- }
-
static void RegisterSkiaSharpRenderers()
{
// Register all skiasharp-based rednerers here.
diff --git a/src/Compatibility/Core/src/Tizen/Properties/AssemblyInfo.cs b/src/Compatibility/Core/src/Tizen/Properties/AssemblyInfo.cs
index 7170bce4726e..54f1710e1f6e 100644
--- a/src/Compatibility/Core/src/Tizen/Properties/AssemblyInfo.cs
+++ b/src/Compatibility/Core/src/Tizen/Properties/AssemblyInfo.cs
@@ -1,81 +1,6 @@
-using Microsoft.Maui;
-using Microsoft.Maui.Controls;
-using Microsoft.Maui.Controls.Compatibility;
-using Microsoft.Maui.Controls.Compatibility.Platform.Tizen;
-using Microsoft.Maui.Controls.Shapes;
+using System.Runtime.CompilerServices;
+using Microsoft.Maui.Controls.Internals;
-[assembly: Dependency(typeof(ResourcesProvider))]
-[assembly: Dependency(typeof(Deserializer))]
-[assembly: Dependency(typeof(NativeBindingService))]
-[assembly: Dependency(typeof(NativeValueConverterService))]
-
-[assembly: ExportRenderer(typeof(Layout), typeof(LayoutRenderer))]
-[assembly: ExportRenderer(typeof(ScrollView), typeof(ScrollViewRenderer))]
-[assembly: ExportRenderer(typeof(CarouselPage), typeof(CarouselPageRenderer))]
-[assembly: ExportRenderer(typeof(Page), typeof(PageRenderer))]
-[assembly: ExportRenderer(typeof(NavigationPage), typeof(NavigationPageRenderer))]
-#pragma warning disable CS0618 // Type or member is obsolete
-[assembly: ExportRenderer(typeof(MasterDetailPage), typeof(MasterDetailPageRenderer))]
-#pragma warning restore CS0618 // Type or member is obsolete
-[assembly: ExportRenderer(typeof(FlyoutPage), typeof(FlyoutPageRenderer))]
-[assembly: ExportRenderer(typeof(TabbedPage), typeof(TabbedPageRenderer))]
-[assembly: ExportRenderer(typeof(Shell), typeof(ShellRenderer))]
-
-[assembly: ExportRenderer(typeof(Label), typeof(LabelRenderer))]
-[assembly: ExportRenderer(typeof(Button), typeof(ButtonRenderer))]
-[assembly: ExportRenderer(typeof(Image), typeof(ImageRenderer))]
-[assembly: ExportRenderer(typeof(Slider), typeof(SliderRenderer))]
-[assembly: ExportRenderer(typeof(Picker), typeof(PickerRenderer))]
-[assembly: ExportRenderer(typeof(Frame), typeof(FrameRenderer))]
-[assembly: ExportRenderer(typeof(Stepper), typeof(StepperRenderer))]
-[assembly: ExportRenderer(typeof(DatePicker), typeof(DatePickerRenderer))]
-[assembly: ExportRenderer(typeof(TimePicker), typeof(TimePickerRenderer))]
-[assembly: ExportRenderer(typeof(ProgressBar), typeof(ProgressBarRenderer))]
-[assembly: ExportRenderer(typeof(Switch), typeof(SwitchRenderer))]
-[assembly: ExportRenderer(typeof(CheckBox), typeof(CheckBoxRenderer))]
-[assembly: ExportRenderer(typeof(ListView), typeof(ListViewRenderer))]
-[assembly: ExportRenderer(typeof(BoxView), typeof(BoxViewRenderer))]
-[assembly: ExportRenderer(typeof(ActivityIndicator), typeof(ActivityIndicatorRenderer))]
-[assembly: ExportRenderer(typeof(IndicatorView), typeof(IndicatorViewRenderer))]
-[assembly: ExportRenderer(typeof(SearchBar), typeof(SearchBarRenderer))]
-[assembly: ExportRenderer(typeof(Entry), typeof(EntryRenderer))]
-[assembly: ExportRenderer(typeof(Editor), typeof(EditorRenderer))]
-[assembly: ExportRenderer(typeof(TableView), typeof(TableViewRenderer))]
-[assembly: ExportRenderer(typeof(NativeViewWrapper), typeof(NativeViewWrapperRenderer))]
-[assembly: ExportRenderer(typeof(WebView), typeof(WebViewRenderer))]
-[assembly: ExportRenderer(typeof(ImageButton), typeof(ImageButtonRenderer))]
-[assembly: ExportRenderer(typeof(StructuredItemsView), typeof(StructuredItemsViewRenderer))]
-[assembly: ExportRenderer(typeof(CarouselView), typeof(CarouselViewRenderer))]
-[assembly: ExportRenderer(typeof(SwipeView), typeof(SwipeViewRenderer))]
-[assembly: ExportRenderer(typeof(RefreshView), typeof(RefreshViewRenderer))]
-[assembly: ExportRenderer(typeof(IndicatorView), typeof(IndicatorViewRenderer))]
-[assembly: ExportRenderer(typeof(RadioButton), typeof(RadioButtonRenderer))]
-
-[assembly: ExportImageSourceHandler(typeof(FileImageSource), typeof(FileImageSourceHandler))]
-[assembly: ExportImageSourceHandler(typeof(StreamImageSource), typeof(StreamImageSourceHandler))]
-[assembly: ExportImageSourceHandler(typeof(UriImageSource), typeof(UriImageSourceHandler))]
-
-[assembly: ExportCell(typeof(TextCell), typeof(TextCellRenderer))]
-[assembly: ExportCell(typeof(ImageCell), typeof(ImageCellRenderer))]
-[assembly: ExportCell(typeof(SwitchCell), typeof(SwitchCellRenderer))]
-[assembly: ExportCell(typeof(EntryCell), typeof(EntryCellRenderer))]
-[assembly: ExportCell(typeof(ViewCell), typeof(ViewCellRenderer))]
-
-[assembly: ExportRenderer(typeof(Microsoft.Maui.EmbeddedFont), typeof(Microsoft.Maui.EmbeddedFontLoader))]
-
-[assembly: ExportHandler(typeof(TapGestureRecognizer), typeof(TapGestureHandler))]
-[assembly: ExportHandler(typeof(PinchGestureRecognizer), typeof(PinchGestureHandler))]
-[assembly: ExportHandler(typeof(PanGestureRecognizer), typeof(PanGestureHandler))]
-[assembly: ExportHandler(typeof(SwipeGestureRecognizer), typeof(SwipeGestureHandler))]
-[assembly: ExportHandler(typeof(DragGestureRecognizer), typeof(DragGestureHandler))]
-[assembly: ExportHandler(typeof(DropGestureRecognizer), typeof(DropGestureHandler))]
-
-[assembly: ExportRenderer(typeof(Shell), typeof(Microsoft.Maui.Controls.Compatibility.Platform.Tizen.Watch.ShellRenderer), TargetIdiom.Watch)]
-[assembly: ExportRenderer(typeof(Shell), typeof(Microsoft.Maui.Controls.Compatibility.Platform.Tizen.TV.TVShellRenderer), TargetIdiom.TV)]
-
-[assembly: ExportRenderer(typeof(Ellipse), typeof(EllipseRenderer))]
-[assembly: ExportRenderer(typeof(Line), typeof(LineRenderer))]
-[assembly: ExportRenderer(typeof(Path), typeof(PathRenderer))]
-[assembly: ExportRenderer(typeof(Polygon), typeof(PolygonRenderer))]
-[assembly: ExportRenderer(typeof(Polyline), typeof(PolylineRenderer))]
-[assembly: ExportRenderer(typeof(Rectangle), typeof(RectangleRenderer))]
+[assembly: Preserve]
+[assembly: InternalsVisibleTo("Microsoft.Maui.Controls.Compatibility.Platform")]
+[assembly: InternalsVisibleTo("Microsoft.Maui.Controls.Compatibility.Material")]
\ No newline at end of file
diff --git a/src/Core/src/Platform/IMauiContext.cs b/src/Core/src/Platform/IMauiContext.cs
index 2611e792e4a1..27f7248273ae 100644
--- a/src/Core/src/Platform/IMauiContext.cs
+++ b/src/Core/src/Platform/IMauiContext.cs
@@ -15,7 +15,7 @@ public interface IMauiContext
#elif WINDOWS
UI.Xaml.Window? Window { get; }
#elif TIZEN
- CoreUIAppContext Context { get; }
+ CoreUIAppContext? Context { get; }
#endif
}
}
diff --git a/src/Core/src/Platform/MauiContext.Tizen.cs b/src/Core/src/Platform/MauiContext.Tizen.cs
new file mode 100644
index 000000000000..3a0b26c4b7cc
--- /dev/null
+++ b/src/Core/src/Platform/MauiContext.Tizen.cs
@@ -0,0 +1,37 @@
+using System;
+
+namespace Microsoft.Maui
+{
+ public partial class MauiContext
+ {
+ readonly WeakReference? _context;
+
+ public MauiContext(CoreUIAppContext context) : this()
+ {
+ _context = new WeakReference(context ?? throw new ArgumentNullException(nameof(context)));
+ }
+
+ public MauiContext(IServiceProvider services, CoreUIAppContext context) : this(services)
+ {
+ _context = new WeakReference(context ?? throw new ArgumentNullException(nameof(context)));
+ }
+
+ public CoreUIAppContext? Context
+ {
+ get
+ {
+ if (_context == null)
+ return null;
+
+ CoreUIAppContext? context;
+ if (_context.TryGetTarget(out context))
+ {
+ return context;
+ }
+
+ return null;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/src/Core/src/Platform/Tizen/MauiContext.cs b/src/Core/src/Platform/Tizen/MauiContext.cs
deleted file mode 100644
index 7b248d30ecb5..000000000000
--- a/src/Core/src/Platform/Tizen/MauiContext.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Microsoft.Maui
-{
- public class MauiContext : IMauiContext
- {
- readonly CoreUIAppContext _context;
- readonly IServiceProvider? _services;
- readonly IMauiHandlersServiceProvider? _mauiHandlersServiceProvider;
-
- public MauiContext(CoreUIAppContext context)
- {
- _context = context ?? throw new ArgumentNullException(nameof(context));
- }
-
- public MauiContext(IServiceProvider services, CoreUIAppContext context)
- {
- _services = services ?? throw new ArgumentNullException(nameof(services));
- _context = context ?? throw new ArgumentNullException(nameof(context));
- _mauiHandlersServiceProvider = Services.GetRequiredService();
- }
-
- public CoreUIAppContext Context => _context;
-
- public IServiceProvider Services =>
- _services ?? throw new InvalidOperationException($"No service provider was specified during construction.");
-
- public IMauiHandlersServiceProvider Handlers =>
- _mauiHandlersServiceProvider ?? throw new InvalidOperationException($"No service provider was specified during construction.");
- }
-}
\ No newline at end of file