Skip to content

Commit

Permalink
Merge pull request #8850 from unoplatform/mergify/bp/release/stable/4…
Browse files Browse the repository at this point in the history
….3/pr-8848

feat: Add WinUI 3 item templates (backport #8848)
  • Loading branch information
jeromelaban authored May 22, 2022
2 parents c7565a0 + 3f7d4f0 commit 579678b
Show file tree
Hide file tree
Showing 37 changed files with 369 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<PackageReference Update="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging.Filter" Version="1.1.2" />
<PackageReference Update="Uno.Extensions.Logging.WebAssembly.Console" Version="1.3.0" />
<PackageReference Update="Uno.Extensions.Logging.WebAssembly.OSLog" Version="1.3.0" />
<PackageReference Update="Uno.Extensions.Logging.WebAssembly.OSLog" Version="1.4.0" />
<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/SamplesApp/SamplesApp.Droid/SamplesApp.Droid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<PackageReference Include="Uno.CodeGen">
<Version>1.34.0</Version>
</PackageReference>
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.35" />
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.36" />
<PackageReference Include="Xamarin.AndroidX.AppCompat.AppCompatResources">
<Version>1.2.0.7</Version>
</PackageReference>
Expand Down Expand Up @@ -264,4 +264,4 @@
<_ExplicitReference Remove="@(_FilteredExplicitReference)" />
</ItemGroup>
</Target>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@

<ItemGroup Condition="'$(TargetFramework)'=='net6.0-android'">
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.4" />
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.35" />
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.36" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net6.0-ios' or '$(TargetFramework)'=='net6.0-maccatalyst'">
<PackageReference Include="Uno.Extensions.Logging.OSLog " Version="1.3.0" />
<PackageReference Include="Uno.Extensions.Logging.OSLog " Version="1.4.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net6.0-android'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<When Condition="'$(TargetFramework)'=='net6.0-android'">
<ItemGroup>
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.4" />
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.35" />
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.36" />
</ItemGroup>
<ItemGroup>
<AndroidEnvironment Include="Android/environment.conf" />
Expand All @@ -52,7 +52,7 @@
<MtouchExtraArgs>$(MtouchExtraArgs) --marshal-objectivec-exceptions:disable</MtouchExtraArgs>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Uno.Extensions.Logging.OSLog" Version="1.3.0" />
<PackageReference Include="Uno.Extensions.Logging.OSLog" Version="1.4.0" />
</ItemGroup>
</When>

Expand All @@ -72,7 +72,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Uno.Extensions.Logging.OSLog" Version="1.3.0" />
<PackageReference Include="Uno.Extensions.Logging.OSLog" Version="1.4.0" />
</ItemGroup>
</When>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<When Condition="'$(TargetFramework)'=='net6.0-android'">
<ItemGroup>
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.4" />
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.35" />
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.36" />
</ItemGroup>
<ItemGroup>
<AndroidEnvironment Include="Android/environment.conf" />
Expand All @@ -49,7 +49,7 @@
<MtouchExtraArgs>$(MtouchExtraArgs) --marshal-objectivec-exceptions:disable</MtouchExtraArgs>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Uno.Extensions.Logging.OSLog" Version="1.3.0" />
<PackageReference Include="Uno.Extensions.Logging.OSLog" Version="1.4.0" />
</ItemGroup>
</When>
<When Condition="'$(TargetFramework)'=='net6.0-maccatalyst'">
Expand All @@ -68,7 +68,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Uno.Extensions.Logging.OSLog" Version="1.3.0" />
<PackageReference Include="Uno.Extensions.Logging.OSLog" Version="1.4.0" />
</ItemGroup>
</When>
<When Condition="'$(TargetFramework)'=='net6.0-macos'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<PackageReference Include="Uno.UI.RemoteControl" Version="2.2.0" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="3.0.5" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Uno.Extensions.Logging.OSLog " Version="1.3.0" />
<PackageReference Include="Uno.Extensions.Logging.OSLog " Version="1.4.0" />
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Media.xcassets\AppIcons.appiconset\Contents.json" />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/UnoItemTemplate/BlankPage.WinUI/BlankPage.winui.vstemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>Page (Uno Platform WinUI 3)</Name>
<Description>A Page control</Description>
<Icon Package="{2581426E-BF4F-4A49-A42A-20EF9D51EF49}" ID="4007" />
<TemplateID>Uno.WinUI.CS.BlankPage</TemplateID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
<ProjectType>CSharp</ProjectType>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
<DefaultName>BlankPage.xaml</DefaultName>
<SortOrder>40</SortOrder>
<PreviewImage>BlankPage.png</PreviewImage>
</TemplateData>
<TemplateContent>
<ProjectItem OpenInEditor="true" ReplaceParameters="true" ItemType="Page" SubType="Designer" CustomTool="MSBuild:Compile" TargetFileName="$fileinputname$.xaml">BlankPage.xaml</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.xaml.cs">BlankPage.xaml.cs</ProjectItem>
</TemplateContent>
</VSTemplate>
14 changes: 14 additions & 0 deletions src/UnoItemTemplate/BlankPage.WinUI/BlankPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Page
x:Class="$rootnamespace$.$safeitemname$"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:$rootnamespace$"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>

</Grid>
</Page>
30 changes: 30 additions & 0 deletions src/UnoItemTemplate/BlankPage.WinUI/BlankPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

namespace $rootnamespace$
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class $safeitemname$ : Page
{
public $safeitemname$()
{
this.InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>ContentDialog (Uno Platform WinUI 3)</Name>
<Description>A ContentDialog control</Description>
<Icon Package="{2581426E-BF4F-4A49-A42A-20EF9D51EF49}" ID="4007" />
<TemplateID>Uno.WinUI.CS.ContentDialog</TemplateID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
<ProjectType>CSharp</ProjectType>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
<DefaultName>ContentDialog.xaml</DefaultName>
<SortOrder>40</SortOrder>
</TemplateData>
<TemplateContent>
<ProjectItem OpenInEditor="true" ReplaceParameters="true" ItemType="Page" SubType="Designer" CustomTool="MSBuild:Compile" TargetFileName="$fileinputname$.xaml">ContentDialog.xaml</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.xaml.cs">ContentDialog.xaml.cs</ProjectItem>
</TemplateContent>
</VSTemplate>
15 changes: 15 additions & 0 deletions src/UnoItemTemplate/ContentDialog.WinUI/ContentDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<ContentDialog
x:Class="$rootnamespace$.$safeitemname$"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:$rootnamespace$"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="TITLE"
PrimaryButtonText="Button1"
SecondaryButtonText="Button2"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
SecondaryButtonClick="ContentDialog_SecondaryButtonClick">

<Grid>
</Grid>
</ContentDialog>
33 changes: 33 additions & 0 deletions src/UnoItemTemplate/ContentDialog.WinUI/ContentDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;

namespace $rootnamespace$
{
public sealed partial class $safeitemname$ : ContentDialog
{
public $safeitemname$()
{
this.InitializeComponent();
}

private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
}

private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>ResourceDictionary with code behind (Uno Platform WinUI 3)</Name>
<Description>A ResourceDictionary with code behind.</Description>
<Icon Package="{2581426E-BF4F-4A49-A42A-20EF9D51EF49}" ID="4007" />
<TemplateID>Uno.WinUI.CS.ResourceDictionaryWithCodeBehind</TemplateID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
<ProjectType>CSharp</ProjectType>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
<DefaultName>ResourceDictionaryWithCodeBehind.xaml</DefaultName>
<SortOrder>40</SortOrder>
</TemplateData>
<TemplateContent>
<ProjectItem OpenInEditor="true" ReplaceParameters="true" ItemType="Page" SubType="Designer" CustomTool="MSBuild:Compile" TargetFileName="$fileinputname$.xaml">ResourceDictionaryWithCodeBehind.xaml</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.xaml.cs">ResourceDictionaryWithCodeBehind.xaml.cs</ProjectItem>
</TemplateContent>
</VSTemplate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<ResourceDictionary
x:Class="$rootnamespace$.$safeitemname$"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

</ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;

namespace $rootnamespace$
{
public sealed partial class $safeitemname$ : ResourceDictionary
{
public $safeitemname$()
{
this.InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Documents;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace $rootnamespace$
{
public sealed class $safeitemname$ : Control
{
public $safeitemname$()
{
this.DefaultStyleKey = typeof($safeitemname$);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:sdk="http://schemas.microsoft.com/developer/vstemplate-sdkextension/2010">
<TemplateData>
<DefaultName>CustomControl.cs</DefaultName>
<Name>Custom Control (Uno Platform WinUI 3)</Name>
<Description>A custom control for apps based on the UWP Library.</Description>
<Icon Package="{2581426E-BF4F-4A49-A42A-20EF9D51EF49}" ID="4007" />
<ProjectType>CSharp</ProjectType>
<TemplateID>Uno.WinUI.Neutral.UWP.TemplatedControl</TemplateID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
<ShowByDefault>true</ShowByDefault>
<TargetPlatformName>Windows</TargetPlatformName>
<AppIdFilter>blend</AppIdFilter>
<LanguageTag>csharp</LanguageTag>
<PlatformTag>windows</PlatformTag>
<ProjectTypeTag>uwp</ProjectTypeTag>
<ProjectTypeTag>desktop</ProjectTypeTag>
</TemplateData>
<TemplateContent>
<ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.cs">CustomControl.cs</ProjectItem>
</TemplateContent>
</VSTemplate>

Loading

0 comments on commit 579678b

Please sign in to comment.