diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_LazyLoading.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_LazyLoading.cs new file mode 100644 index 000000000000..2d8e360ad10c --- /dev/null +++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_LazyLoading.cs @@ -0,0 +1,123 @@ +using System.Collections.Immutable; +using Microsoft.CodeAnalysis.Testing; +using Uno.UI.SourceGenerators.Tests.Verifiers; + +namespace Uno.UI.SourceGenerators.Tests.XamlCodeGeneratorTests; + +using Verify = XamlSourceGeneratorVerifier; + +[TestClass] +public class Given_LazyLoading +{ + [TestMethod] + public async Task When_DeferLoadStrategy_No_Visibility_Set() + { + var xamlFile = new XamlFile("MainPage.xaml", + """ + + + + + + + + + + """); + + var test = new Verify.Test(xamlFile) + { + TestState = + { + Sources = + { + """ + using System; + using Microsoft.UI.Xaml; + using Microsoft.UI.Xaml.Controls; + + namespace TestRepro + { + public sealed partial class MainPage : Page + { + public MainPage() + { + this.InitializeComponent(); + } + } + } + """ + } + }, + ReferenceAssemblies = ReferenceAssemblies.Net.Net70.AddPackages(ImmutableArray.Create(new PackageIdentity("Uno.WinUI", "5.0.118"))), + DisableBuildReferences = true, + }.AddGeneratedSources(); + + await test.RunAsync(); + } + + [TestMethod] + public async Task When_xLoad_Child_Has_xBind() + { + var xamlFile = new XamlFile("MainPage.xaml", + """ + + + + + + + """); + + var test = new Verify.Test(xamlFile) + { + TestState = + { + Sources = + { + """ + using System; + using Microsoft.UI.Xaml; + using Microsoft.UI.Xaml.Controls; + + namespace TestRepro + { + public sealed partial class MainPage : Page + { + public MainPage() + { + this.InitializeComponent(); + } + + public string InnerText + { + get { return (string)GetValue(InnerTextProperty); } + set { SetValue(InnerTextProperty, value); } + } + + public static readonly DependencyProperty InnerTextProperty = + DependencyProperty.Register("InnerText", typeof(string), typeof(MainPage), new PropertyMetadata("My inner text")); + } + } + """ + } + }, + ReferenceAssemblies = ReferenceAssemblies.Net.Net70.AddPackages(ImmutableArray.Create(new PackageIdentity("Uno.WinUI", "5.0.118"))), + DisableBuildReferences = true, + }.AddGeneratedSources(); + + await test.RunAsync(); + } +} diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_GlobalStaticResources.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_GlobalStaticResources.cs new file mode 100644 index 000000000000..5f7fa92dec99 --- /dev/null +++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_GlobalStaticResources.cs @@ -0,0 +1,61 @@ +// +#if __WASM__ +#error invalid internal source generator state. The __WASM__ DefineConstant was not propagated properly. +#endif +namespace MyProject +{ + /// + /// Contains all the static resources defined for the application + /// + public sealed partial class GlobalStaticResources + { + static bool _initialized; + private static bool _stylesRegistered; + private static bool _dictionariesRegistered; + internal static global::Uno.UI.Xaml.XamlParseContext __ParseContext_ {get; } = new global::Uno.UI.Xaml.XamlParseContext() + { + AssemblyName = "TestProject", + } + ; + + static GlobalStaticResources() + { + Initialize(); + } + public static void Initialize() + { + if (!_initialized) + { + _initialized = true; + global::Uno.UI.GlobalStaticResources.Initialize(); + global::Uno.UI.Toolkit.GlobalStaticResources.Initialize(); + global::Uno.UI.GlobalStaticResources.RegisterDefaultStyles(); + global::Uno.UI.Toolkit.GlobalStaticResources.RegisterDefaultStyles(); + global::Uno.UI.GlobalStaticResources.RegisterResourceDictionariesBySource(); + global::Uno.UI.Toolkit.GlobalStaticResources.RegisterResourceDictionariesBySource(); + } + } + public static void RegisterDefaultStyles() + { + if(!_stylesRegistered) + { + _stylesRegistered = true; + RegisterDefaultStyles_MainPage_d6cd66944958ced0c513e0a04797b51d(); + } + } + // Register ResourceDictionaries using ms-appx:/// syntax, this is called for external resources + public static void RegisterResourceDictionariesBySource() + { + if(!_dictionariesRegistered) + { + _dictionariesRegistered = true; + } + } + // Register ResourceDictionaries using ms-resource:/// syntax, this is called for local resources + internal static void RegisterResourceDictionariesBySourceLocal() + { + } + static partial void RegisterDefaultStyles_MainPage_d6cd66944958ced0c513e0a04797b51d(); + + } +} diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_LocalizationResources.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_LocalizationResources.cs new file mode 100644 index 000000000000..115ce87c0105 --- /dev/null +++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_LocalizationResources.cs @@ -0,0 +1,2 @@ +// +[assembly: global::System.Reflection.AssemblyMetadata("UnoHasLocalizationResources", "False")] \ No newline at end of file diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs new file mode 100644 index 000000000000..0013d351ffbf --- /dev/null +++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WDLSNVS/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs @@ -0,0 +1,183 @@ +// +#pragma warning disable CS0114 +#pragma warning disable CS0108 +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Uno.UI; +using Uno.UI.Xaml; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Documents; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Animation; +using Microsoft.UI.Xaml.Shapes; +using Windows.UI.Text; +using Uno.Extensions; +using Uno; +using Uno.UI.Helpers; +using Uno.UI.Helpers.Xaml; +using MyProject; + +#if __ANDROID__ +using _View = Android.Views.View; +#elif __IOS__ +using _View = UIKit.UIView; +#elif __MACOS__ +using _View = AppKit.NSView; +#else +using _View = Microsoft.UI.Xaml.UIElement; +#endif + +namespace TestRepro +{ + partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page + { + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/"; + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + private const string __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/"; + private global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope(); + private void InitializeComponent() + { + NameScope.SetNameScope(this, __nameScope); + var __that = this; + base.IsParsing = true; + // Source 0\MainPage.xaml (Line 1:2) + base.Content = + new global::Microsoft.UI.Xaml.Controls.StackPanel + { + IsParsing = true, + // Source 0\MainPage.xaml (Line 9:3) + Children = + { + new global::Microsoft.UI.Xaml.Controls.TextBlock + { + IsParsing = true, + Text = "Immediate content", + // Source 0\MainPage.xaml (Line 10:4) + } + .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 => + { + global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d); + c0.CreationComplete(); + } + )) + , + new Microsoft.UI.Xaml.ElementStub( () => + new global::Microsoft.UI.Xaml.Controls.Border + { + IsParsing = true, + Name = "LazyLoadedBorder", + // Source 0\MainPage.xaml (Line 11:4) + Child = + new global::Microsoft.UI.Xaml.Controls.TextBlock + { + IsParsing = true, + Text = "Lazy Content", + // Source 0\MainPage.xaml (Line 12:5) + } + .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c1 => + { + global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d); + c1.CreationComplete(); + } + )) + } + .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c2 => + { + __nameScope.RegisterName("LazyLoadedBorder", c2); + __that.LazyLoadedBorder = c2; + // DeferLoadStrategy Lazy + global::Uno.UI.FrameworkElementHelper.SetBaseUri(c2, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d); + c2.CreationComplete(); + } + )) + ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(c3 => + { + c3.Name = "LazyLoadedBorder"; + _LazyLoadedBorderSubject.ElementInstance = c3; + } + )) + , + } + } + .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler3)(c4 => + { + global::Uno.UI.FrameworkElementHelper.SetBaseUri(c4, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d); + c4.CreationComplete(); + } + )) + ; + + this + .GenericApply(((c5) => + { + // Source 0\MainPage.xaml (Line 1:2) + + // WARNING Property c5.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator + } + )) + .GenericApply(((c6) => + { + // Class TestRepro.MainPage + global::Uno.UI.FrameworkElementHelper.SetBaseUri(c6, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d); + c6.CreationComplete(); + } + )) + ; + OnInitializeCompleted(); + + } + partial void OnInitializeCompleted(); + private global::Microsoft.UI.Xaml.Data.ElementNameSubject _LazyLoadedBorderSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject(); + private global::Microsoft.UI.Xaml.Controls.Border LazyLoadedBorder + { + get + { + return (global::Microsoft.UI.Xaml.Controls.Border)_LazyLoadedBorderSubject.ElementInstance; + } + set + { + _LazyLoadedBorderSubject.ElementInstance = value; + } + } + } +} +namespace MyProject +{ + static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions + { + public delegate void XamlApplyHandler0(global::Microsoft.UI.Xaml.Controls.TextBlock instance); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static global::Microsoft.UI.Xaml.Controls.TextBlock MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.TextBlock instance, XamlApplyHandler0 handler) + { + handler(instance); + return instance; + } + public delegate void XamlApplyHandler1(global::Microsoft.UI.Xaml.Controls.Border instance); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static global::Microsoft.UI.Xaml.Controls.Border MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.Border instance, XamlApplyHandler1 handler) + { + handler(instance); + return instance; + } + public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.ElementStub instance); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static global::Microsoft.UI.Xaml.ElementStub MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.ElementStub instance, XamlApplyHandler2 handler) + { + handler(instance); + return instance; + } + public delegate void XamlApplyHandler3(global::Microsoft.UI.Xaml.Controls.StackPanel instance); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static global::Microsoft.UI.Xaml.Controls.StackPanel MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.StackPanel instance, XamlApplyHandler3 handler) + { + handler(instance); + return instance; + } + } +} diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_GlobalStaticResources.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_GlobalStaticResources.cs new file mode 100644 index 000000000000..5f7fa92dec99 --- /dev/null +++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_GlobalStaticResources.cs @@ -0,0 +1,61 @@ +// +#if __WASM__ +#error invalid internal source generator state. The __WASM__ DefineConstant was not propagated properly. +#endif +namespace MyProject +{ + /// + /// Contains all the static resources defined for the application + /// + public sealed partial class GlobalStaticResources + { + static bool _initialized; + private static bool _stylesRegistered; + private static bool _dictionariesRegistered; + internal static global::Uno.UI.Xaml.XamlParseContext __ParseContext_ {get; } = new global::Uno.UI.Xaml.XamlParseContext() + { + AssemblyName = "TestProject", + } + ; + + static GlobalStaticResources() + { + Initialize(); + } + public static void Initialize() + { + if (!_initialized) + { + _initialized = true; + global::Uno.UI.GlobalStaticResources.Initialize(); + global::Uno.UI.Toolkit.GlobalStaticResources.Initialize(); + global::Uno.UI.GlobalStaticResources.RegisterDefaultStyles(); + global::Uno.UI.Toolkit.GlobalStaticResources.RegisterDefaultStyles(); + global::Uno.UI.GlobalStaticResources.RegisterResourceDictionariesBySource(); + global::Uno.UI.Toolkit.GlobalStaticResources.RegisterResourceDictionariesBySource(); + } + } + public static void RegisterDefaultStyles() + { + if(!_stylesRegistered) + { + _stylesRegistered = true; + RegisterDefaultStyles_MainPage_d6cd66944958ced0c513e0a04797b51d(); + } + } + // Register ResourceDictionaries using ms-appx:/// syntax, this is called for external resources + public static void RegisterResourceDictionariesBySource() + { + if(!_dictionariesRegistered) + { + _dictionariesRegistered = true; + } + } + // Register ResourceDictionaries using ms-resource:/// syntax, this is called for local resources + internal static void RegisterResourceDictionariesBySourceLocal() + { + } + static partial void RegisterDefaultStyles_MainPage_d6cd66944958ced0c513e0a04797b51d(); + + } +} diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_LocalizationResources.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_LocalizationResources.cs new file mode 100644 index 000000000000..115ce87c0105 --- /dev/null +++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_LocalizationResources.cs @@ -0,0 +1,2 @@ +// +[assembly: global::System.Reflection.AssemblyMetadata("UnoHasLocalizationResources", "False")] \ No newline at end of file diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs new file mode 100644 index 000000000000..f3271e118148 --- /dev/null +++ b/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Out/WLCHB/XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs @@ -0,0 +1,277 @@ +// +#pragma warning disable CS0114 +#pragma warning disable CS0108 +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Uno.UI; +using Uno.UI.Xaml; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Documents; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Animation; +using Microsoft.UI.Xaml.Shapes; +using Windows.UI.Text; +using Uno.Extensions; +using Uno; +using Uno.UI.Helpers; +using Uno.UI.Helpers.Xaml; +using MyProject; + +#if __ANDROID__ +using _View = Android.Views.View; +#elif __IOS__ +using _View = UIKit.UIView; +#elif __MACOS__ +using _View = AppKit.NSView; +#else +using _View = Microsoft.UI.Xaml.UIElement; +#endif + +namespace TestRepro +{ + partial class MainPage : global::Microsoft.UI.Xaml.Controls.Page + { + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + private const string __baseUri_prefix_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/"; + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + private const string __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d = "ms-appx:///TestProject/"; + private global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope(); + private void InitializeComponent() + { + NameScope.SetNameScope(this, __nameScope); + var __that = this; + base.IsParsing = true; + // Source 0\MainPage.xaml (Line 1:2) + base.Content = + new Microsoft.UI.Xaml.ElementStub( () => + new global::Microsoft.UI.Xaml.Controls.ContentControl + { + IsParsing = true, + Name = "topLevelContent", + // Source 0\MainPage.xaml (Line 9:3) + Content = + new global::Microsoft.UI.Xaml.Controls.TextBlock + { + IsParsing = true, + Name = "innerTextBlock", + // Source 0\MainPage.xaml (Line 10:4) + } + .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler0)(c0 => + { + /* _isTopLevelDictionary:False */ + __that._component_0 = c0; + __nameScope.RegisterName("innerTextBlock", c0); + __that.innerTextBlock = c0; + // FieldModifier public + c0.SetBinding( + global::Microsoft.UI.Xaml.Controls.TextBlock.TextProperty, + new Microsoft.UI.Xaml.Data.Binding() + { + Mode = global::Microsoft.UI.Xaml.Data.BindingMode.OneWay, + } + .BindingApply(___b => /*defaultBindModeOneTime InnerText*/ global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(___b, __that, ___ctx => ___ctx is global::TestRepro.MainPage ___tctx ? (TryGetInstance_xBind_1(___tctx, out var bindResult1) ? (true, bindResult1) : (false, default)) : (false, default), null , new [] {"InnerText"})) + ); + global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d); + c0.CreationComplete(); + } + )) + , + } + .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler1)(c1 => + { + __nameScope.RegisterName("topLevelContent", c1); + __that.topLevelContent = c1; + // FieldModifier public + // Load false + global::Uno.UI.FrameworkElementHelper.SetBaseUri(c1, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d); + c1.CreationComplete(); + } + )) + ) .MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply((MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions.XamlApplyHandler2)(c2 => + { + c2.Name = "topLevelContent"; + _topLevelContentSubject.ElementInstance = c2; + __that._component_1 = c2; + var _component_1_update_That = (this as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference; + var _component_1_update_subject_capture = _topLevelContentSubject; + void _component_1_update(global::Microsoft.UI.Xaml.ElementStub sender) + { + if (_component_1_update_That.Target is global::TestRepro.MainPage that) + { + if (sender.IsMaterialized) + { + that.Bindings.UpdateResources(); + } + } + } + c2.MaterializationChanged += _component_1_update; + var owner = this; + void _component_1_materializing(object sender) + { + if (_component_1_update_That.Target is global::TestRepro.MainPage that) + { + that._component_0.ApplyXBind(); + that._component_0.UpdateResourceBindings(); + } + } + c2.Materializing += _component_1_materializing; + } + )) + ; + + this + .GenericApply(((c3) => + { + // Source 0\MainPage.xaml (Line 1:2) + + // WARNING Property c3.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Page, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator + } + )) + .GenericApply(((c4) => + { + // Class TestRepro.MainPage + global::Uno.UI.FrameworkElementHelper.SetBaseUri(c4, __baseUri_MainPage_d6cd66944958ced0c513e0a04797b51d); + c4.CreationComplete(); + } + )) + ; + OnInitializeCompleted(); + + Bindings = new MainPage_Bindings(this); + Loading += (s, e) => + { + __that.Bindings.Update(); + __that.Bindings.UpdateResources(); + } + ; + } + partial void OnInitializeCompleted(); + private global::Microsoft.UI.Xaml.Data.ElementNameSubject _innerTextBlockSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject(); + public global::Microsoft.UI.Xaml.Controls.TextBlock innerTextBlock + { + get + { + return (global::Microsoft.UI.Xaml.Controls.TextBlock)_innerTextBlockSubject.ElementInstance; + } + set + { + _innerTextBlockSubject.ElementInstance = value; + } + } + private global::Microsoft.UI.Xaml.Data.ElementNameSubject _topLevelContentSubject = new global::Microsoft.UI.Xaml.Data.ElementNameSubject(); + public global::Microsoft.UI.Xaml.Controls.ContentControl topLevelContent + { + get + { + return (global::Microsoft.UI.Xaml.Controls.ContentControl)_topLevelContentSubject.ElementInstance; + } + set + { + _topLevelContentSubject.ElementInstance = value; + } + } + private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true); + private global::Microsoft.UI.Xaml.Controls.TextBlock _component_0 + { + get + { + return (global::Microsoft.UI.Xaml.Controls.TextBlock)_component_0_Holder.Instance; + } + set + { + _component_0_Holder.Instance = value; + } + } + private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: false); + private global::Microsoft.UI.Xaml.ElementStub _component_1 + { + get + { + return (global::Microsoft.UI.Xaml.ElementStub)_component_1_Holder.Instance; + } + set + { + _component_1_Holder.Instance = value; + } + } + private interface IMainPage_Bindings + { + void Initialize(); + void Update(); + void UpdateResources(); + void StopTracking(); + } + #pragma warning disable 0169 // Suppress unused field warning in case Bindings is not used. + private IMainPage_Bindings Bindings; + #pragma warning restore 0169 + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private class MainPage_Bindings : IMainPage_Bindings + { + #if UNO_HAS_UIELEMENT_IMPLICIT_PINNING + private global::System.WeakReference _ownerReference; + private global::TestRepro.MainPage Owner { get => (global::TestRepro.MainPage)_ownerReference?.Target; set => _ownerReference = new global::System.WeakReference(value); } + #else + private global::TestRepro.MainPage Owner { get; set; } + #endif + public MainPage_Bindings(global::TestRepro.MainPage owner) + { + Owner = owner; + } + void IMainPage_Bindings.Initialize() + { + } + void IMainPage_Bindings.Update() + { + var owner = Owner; + owner._component_0.ApplyXBind(); + } + void IMainPage_Bindings.UpdateResources() + { + var owner = Owner; + owner._component_0.UpdateResourceBindings(); + owner._component_1.UpdateResourceBindings(); + } + void IMainPage_Bindings.StopTracking() + { + } + } + private static bool TryGetInstance_xBind_1(global::TestRepro.MainPage ___tctx, out object o) + { + o = null; + o = ___tctx.InnerText; + return true; + } + } +} +namespace MyProject +{ + static class MainPage_d6cd66944958ced0c513e0a04797b51dXamlApplyExtensions + { + public delegate void XamlApplyHandler0(global::Microsoft.UI.Xaml.Controls.TextBlock instance); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static global::Microsoft.UI.Xaml.Controls.TextBlock MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.TextBlock instance, XamlApplyHandler0 handler) + { + handler(instance); + return instance; + } + public delegate void XamlApplyHandler1(global::Microsoft.UI.Xaml.Controls.ContentControl instance); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static global::Microsoft.UI.Xaml.Controls.ContentControl MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.Controls.ContentControl instance, XamlApplyHandler1 handler) + { + handler(instance); + return instance; + } + public delegate void XamlApplyHandler2(global::Microsoft.UI.Xaml.ElementStub instance); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + public static global::Microsoft.UI.Xaml.ElementStub MainPage_d6cd66944958ced0c513e0a04797b51d_XamlApply(this global::Microsoft.UI.Xaml.ElementStub instance, XamlApplyHandler2 handler) + { + handler(instance); + return instance; + } + } +}