-
Notifications
You must be signed in to change notification settings - Fork 752
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 #19389 from unoplatform/dev/cdb/hr-OriginalSourceL…
…ocation fix: Make sure to generate OriginalSourceLocation property on DataTemplates
- Loading branch information
Showing
6 changed files
with
378 additions
and
17 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
240 changes: 240 additions & 0 deletions
240
...t/SOSLIIOFEDT/XamlCodeGenerator_EmptyDataTemplatePage_0f836ad6c048ef5ac0e673406e3c3706.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,240 @@ | ||
// <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 EmptyDataTemplatePage : global::Microsoft.UI.Xaml.Controls.Page | ||
{ | ||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
private const string __baseUri_prefix_EmptyDataTemplatePage_0f836ad6c048ef5ac0e673406e3c3706 = "ms-appx:///TestProject/"; | ||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
private const string __baseUri_EmptyDataTemplatePage_0f836ad6c048ef5ac0e673406e3c3706 = "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; | ||
Resources[ | ||
"MyEmptyTemplate" | ||
] = | ||
new global::Uno.UI.Xaml.WeakResourceInitializer(this, __ResourceOwner_1 => | ||
{ | ||
return | ||
new global::Microsoft.UI.Xaml.DataTemplate( ) .GenericApply(__that, __nameScope, (ApplyMethod_0 )) | ||
; | ||
} | ||
) | ||
; | ||
// Source 0\EmptyDataTemplatePage.xaml (Line 1:3) | ||
base.Content = | ||
new global::Microsoft.UI.Xaml.Controls.StackPanel | ||
{ | ||
IsParsing = true, | ||
// Source 0\EmptyDataTemplatePage.xaml (Line 11:3) | ||
Children = | ||
{ | ||
new global::Microsoft.UI.Xaml.Controls.ListView | ||
{ | ||
IsParsing = true, | ||
// Source 0\EmptyDataTemplatePage.xaml (Line 12:4) | ||
} | ||
.GenericApply(__that, __nameScope, (ApplyMethod_1 )) | ||
, | ||
new global::Microsoft.UI.Xaml.Controls.Button | ||
{ | ||
IsParsing = true, | ||
Name = "ButtonWithEmptyDataTemplate", | ||
ContentTemplate = new global::Microsoft.UI.Xaml.DataTemplate( ) .GenericApply(__that, __nameScope, (ApplyMethod_2 )) | ||
, | ||
// Source 0\EmptyDataTemplatePage.xaml (Line 13:4) | ||
} | ||
.GenericApply(__that, __nameScope, (ApplyMethod_3 )) | ||
, | ||
} | ||
} | ||
.GenericApply(__that, __nameScope, (ApplyMethod_4 )) | ||
; | ||
|
||
this | ||
.GenericApply(__that, __nameScope, (ApplyMethod_5 )) | ||
.GenericApply(__that, __nameScope, (ApplyMethod_6 )) | ||
; | ||
OnInitializeCompleted(); | ||
|
||
Bindings = new EmptyDataTemplatePage_Bindings(this); | ||
((global::Microsoft.UI.Xaml.FrameworkElement)this).Loading += __UpdateBindingsAndResources; | ||
} | ||
partial void OnInitializeCompleted(); | ||
private void __UpdateBindingsAndResources(global::Microsoft.UI.Xaml.FrameworkElement s, object e) | ||
{ | ||
this.Bindings.UpdateResources(); | ||
} | ||
private void ApplyMethod_0(global::System.Object __p1, EmptyDataTemplatePage __that, global::Microsoft.UI.Xaml.NameScope __nameScope) | ||
{ | ||
global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/EmptyDataTemplatePage.xaml#L7:4"); | ||
} | ||
|
||
private void ApplyMethod_1(global::Microsoft.UI.Xaml.Controls.ListView __p1, EmptyDataTemplatePage __that, global::Microsoft.UI.Xaml.NameScope __nameScope) | ||
{ | ||
/* _isTopLevelDictionary:False */ | ||
__that._component_0 = __p1; | ||
global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.ListView.ItemTemplateProperty, "MyItemTemplate", isThemeResourceExtension: false, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_); | ||
global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_EmptyDataTemplatePage_0f836ad6c048ef5ac0e673406e3c3706, "file:///C:/Project/0/EmptyDataTemplatePage.xaml", 12, 4); | ||
__p1.CreationComplete(); | ||
} | ||
|
||
private void ApplyMethod_2(global::System.Object __p1, EmptyDataTemplatePage __that, global::Microsoft.UI.Xaml.NameScope __nameScope) | ||
{ | ||
global::Uno.UI.Helpers.MarkupHelper.SetElementProperty(__p1, "OriginalSourceLocation", "file:///C:/Project/0/EmptyDataTemplatePage.xaml#L15:6"); | ||
} | ||
|
||
private void ApplyMethod_3(global::Microsoft.UI.Xaml.Controls.Button __p1, EmptyDataTemplatePage __that, global::Microsoft.UI.Xaml.NameScope __nameScope) | ||
{ | ||
__nameScope.RegisterName("ButtonWithEmptyDataTemplate", __p1); | ||
__that.ButtonWithEmptyDataTemplate = __p1; | ||
global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_EmptyDataTemplatePage_0f836ad6c048ef5ac0e673406e3c3706, "file:///C:/Project/0/EmptyDataTemplatePage.xaml", 13, 4); | ||
__p1.CreationComplete(); | ||
} | ||
|
||
private void ApplyMethod_4(global::Microsoft.UI.Xaml.Controls.StackPanel __p1, EmptyDataTemplatePage __that, global::Microsoft.UI.Xaml.NameScope __nameScope) | ||
{ | ||
global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_EmptyDataTemplatePage_0f836ad6c048ef5ac0e673406e3c3706, "file:///C:/Project/0/EmptyDataTemplatePage.xaml", 11, 3); | ||
__p1.CreationComplete(); | ||
} | ||
|
||
private void ApplyMethod_5(global::Microsoft.UI.Xaml.Controls.Page __p1, EmptyDataTemplatePage __that, global::Microsoft.UI.Xaml.NameScope __nameScope) | ||
{ | ||
// Source 0\EmptyDataTemplatePage.xaml (Line 1:3) | ||
|
||
// WARNING Property __p1.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 | ||
} | ||
|
||
private void ApplyMethod_6(global::Microsoft.UI.Xaml.Controls.Page __p1, EmptyDataTemplatePage __that, global::Microsoft.UI.Xaml.NameScope __nameScope) | ||
{ | ||
/* _isTopLevelDictionary:False */ | ||
__that._component_1 = __p1; | ||
// Class TestRepro.EmptyDataTemplatePage | ||
global::Uno.UI.ResourceResolverSingleton.Instance.ApplyResource(__p1, global::Microsoft.UI.Xaml.Controls.Page.BackgroundProperty, "ApplicationPageBackgroundThemeBrush", isThemeResourceExtension: true, isHotReloadSupported: true, context: global::MyProject.GlobalStaticResources.__ParseContext_); | ||
global::Uno.UI.FrameworkElementHelper.SetBaseUri(__p1, __baseUri_EmptyDataTemplatePage_0f836ad6c048ef5ac0e673406e3c3706, "file:///C:/Project/0/EmptyDataTemplatePage.xaml", 1, 3); | ||
__p1.CreationComplete(); | ||
} | ||
|
||
private global::Microsoft.UI.Xaml.Data.ElementNameSubject _ButtonWithEmptyDataTemplateSubject { get; set; } = new global::Microsoft.UI.Xaml.Data.ElementNameSubject(); | ||
private global::Microsoft.UI.Xaml.Controls.Button ButtonWithEmptyDataTemplate | ||
{ | ||
get | ||
{ | ||
return (global::Microsoft.UI.Xaml.Controls.Button)_ButtonWithEmptyDataTemplateSubject.ElementInstance; | ||
} | ||
set | ||
{ | ||
_ButtonWithEmptyDataTemplateSubject.ElementInstance = value; | ||
} | ||
} | ||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate] | ||
private class __EmptyDataTemplatePage_0f836ad6c048ef5ac0e673406e3c3706_TestReproEmptyDataTemplatePage | ||
{ | ||
} | ||
private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_0_Holder { get; } = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true); | ||
private global::Microsoft.UI.Xaml.Controls.ListView _component_0 | ||
{ | ||
get | ||
{ | ||
return (global::Microsoft.UI.Xaml.Controls.ListView)_component_0_Holder.Instance; | ||
} | ||
set | ||
{ | ||
_component_0_Holder.Instance = value; | ||
} | ||
} | ||
private global::Microsoft.UI.Xaml.Markup.ComponentHolder _component_1_Holder { get; } = new global::Microsoft.UI.Xaml.Markup.ComponentHolder(isWeak: true); | ||
private global::Microsoft.UI.Xaml.Controls.Page _component_1 | ||
{ | ||
get | ||
{ | ||
return (global::Microsoft.UI.Xaml.Controls.Page)_component_1_Holder.Instance; | ||
} | ||
set | ||
{ | ||
_component_1_Holder.Instance = value; | ||
} | ||
} | ||
private interface IEmptyDataTemplatePage_Bindings | ||
{ | ||
void Initialize(); | ||
void Update(); | ||
void UpdateResources(); | ||
void StopTracking(); | ||
void NotifyXLoad(string name); | ||
} | ||
#pragma warning disable 0169 // Suppress unused field warning in case Bindings is not used. | ||
private IEmptyDataTemplatePage_Bindings Bindings; | ||
#pragma warning restore 0169 | ||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | ||
private class EmptyDataTemplatePage_Bindings : IEmptyDataTemplatePage_Bindings | ||
{ | ||
#if UNO_HAS_UIELEMENT_IMPLICIT_PINNING | ||
private global::System.WeakReference _ownerReference; | ||
private global::TestRepro.EmptyDataTemplatePage Owner { get => (global::TestRepro.EmptyDataTemplatePage)_ownerReference?.Target; set => _ownerReference = new global::System.WeakReference(value); } | ||
#else | ||
private global::TestRepro.EmptyDataTemplatePage Owner { get; set; } | ||
#endif | ||
public EmptyDataTemplatePage_Bindings(global::TestRepro.EmptyDataTemplatePage owner) | ||
{ | ||
Owner = owner; | ||
} | ||
void IEmptyDataTemplatePage_Bindings.NotifyXLoad(string name) | ||
{ | ||
} | ||
void IEmptyDataTemplatePage_Bindings.Initialize() | ||
{ | ||
} | ||
void IEmptyDataTemplatePage_Bindings.Update() | ||
{ | ||
var owner = Owner; | ||
} | ||
void IEmptyDataTemplatePage_Bindings.UpdateResources() | ||
{ | ||
var owner = Owner; | ||
owner._component_0.UpdateResourceBindings(); | ||
owner._component_1.UpdateResourceBindings(); | ||
} | ||
void IEmptyDataTemplatePage_Bindings.StopTracking() | ||
{ | ||
} | ||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...s.Tests/XamlCodeGeneratorTests/Out/SOSLIIOFEDT/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,59 @@ | ||
// <autogenerated /> | ||
namespace MyProject | ||
{ | ||
/// <summary> | ||
/// Contains all the static resources defined for the application | ||
/// </summary> | ||
[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate] | ||
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.Toolkit.GlobalStaticResources.Initialize(); | ||
global::Uno.UI.GlobalStaticResources.Initialize(); | ||
global::Uno.UI.Toolkit.GlobalStaticResources.RegisterDefaultStyles(); | ||
global::Uno.UI.GlobalStaticResources.RegisterDefaultStyles(); | ||
global::Uno.UI.Toolkit.GlobalStaticResources.RegisterResourceDictionariesBySource(); | ||
global::Uno.UI.GlobalStaticResources.RegisterResourceDictionariesBySource(); | ||
} | ||
} | ||
public static void RegisterDefaultStyles() | ||
{ | ||
if(!_stylesRegistered) | ||
{ | ||
_stylesRegistered = true; | ||
RegisterDefaultStyles_EmptyDataTemplatePage_0f836ad6c048ef5ac0e673406e3c3706(); | ||
} | ||
} | ||
// 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_EmptyDataTemplatePage_0f836ad6c048ef5ac0e673406e3c3706(); | ||
|
||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...s.Tests/XamlCodeGeneratorTests/Out/SOSLIIOFEDT/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")] |
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
Oops, something went wrong.