Skip to content

Commit 0052aa9

Browse files
Resolved theme issue for the trimming changes
1 parent 74b366d commit 0052aa9

21 files changed

+29
-12
lines changed

maui/src/Core/BaseView/PlatformView/LayoutViewExt.ios.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ internal void InitializeNativeGraphicsView()
176176
}
177177
}
178178

179-
Add(_nativeGraphicsView);
179+
if(_nativeGraphicsView is not null)
180+
{
181+
Add(_nativeGraphicsView);
182+
}
180183
}
181184
else if (_nativeGraphicsView != null)
182185
{

maui/src/Core/Theme/Resources/DarkThemeColors.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// <summary>
44
/// Dark theme resource dictionary.
55
/// </summary>
6-
[XamlCompilation(XamlCompilationOptions.Skip)]
6+
[XamlCompilation(XamlCompilationOptions.Compile)]
77
public partial class DarkThemeColors : SyncfusionThemeDictionary
88
{
99
/// <summary>

maui/src/Core/Theme/Resources/DefaultTheme.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// <summary>
44
/// Dark theme resource dictionary.
55
/// </summary>
6-
[XamlCompilation(XamlCompilationOptions.Skip)]
6+
[XamlCompilation(XamlCompilationOptions.Compile)]
77
public partial class DefaultTheme : SyncfusionThemeDictionary
88
{
99
/// <summary>

maui/src/Core/Theme/Resources/LightThemeColors.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// <summary>
44
/// Dark theme resource dictionary.
55
/// </summary>
6-
[XamlCompilation(XamlCompilationOptions.Skip)]
6+
[XamlCompilation(XamlCompilationOptions.Compile)]
77
public partial class LightThemeColors : SyncfusionThemeDictionary
88
{
99
/// <summary>

maui/src/Core/Theme/Resources/SyncfusionThemeDictionary.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// <summary>
44
/// ThemeDictionary class for Syncfusion in which controls themes are to be included.
55
/// </summary>
6-
[XamlCompilation(XamlCompilationOptions.Skip)]
6+
[XamlCompilation(XamlCompilationOptions.Compile)]
77
public partial class SyncfusionThemeDictionary : ResourceDictionary
88
{
99
/// <summary>

maui/src/Core/Theme/StaticThemeResourceExtension.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ namespace Syncfusion.Maui.Toolkit.Themes
1313
/// ***
1414
/// </example>
1515

16-
[Microsoft.Maui.Controls.Internals.Preserve(AllMembers = true)]
17-
1816
[ContentProperty(nameof(ResourceKey))]
1917

18+
#if NET9_0
19+
[RequireService([typeof(IProvideValueTarget)])]
20+
#endif
2021
public class StaticThemeResourceExtension : IMarkupExtension
2122
{
2223
/// <summary>
@@ -36,9 +37,9 @@ public class StaticThemeResourceExtension : IMarkupExtension
3637
return null;
3738
}
3839

39-
if (serviceProvider.GetService(typeof(IRootObjectProvider)) is IRootObjectProvider rootObjectProvider)
40+
if (serviceProvider.GetService(typeof(IProvideValueTarget)) is IProvideValueTarget provideValueTarget)
4041
{
41-
if (rootObjectProvider.RootObject is ResourceDictionary themeResourceDictionary)
42+
if (provideValueTarget.TargetObject is ResourceDictionary themeResourceDictionary)
4243
{
4344
var mergedDictionaries = themeResourceDictionary.MergedDictionaries ?? Enumerable.Empty<ResourceDictionary>();
4445

maui/src/Core/Theme/ThemeElement.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ internal static class ThemeElement
5050
/// <summary>
5151
/// The implicit style property.
5252
/// </summary>
53-
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "<Pending>")]
5453
private static readonly BindableProperty ImplicitStyleProperty = BindableProperty.Create(
5554
"ImplicitStyle",
5655
typeof(Style),
@@ -151,7 +150,7 @@ private static void MergePendingDictionaries()
151150
/// <param name="bindable">Bindable.</param>
152151
/// <param name="oldValue">Old value.</param>
153152
/// <param name="newValue">New value.</param>
154-
[RequiresUnreferencedCode("The IsOverriddenMethod method is not trim compatible")]
153+
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "<Pending>")]
155154
private static void OnImplicitStyleChanged(BindableObject bindable, object oldValue, object newValue)
156155
{
157156
if (bindable is Element element && newValue is Style style && !ApplyStyle(element, style))
@@ -176,7 +175,7 @@ private static void OnImplicitStyleChanged(BindableObject bindable, object oldVa
176175
/// <param name="element"></param>
177176
/// <param name="style"></param>
178177
/// <returns></returns>
179-
[RequiresUnreferencedCode("The IsOverriddenMethod method is not trim compatible")]
178+
[RequiresUnreferencedCode("The ApplyStyle method is not trim compatible")]
180179
private static bool ApplyStyle(Element element, Style style)
181180
{
182181
var applyMethodInfo = typeof(Style).GetInterface("IStyle")?.GetMethod("Apply");

maui/src/Themes/SfBottomSheetStyle.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace Syncfusion.Maui.Toolkit.BottomSheet;
55
/// <summary>
66
/// SfBottomSheetStyle provides a set of predefined styles for SfBottomSheet control.
77
/// </summary>
8+
[XamlCompilation(XamlCompilationOptions.Compile)]
89
public partial class SfBottomSheetStyle : ResourceDictionary
910
{
1011
/// <summary>

maui/src/Themes/SfButtonStyles.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ namespace Syncfusion.Maui.Toolkit.Buttons;
33
/// <summary>
44
/// SfButtonStyles class provides a set of predefined styles for SfButton control.
55
/// </summary>
6+
[XamlCompilation(XamlCompilationOptions.Compile)]
67
public partial class SfButtonStyles : ResourceDictionary
78
{
89
/// <summary>

maui/src/Themes/SfCalendarStyles.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace Syncfusion.Maui.Toolkit.Calendar;
55
/// <summary>
66
/// Represents <see cref="SfCalendarStyles"/> class.
77
/// </summary>
8+
[XamlCompilation(XamlCompilationOptions.Compile)]
89
public partial class SfCalendarStyles : ResourceDictionary
910
{
1011
#region Constructor

0 commit comments

Comments
 (0)