From c8bd154c015b914e171a326481fef6532bc943de Mon Sep 17 00:00:00 2001 From: reunion-maestro-bot Date: Fri, 1 Mar 2024 07:26:29 +0000 Subject: [PATCH] Syncing content from committish f7a64ff105945fb702b0709dd193f886a1eca128 --- Directory.Build.props | 13 + .../AnnotatedScrollBar/AnnotatedScrollBar.cpp | 8 +- controls/dev/Collections/Vector.h | 112 +++++- .../dev/Materials/Acrylic/AcrylicBrush.cpp | 11 +- .../Repeater/APITests/ItemTemplateTests.cs | 62 ++++ .../ItemTemplateSamples/ItemTemplateDemo.xaml | 207 +++++------ .../TeachingTipFocusTestPageElements.cs | 9 + .../InteractionTests/TeachingTipTests.cs | 68 ++++ controls/dev/TeachingTip/TeachingTip.cpp | 24 +- controls/dev/TeachingTip/TeachingTip.h | 1 + .../TestUI/TeachingTip-FocusBehavior.md | 13 + .../TestUI/TeachingTipFocusPage.xaml | 2 +- .../dev/TreeView/TestUI/TreeViewPage.xaml | 25 +- .../dev/TreeView/TestUI/TreeViewPage.xaml.cs | 38 +- controls/dev/TreeView/ViewModel.cpp | 348 +++++++++--------- controls/dev/TreeView/ViewModel.h | 84 ++++- .../xcp/components/comptree/DCompTreeHost.cpp | 40 +- .../components/comptree/inc/DCompTreeHost.h | 1 + dxaml/xcp/core/core/elements/depends.cpp | 4 +- dxaml/xcp/core/dll/xcpcore.cpp | 2 +- dxaml/xcp/core/inc/InputServices.h | 73 +++- dxaml/xcp/core/inc/VisualTree.h | 12 + dxaml/xcp/core/input/InputServices.cpp | 236 ++++++++---- .../core/microsoft.ui.xaml.coretypes2.idl | 5 + dxaml/xcp/dxaml/lib/CascadingMenuHelper.cpp | 18 +- dxaml/xcp/dxaml/lib/DXamlCore.cpp | 27 +- dxaml/xcp/dxaml/lib/DesktopWindowImpl.cpp | 7 +- .../lib/DesktopWindowXamlSource_Partial.cpp | 26 ++ .../lib/DesktopWindowXamlSource_Partial.h | 5 +- dxaml/xcp/dxaml/lib/FlyoutBase_partial.cpp | 23 +- .../dxaml/lib/FrameworkElement_partial.cpp | 17 +- dxaml/xcp/dxaml/lib/InputSiteAdapter.h | 4 +- dxaml/xcp/dxaml/lib/JupiterWindow.cpp | 6 - dxaml/xcp/dxaml/lib/synonyms.g.h | 1 + .../DesktopWindowXamlSource.g.cpp | 22 ++ .../DesktopWindowXamlSource.g.h | 12 + .../XamlOM/Model/Microsoft.UI.Xaml.Hosting.cs | 17 +- .../XamlOM/Model/Microsoft.UI.Xaml.cs | 22 -- eng/Version.Details.xml | 12 +- .../CppWinRT/CppWinRT_AppPass1.cs | 6 + .../CppWinRT/CppWinRT_AppPass1.tt | 6 + .../CppWinRT/CppWinRT_BindingInfoPass1.cs | 6 + .../CppWinRT/CppWinRT_BindingInfoPass1.tt | 6 + .../CppWinRT/CppWinRT_PagePass1.cs | 9 +- .../CppWinRT/CppWinRT_PagePass1.tt | 7 + .../CppWinRT/CppWinRT_TypeInfoPass1.cs | 4 + .../CppWinRT/CppWinRT_TypeInfoPass1.tt | 4 + .../CppWinRT/CppWinRT_TypeInfoPass1Impl.cs | 5 + .../CppWinRT/CppWinRT_TypeInfoPass1Impl.tt | 5 + .../CppWinRT/CppWinRT_TypeInfoPass2.cs | 3 +- .../CppWinRT/CppWinRT_TypeInfoPass2.tt | 5 + .../CppWinRT_XamlMetaDataProviderPass1.cs | 5 + .../CppWinRT_XamlMetaDataProviderPass1.tt | 5 + .../CodeGenerators/PageDefinition.cs | 39 +- .../CodeGenerators/TypeInfoDefinition.cs | 18 +- 55 files changed, 1265 insertions(+), 485 deletions(-) create mode 100644 controls/dev/TeachingTip/TestUI/TeachingTip-FocusBehavior.md diff --git a/Directory.Build.props b/Directory.Build.props index 678a9bb54f..6dfc4fe649 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -21,6 +21,19 @@ false + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + - + https://dev.azure.com/microsoft/ProjectReunion/_git/WindowsAppSDK - e5cca86cae13e2d76d660b92c2887207ea0d7ae3 + f729ae6e9a9d1db8022c4a2be28b93c399f95b8f - + https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP - 2d8e71d8e93b54cebdbab98cf6c48d0393a303eb + ae2b1fa0e5de26d1f5cc3cdbc7ad03a96c110781 - + https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP - 2d8e71d8e93b54cebdbab98cf6c48d0393a303eb + ae2b1fa0e5de26d1f5cc3cdbc7ad03a96c110781 diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_AppPass1.cs b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_AppPass1.cs index e426f41a95..fc137ac352 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_AppPass1.cs +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_AppPass1.cs @@ -30,6 +30,12 @@ public override string TransformText() // the code is regenerated. //------------------------------------------------------------------------------ +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + #include ""winrt/"); this.Write(this.ToStringHelper.ToStringWithCulture(KnownNamespaces.Xaml)); this.Write(".h\"\r\n#include \"winrt/"); diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_AppPass1.tt b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_AppPass1.tt index 3cf823cd99..9962bb30c6 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_AppPass1.tt +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_AppPass1.tt @@ -8,6 +8,12 @@ // the code is regenerated. //------------------------------------------------------------------------------ +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + #include "winrt/<#=KnownNamespaces.Xaml#>.h" #include "winrt/<#=KnownNamespaces.XamlMarkup#>.h" #include "winrt/<#=KnownNamespaces.XamlInterop#>.h" diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_BindingInfoPass1.cs b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_BindingInfoPass1.cs index adc190e204..48600605cb 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_BindingInfoPass1.cs +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_BindingInfoPass1.cs @@ -32,6 +32,12 @@ public override string TransformText() //------------------------------------------------------------------------------ #pragma once +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + #include ""winrt/windows.foundation.h"" #include ""winrt/windows.ui.xaml.interop.h"" #include ""winrt/microsoft.ui.xaml.controls.h"" diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_BindingInfoPass1.tt b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_BindingInfoPass1.tt index bf30d1c781..20f4b187f6 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_BindingInfoPass1.tt +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_BindingInfoPass1.tt @@ -10,6 +10,12 @@ //------------------------------------------------------------------------------ #pragma once +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + #include "winrt/windows.foundation.h" #include "winrt/windows.ui.xaml.interop.h" #include "winrt/microsoft.ui.xaml.controls.h" diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PagePass1.cs b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PagePass1.cs index fbed3dc99e..7f382895e2 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PagePass1.cs +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PagePass1.cs @@ -22,7 +22,8 @@ internal partial class CppWinRT_PagePass1 : CppWinRT_CodeGenerator public override string TransformText() { - this.Write(@"//------------------------------------------------------------------------------ + this.Write(@" +//------------------------------------------------------------------------------ // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if @@ -30,6 +31,12 @@ public override string TransformText() //------------------------------------------------------------------------------ #pragma once +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + "); foreach (var includeFile in Model.NeededCppWinRTProjectionHeaderFiles) { this.Write("#if __has_include(<"); diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PagePass1.tt b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PagePass1.tt index cb5bc19a1c..d81e4bde8f 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PagePass1.tt +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PagePass1.tt @@ -1,5 +1,6 @@ <#@ template language="C#" inherits="CppWinRT_CodeGenerator" visibility="internal" linePragmas="false"#> <#@ assembly name="System.Core" #> + //------------------------------------------------------------------------------ // This code was generated by a tool. // @@ -8,6 +9,12 @@ //------------------------------------------------------------------------------ #pragma once +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + <# foreach (var includeFile in Model.NeededCppWinRTProjectionHeaderFiles) { #> #if __has_include(<<#=includeFile#>>) #include <<#=includeFile#>> diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1.cs b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1.cs index f8bf202f52..a2136c76d3 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1.cs +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1.cs @@ -38,6 +38,10 @@ public override string TransformText() #include #include +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + #include #include #include ""winrt/"); diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1.tt b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1.tt index 7013ea2fd2..63be8ef1be 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1.tt +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1.tt @@ -16,6 +16,10 @@ #include #include +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + #include #include #include "winrt/<#=KnownNamespaces.Xaml#>.h" diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1Impl.cs b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1Impl.cs index 5a7317d3ab..88c92637b9 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1Impl.cs +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1Impl.cs @@ -42,6 +42,11 @@ public override string TransformText() #include #include #include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + #include ""winrt/windows.foundation.h"" #include ""winrt/windows.ui.xaml.interop.h"" #include ""winrt/microsoft.ui.xaml.markup.h"" diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1Impl.tt b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1Impl.tt index 12996b337b..7729de2fa0 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1Impl.tt +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass1Impl.tt @@ -17,6 +17,11 @@ #include #include #include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + #include "winrt/windows.foundation.h" #include "winrt/windows.ui.xaml.interop.h" #include "winrt/microsoft.ui.xaml.markup.h" diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass2.cs b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass2.cs index 4d32caea59..c17dd0530d 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass2.cs +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass2.cs @@ -40,7 +40,8 @@ public override string TransformText() this.Write(this.ToStringHelper.ToStringWithCulture(ProjectInfo.PrecompiledHeaderFile)); this.Write("\"\r\n"); } - this.Write("#include \r\n\r\n"); + this.Write("#include \r\n#include \r\n\r\n// Undefine GetCurrentTime macro to pre" + + "vent\r\n// conflict with Storyboard::GetCurrentTime\r\n#undef GetCurrentTime\r\n\r\n"); foreach (var includeFile in Model.NeededCppWinRTProjectionHeaderFiles) { this.Write("#if __has_include(<"); this.Write(this.ToStringHelper.ToStringWithCulture(includeFile)); diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass2.tt b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass2.tt index eabc1474b6..155c6e7ad9 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass2.tt +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_TypeInfoPass2.tt @@ -16,6 +16,11 @@ #include "<#=ProjectInfo.PrecompiledHeaderFile#>" <# }#> #include +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime <# foreach (var includeFile in Model.NeededCppWinRTProjectionHeaderFiles) { #> #if __has_include(<<#=includeFile#>>) diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_XamlMetaDataProviderPass1.cs b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_XamlMetaDataProviderPass1.cs index 267fd070a5..3618aa9eac 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_XamlMetaDataProviderPass1.cs +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_XamlMetaDataProviderPass1.cs @@ -35,6 +35,11 @@ public override string TransformText() #include #include #include +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime #include ""XamlTypeInfo.xaml.g.h"" #include ""XamlMetaDataProvider.g.h"" diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_XamlMetaDataProviderPass1.tt b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_XamlMetaDataProviderPass1.tt index a88f56f02b..e30c0177cf 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_XamlMetaDataProviderPass1.tt +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_XamlMetaDataProviderPass1.tt @@ -13,6 +13,11 @@ #include #include #include +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime #include "XamlTypeInfo.xaml.g.h" #include "XamlMetaDataProvider.g.h" diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/PageDefinition.cs b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/PageDefinition.cs index 1e869d1408..e3477a1075 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/PageDefinition.cs +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/PageDefinition.cs @@ -13,7 +13,7 @@ internal class PageDefinition : Definition private List _allConnectionIdElements; private List _forwardDeclarations; private HashSet _neededLocalXamlHeaderFiles = new HashSet(); - private HashSet _neededCppWinRTProjectionHeaderFiles = new HashSet(); + private List _neededCppWinRTProjectionHeaderFiles = new List(); private bool _neededXamlHeaderFilesCalculated = false; private string _checksumAlgorithmGuid; private IEnumerable _allApiInformations; @@ -191,6 +191,8 @@ public string GetLoadComponentUri(string priIndexName, string xamlRelativePath) private void EnsureNeededXamlHeaderFilesCalculated() { + HashSet neededCppWinRTProjectionHeaderFiles; + void addCppWinRTHeaderForTypeIfNecessary(Type type) { // If the input type is an array type then we need to use its element type instead @@ -204,7 +206,7 @@ void addCppWinRTHeaderForTypeIfNecessary(Type type) // convention as they are part of the C++/WinRT project system itself (e.g. base.h) if (adjustedType != null && !XamlSchemaCodeInfo.IsProjectedPrimitiveCppType(adjustedType.FullName)) { - _neededCppWinRTProjectionHeaderFiles.Add($"winrt/{adjustedType.Namespace}.h"); + neededCppWinRTProjectionHeaderFiles.Add($"winrt/{adjustedType.Namespace}.h"); if (adjustedType.IsGenericType) { @@ -218,6 +220,8 @@ void addCppWinRTHeaderForTypeIfNecessary(Type type) if (!_neededXamlHeaderFilesCalculated) { + neededCppWinRTProjectionHeaderFiles = new HashSet(); + string headerFile; if (ProjectInfo.ClassToHeaderFileMap.TryGetValue(CodeInfo.ClassName.FullName, out headerFile)) { @@ -226,6 +230,12 @@ void addCppWinRTHeaderForTypeIfNecessary(Type type) foreach (XamlFileCodeInfo fileCodeInfo in CodeInfo.PerXamlFileInfo) { + if (fileCodeInfo.ConnectionIdElements.Any()) + { + // Need Microsoft.UI.Xaml.Markup.h for IComponentConnector + neededCppWinRTProjectionHeaderFiles.Add("winrt/Microsoft.UI.Xaml.Markup.h"); + } + // iterate over all the fields foreach (FieldDefinition fieldData in from c in fileCodeInfo.ConnectionIdElements where c.FieldDefinition != null @@ -249,6 +259,7 @@ void addCppWinRTHeaderForTypeIfNecessary(Type type) { foreach (EventAssignment xamlEvent in events) { + // Event handler type (e.g. RoutedEventHandler) if (ProjectInfo.ClassToHeaderFileMap.TryGetValue(xamlEvent.EventType.StandardName, out headerFile)) { _neededLocalXamlHeaderFiles.Add(headerFile); @@ -257,6 +268,16 @@ void addCppWinRTHeaderForTypeIfNecessary(Type type) { addCppWinRTHeaderForTypeIfNecessary(xamlEvent.EventType?.UnderlyingType); } + + // Event's declaring type (e.g. MUXC.Primitives.ButtonBase) + if (ProjectInfo.ClassToHeaderFileMap.TryGetValue(xamlEvent.DeclaringType.StandardName, out headerFile)) + { + _neededLocalXamlHeaderFiles.Add(headerFile); + } + else + { + addCppWinRTHeaderForTypeIfNecessary(xamlEvent.DeclaringType?.UnderlyingType); + } } } @@ -274,6 +295,20 @@ void addCppWinRTHeaderForTypeIfNecessary(Type type) } } + // Sort the projection headers by namespace + _neededCppWinRTProjectionHeaderFiles = neededCppWinRTProjectionHeaderFiles.OrderBy( + value => + { + if (value.EndsWith(".h")) + { + return value.Substring(0, value.Length - 2); + } + else + { + return value; + } + }).ToList(); + _neededXamlHeaderFilesCalculated = true; } } diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/TypeInfoDefinition.cs b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/TypeInfoDefinition.cs index a98529f370..a40ec3be94 100644 --- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/TypeInfoDefinition.cs +++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/TypeInfoDefinition.cs @@ -14,7 +14,7 @@ internal class TypeInfoDefinition : Definition private Dictionary _typeInfoIndexes; private UInt32[] _typeInfoLookup; private List _enumValues = new List(); - private HashSet _neededCppWinRTProjectionHeaderFiles; + private List _neededCppWinRTProjectionHeaderFiles; public TypeInfoDefinition(XamlProjectInfo projectInfo, XamlSchemaCodeInfo schemaInfo) : base(projectInfo, schemaInfo) @@ -294,7 +294,7 @@ public IEnumerable NeededCppWinRTProjectionHeaderFiles } } - private HashSet LookupNeededCppWinRTProjectionHeaderFiles() + private List LookupNeededCppWinRTProjectionHeaderFiles() { var headers = new HashSet(); @@ -316,7 +316,19 @@ void addCppWinRTHeaderForTypeIfNecessary(Type type) } } - return headers; + // Sort the projection headers by namespace + return headers.OrderBy( + value => + { + if (value.EndsWith(".h")) + { + return value.Substring(0, value.Length - 2); + } + else + { + return value; + } + }).ToList(); } public String GetterName(int i)