forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request unoplatform#17920 from Youssef1313/fix-events-top-…
…level fix: Fix XAML generator not generating events for non-DO top-level elements
- Loading branch information
Showing
6 changed files
with
190 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...tors.Tests/XamlCodeGeneratorTests/Out/WEOTLNDO/XamlCodeGenerator_GlobalStaticResources.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// <autogenerated /> | ||
namespace MyProject | ||
{ | ||
/// <summary> | ||
/// Contains all the static resources defined for the application | ||
/// </summary> | ||
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_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b(); | ||
} | ||
} | ||
// 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_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b(); | ||
|
||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...tors.Tests/XamlCodeGeneratorTests/Out/WEOTLNDO/XamlCodeGenerator_LocalizationResources.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// <auto-generated /> | ||
[assembly: global::System.Reflection.AssemblyMetadata("UnoHasLocalizationResources", "False")] |
81 changes: 81 additions & 0 deletions
81
...eratorTests/Out/WEOTLNDO/XamlCodeGenerator_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// <autogenerated /> | ||
#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 MainWindow : global::Microsoft.UI.Xaml.Window | ||
{ | ||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
private const string __baseUri_prefix_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b = "ms-appx:///TestProject/"; | ||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
private const string __baseUri_MainWindow_c93db19a7202d9eb84ddc41d72fcb89b = "ms-appx:///TestProject/"; | ||
private global::Microsoft.UI.Xaml.NameScope __nameScope = new global::Microsoft.UI.Xaml.NameScope(); | ||
private void InitializeComponent() | ||
{ | ||
var __that = this; | ||
// Source 0\MainWindow.xaml (Line 1:2) | ||
; | ||
|
||
this | ||
.GenericApply(((c0) => | ||
{ | ||
// Source 0\MainWindow.xaml (Line 1:2) | ||
|
||
// WARNING Property c0.base does not exist on {http://schemas.microsoft.com/winfx/2006/xaml/presentation}Window, the namespace is http://www.w3.org/XML/1998/namespace. This error was considered irrelevant by the XamlFileGenerator | ||
} | ||
)) | ||
.GenericApply(((c1) => | ||
{ | ||
// Class TestRepro.MainWindow | ||
var Closed_Window_Closed_That = (__that as global::Uno.UI.DataBinding.IWeakReferenceProvider).WeakReference; | ||
/* second level */ c1.Closed += (Window_Closed_sender,Window_Closed_args) => (Closed_Window_Closed_That.Target as global::TestRepro.MainWindow)?.Window_Closed(Window_Closed_sender,Window_Closed_args); | ||
} | ||
)) | ||
; | ||
if (__that.Content != null) | ||
{ | ||
NameScope.SetNameScope(__that.Content, __nameScope); | ||
} | ||
OnInitializeCompleted(); | ||
|
||
} | ||
partial void OnInitializeCompleted(); | ||
} | ||
} | ||
namespace MyProject | ||
{ | ||
static class MainWindow_c93db19a7202d9eb84ddc41d72fcb89bXamlApplyExtensions | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters