Skip to content

Commit

Permalink
Add Control Gallery to WinUI solution (dotnet#737)
Browse files Browse the repository at this point in the history
* WinUI CG

* - checkpoint compile 1

* - CG  Core

* - compatibility tests

* - fix namespaces

* - compile gallery

* - Fix WinUI quirks

* - GetForCurrentView

* - fix some more MG

* - fix up UI tests

* - fix winui tests to start up window and then locate top window manually

* - Namespaces
  • Loading branch information
PureWeen committed Apr 19, 2021
1 parent 9b3d1ae commit 218dcd4
Show file tree
Hide file tree
Showing 375 changed files with 779 additions and 310 deletions.
174 changes: 171 additions & 3 deletions Microsoft.Maui.WinUI.sln

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -933,18 +933,28 @@ Task("VS")
.IsDependentOn("VSMAC")
.IsDependentOn("VSWINDOWS");

Task("VS-CG")
.Description("Builds projects necessary so solution compiles on VS")
.IsDependentOn("Clean")
.IsDependentOn("VSMAC")
.IsDependentOn("VSWINDOWS");


Task("VSWINDOWS")
.Description("Builds projects necessary so solution compiles on VS Windows")
.IsDependentOn("BuildTasks")
.WithCriteria(IsRunningOnWindows())
.Does(() =>
{
MSBuild("Microsoft.Maui.sln",
string sln = "Microsoft.Maui.sln";
if (target == "VS-CG")
sln = "Compatibility.ControlGallery.sln";
MSBuild(sln,
GetMSBuildSettings()
.WithRestore());
StartVisualStudio();
StartVisualStudio(sln);
});

Task("VSMAC")
Expand All @@ -953,6 +963,10 @@ Task("VSMAC")
.IsDependentOn("BuildTasks")
.Does(() =>
{
string sln = "Microsoft.Maui.sln";
if (target == "VS-CG")
sln = "Compatibility.ControlGallery.sln";
MSBuild("src/Core/src/Core.csproj",
GetMSBuildSettings()
Expand All @@ -972,7 +986,7 @@ Task("VSMAC")
MSBuild("src/SingleProject/Resizetizer/src/Resizetizer.csproj", GetMSBuildSettings().WithRestore());
StartVisualStudio();
StartVisualStudio(sln);
});

Task("cg-android")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Microsoft.Maui.Controls.Compatibility.ControlGallery</AssemblyName>
<RootNamespace>Microsoft.Maui.Controls.Compatibility.ControlGallery</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<XFDisableTargetsValidation>True</XFDisableTargetsValidation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>TRACE;DEBUG;PERF;APP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0114;0108;0109;4014;0649;0169;0472;0414;0168;0219;0429</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DefineConstants>TRACE;APP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0114;0108;0109;4014;0649;0169;0472;0414;0168;0219;0429</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('uap10.0'))">
<DefineConstants>$(DefineConstants);__UWP__</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Remove="BuildNumber.txt" />
<None Remove="Fonts\CuteFont-Regular.ttf" />
<None Remove="Fonts\Dokdo-Regular.ttf" />
<None Remove="Fonts\fa-regular-400.ttf" />
<None Remove="Fonts\PTM55FT.ttf" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="GalleryPages\DateTimePickerGalleries\DatesPage.xaml" />
<EmbeddedResource Remove="GalleryPages\DateTimePickerGalleries\MainTabbedPage.xaml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="BuildNumber.txt" />
<EmbeddedResource Include="GalleryPages\crimson.jpg" />
<EmbeddedResource Include="coffee.png" />
<PackageReference Include="System.Threading.Thread" Version="4.3.0" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<EmbeddedResource Include="Fonts\CuteFont-Regular.ttf">
<SubType></SubType>
<Generator></Generator>
</EmbeddedResource>
<EmbeddedResource Include="Fonts\Dokdo-Regular.ttf">
<SubType></SubType>
<Generator></Generator>
</EmbeddedResource>
<EmbeddedResource Include="Fonts\fa-regular-400.ttf">
<SubType></SubType>
<Generator></Generator>
</EmbeddedResource>
<EmbeddedResource Include="Fonts\PTM55FT.ttf">
<SubType></SubType>
<Generator></Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="GalleryPages\CollectionViewGalleries\DataTemplateSelectorGalleries\VariedSizeDataTemplateSelectorGallery.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="GalleryPages\CollectionViewGalleries\ItemSizeGalleries\ChatExample.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="GalleryPages\DragAndDropGalleries\DragAndDropBetweenLayouts.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="GalleryPages\DragAndDropGalleries\DragPaths.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="GalleryPages\RadioButtonGalleries\ContentProperties.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="GalleryPages\RadioButtonGalleries\RadioButtonGroupBindingGallery.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="GalleryPages\RadioButtonGalleries\RadioButtonGroupGallery.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="GalleryPages\RadioButtonGalleries\RadioButtonGroupGalleryPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<Compile Update="GalleryPages\CollectionViewGalleries\ItemSizeGalleries\ChatExample.xaml.cs">
<DependentUpon>ChatExample.xaml</DependentUpon>
</Compile>
<Compile Update="GalleryPages\RadioButtonGalleries\RadioButtonGroupGallery.xaml.cs">
<DependentUpon>RadioButtonGroupGallery.xaml</DependentUpon>
</Compile>
<Compile Update="TabIndexTest\DaysOfWeekView.xaml.cs">
<DependentUpon>DaysOfWeekView.xaml</DependentUpon>
</Compile>
<Compile Update="GalleryPages\IndicatorViewGalleries\IndicatorGalleries.cs">
<SubType></SubType>
</Compile>
<Compile Update="XamStore\Controls\FlyoutFooter.xaml.cs">
<DependentUpon>FlyoutFooter.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="GalleryPages\RadioButtonGalleries\ScatteredRadioButtonGallery.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="GalleryPages\RadioButtonGalleries\TemplateFromStyle.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="TabIndexTest\DayView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="TabIndexTest\TabIndex.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="TabIndexTest\DaysOfWeekView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\Controls\tests\CustomAttributes\Controls.CustomAttributes.csproj" />
<ProjectReference Include="..\..\..\..\Controls\Maps\src\Controls.Maps-net6.csproj" />
<ProjectReference Include="..\..\..\..\Controls\src\Core\Controls.Core-net6.csproj" />
<ProjectReference Include="..\..\..\..\Controls\src\Xaml\Controls.Xaml-net6.csproj" />
<ProjectReference Include="..\..\..\..\Core\src\Core-net6.csproj" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="GalleryPages\GradientGalleries\LinearGradientPointsGallery.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="GalleryPages\TwoPaneViewGalleries\GridUsingDualScreenInfo.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="GalleryPages\TwoPaneViewGalleries\OpenCompactWindow.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="GalleryPages\TwoPaneViewGalleries\TwoPanePropertiesGallery.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="GalleryPages\AppThemeGalleries\AppThemeCodeGallery.cs">
<SubType></SubType>
</Compile>
<Compile Condition=" '$(EnableDefaultCompileItems)' == 'true' " Update="GalleryPages\AppThemeGalleries\AppThemeGallery.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="GalleryPages\AppThemeGalleries\AppThemeGallery.cs">
<SubType></SubType>
</Compile>
<Compile Update="GalleryPages\AppThemeGalleries\OSThemesGallery.cs">
<SubType></SubType>
</Compile>
</ItemGroup>
<Target Name="CreateControllGalleryConfig" BeforeTargets="Build">
<CreateItem Include="blank.config">
<Output TaskParameter="Include" ItemName="ConfigFile" />
</CreateItem>
<Copy SourceFiles="@(ConfigFile)" DestinationFiles="controlgallery.config" Condition="!Exists('controlgallery.config')" />
</Target>

<Import Project="..\Issues.Shared\Compatibility.ControlGallery.Issues.Shared.projitems" Label="Shared" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.Maui.Controls.CustomAttributes;
using NUnit.Framework.Interfaces;
using IOPath = System.IO.Path;
using Microsoft.Maui.Controls.Compatibility.ControlGallery.Issues;

#if UITEST
using Microsoft.Maui.Controls.Compatibility.UITests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;

using Xamarin.UITest;
using Xamarin.UITest.Queries;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>
<PropertyGroup>
<SkipImportNetSdk>true</SkipImportNetSdk>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
Expand Down Expand Up @@ -31,30 +34,43 @@
</ItemGroup>
<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
<PathToXAMLWinRTImplementations>Xamarin.Forms.ControlGallery.WindowsUniversal\</PathToXAMLWinRTImplementations>
</PropertyGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>9784da17-daef-455c-8cfb-ba4b4119c1b6</ProjectGuid>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<AssetTargetFallback>net6.0-windows$(TargetPlatformVersion);$(AssetTargetFallback)</AssetTargetFallback>
<DefaultLanguage>en-US</DefaultLanguage>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<AppxTargetsLocation Condition="'$(AppxTargetsLocation)'==''">$(MSBuildThisFileDirectory)build\</AppxTargetsLocation>
<EntryPointProjectUniqueName>..\Xamarin.Forms.ControlGallery.WindowsUniversal\Xamarin.Forms.ControlGallery.WindowsUniversal.csproj</EntryPointProjectUniqueName>
<EntryPointProjectUniqueName>..\WinUI\Compatibility.ControlGallery.WinUI.csproj</EntryPointProjectUniqueName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ProjectGuid>9784da17-daef-455c-8cfb-ba4b4119c1b6</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ProjectReunion" Version="[0.5.0]">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="[0.5.0]">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WinUI\Compatibility.ControlGallery.WinUI.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Assets\coverassets1.jpg" />
<Content Include="Assets\Fonts\fa-solid-900.ttf" />
<Content Include="Assets\Fonts\ionicons.ttf" />
<Content Include="Assets\Fonts\Lobster-Regular.ttf" />
<Content Include="Assets\Fonts\materialdesignicons-webfont.ttf" />
<Content Include="Assets\Fonts\OFL.txt" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\Logo.png" />
<Content Include="Assets\SmallLogo.png" />
Expand All @@ -66,19 +82,6 @@
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
<Content Include="Assets\WideLogo.scale-100.png" />
<None Include="Xamarin.Forms.ControlGallery.WindowsUniversal_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Xamarin.Forms.ControlGallery.WindowsUniversal\Xamarin.Forms.ControlGallery.WindowsUniversal.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<SDKReference Include="Microsoft.VCLibs.Desktop, Version=14.0" />
<!-- Needed for ucrtbased.dll when running a debug build. -->
<SDKReference Include="Microsoft.VCLibs, Version=14.0" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>
<ItemGroup>
<Content Include="bank.png" />
<Content Include="calculator.png" />
<Content Include="cardBackground.png" />
Expand All @@ -87,6 +90,7 @@
<Content Include="cover1small.jpg" />
<Content Include="crimson.jpg" />
<Content Include="crimsonsmall.jpg" />
<Content Include="default.css" />
<Content Include="FlowerBuds.jpg" />
<Content Include="Fruits.jpg" />
<Content Include="GifOne.gif" />
Expand Down Expand Up @@ -144,8 +148,7 @@
<Content Include="xamarinstore.jpg" />
</ItemGroup>
<ItemGroup>
<Content Include="default.css" />
<None Include="Assets\Fonts\OFL.txt" />
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
<Import Project="$(AppxTargetsLocation)Microsoft.WinUI.AppX.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Version="1.0.0.0" />

<Properties>
<DisplayName>Xamarin.Forms.ControlGallery.WindowsUniversal (Package)</DisplayName>
<DisplayName>Compatibility.ControlGallery.WinUI (Package)</DisplayName>
<PublisherDisplayName>Microsoft</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
Expand All @@ -31,8 +31,8 @@
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="Xamarin.Forms.ControlGallery.WindowsUniversal (Package)"
Description="Xamarin.Forms.ControlGallery.WindowsUniversal (Package)"
DisplayName="Compatibility.ControlGallery.WinUI (Package)"
Description="Compatibility.ControlGallery.WinUI (Package)"
BackgroundColor="transparent"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Application
x:Class="Xamarin.Forms.ControlGallery.WindowsUniversal.App"
x:Class="Microsoft.Maui.Controls.Compatibility.ControlGallery.WinUI.App"
xmlns="http:https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http:https://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WinUI3Desktop">

<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:https:///Xamarin.Forms.Platform.UAP/Resources.xbf" />
<ResourceDictionary Source="ms-appx:https:///Microsoft.Maui.Controls.Compatibility/WinUI/Resources.xbf" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application.Resources>

</Application>
Loading

0 comments on commit 218dcd4

Please sign in to comment.