From e1970bc2069e162a140b4935bceecb7fab8b153d Mon Sep 17 00:00:00 2001 From: Lauren Ciha Date: Thu, 9 Jul 2026 13:31:45 -0700 Subject: [PATCH] C# Content Dialog --- .../.template.config/template.json | 28 ++----------------- .../CSharp/ContentDialog/ContentDialog.xaml | 14 ++++++---- .../ContentDialog/ContentDialog.xaml.cs | 6 ++-- .../WinUI.Neutral.Cs.ContentDialog.vstemplate | 4 +-- .../VSIX/Extension/Cs/Common/VSPackage.resx | 9 ++++++ .../VSIX/Extension/Directory.Build.targets | 9 +++++- 6 files changed, 32 insertions(+), 38 deletions(-) diff --git a/dev/Templates/Dotnet/templates/item-content-dialog/.template.config/template.json b/dev/Templates/Dotnet/templates/item-content-dialog/.template.config/template.json index b5ec18c922..d924cb89ad 100644 --- a/dev/Templates/Dotnet/templates/item-content-dialog/.template.config/template.json +++ b/dev/Templates/Dotnet/templates/item-content-dialog/.template.config/template.json @@ -10,7 +10,6 @@ "groupIdentity": "Microsoft.WindowsAppSDK.WinUI.CSharp.Item.ContentDialog", "name": "WinUI Content Dialog (Item)", "shortName": ["winui-dialog", "winui3-dialog"], - "sourceName": "ContentDialog", "defaultName": "ContentDialog", "description": "Adds a WinUI 3 ContentDialog with markup and code-behind.", "preferNameDirectory": false, @@ -26,7 +25,8 @@ "type": "derived", "valueSource": "name", "valueTransform": "safe_name", - "replaces": "$safeitemname$" + "replaces": "$safeitemname$", + "fileRename": "ContentDialog" }, "itemName": { "type": "derived", @@ -39,30 +39,6 @@ "valueSource": "name", "valueTransform": "identity", "replaces": "$fileinputname$" - }, - "contentDialogType": { - "type": "generated", - "generator": "constant", - "parameters": { - "value": "ContentDialog" - }, - "replaces": "__WINUI_CONTENT_DIALOG__" - }, - "contentDialogButtonClickEventArgsType": { - "type": "generated", - "generator": "constant", - "parameters": { - "value": "ContentDialogButtonClickEventArgs" - }, - "replaces": "__WINUI_CONTENT_DIALOG_BUTTON_CLICK_EVENT_ARGS__" - }, - "defaultContentDialogStyleResourceKey": { - "type": "generated", - "generator": "constant", - "parameters": { - "value": "DefaultContentDialogStyle" - }, - "replaces": "__WINUI_DEFAULT_CONTENT_DIALOG_STYLE__" } }, "constraints": { diff --git a/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/ContentDialog.xaml b/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/ContentDialog.xaml index 5379f27ca2..525fd74e8f 100644 --- a/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/ContentDialog.xaml +++ b/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/ContentDialog.xaml @@ -1,19 +1,21 @@ -<__WINUI_CONTENT_DIALOG__ + + - + diff --git a/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/ContentDialog.xaml.cs b/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/ContentDialog.xaml.cs index 6f3246714c..da9b07e399 100644 --- a/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/ContentDialog.xaml.cs +++ b/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/ContentDialog.xaml.cs @@ -7,18 +7,18 @@ namespace $rootnamespace$; -public sealed partial class $safeitemname$ : __WINUI_CONTENT_DIALOG__ +public sealed partial class $safeitemname$ : ContentDialog { public $safeitemname$() { InitializeComponent(); } - private void ContentDialog_PrimaryButtonClick(__WINUI_CONTENT_DIALOG__ sender, __WINUI_CONTENT_DIALOG_BUTTON_CLICK_EVENT_ARGS__ args) + private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { } - private void ContentDialog_SecondaryButtonClick(__WINUI_CONTENT_DIALOG__ sender, __WINUI_CONTENT_DIALOG_BUTTON_CLICK_EVENT_ARGS__ args) + private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { } } diff --git a/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/WinUI.Neutral.Cs.ContentDialog.vstemplate b/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/WinUI.Neutral.Cs.ContentDialog.vstemplate index 64b1650918..c5fa1ae9f9 100644 --- a/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/WinUI.Neutral.Cs.ContentDialog.vstemplate +++ b/dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/WinUI.Neutral.Cs.ContentDialog.vstemplate @@ -2,8 +2,8 @@ ContentDialog.xaml - - + + WinUI.Neutral.Cs.ContentDialog.ico CSharp WinUI.Cs.Neutral.ContentDialog diff --git a/dev/Templates/VSIX/Extension/Cs/Common/VSPackage.resx b/dev/Templates/VSIX/Extension/Cs/Common/VSPackage.resx index 9fa8cce5f3..4b2ff7949a 100644 --- a/dev/Templates/VSIX/Extension/Cs/Common/VSPackage.resx +++ b/dev/Templates/VSIX/Extension/Cs/Common/VSPackage.resx @@ -279,4 +279,13 @@ A project template for creating a WinUI app structured with the MVVM pattern using the CommunityToolkit.Mvvm package. + + Content Dialog + + + [Experimental] Content Dialog + + + A dialog box that displays content over the app UI to show information or gather input (WinUI). + \ No newline at end of file diff --git a/dev/Templates/VSIX/Extension/Directory.Build.targets b/dev/Templates/VSIX/Extension/Directory.Build.targets index 29070765be..af3446dce4 100644 --- a/dev/Templates/VSIX/Extension/Directory.Build.targets +++ b/dev/Templates/VSIX/Extension/Directory.Build.targets @@ -130,7 +130,14 @@ $(_OriginalVsixId) $(_OriginalVsixId).Experimental - Experimental $(_OriginalVsixName) + + Experimental $([System.Text.RegularExpressions.Regex]::Replace('$(_OriginalVsixName)', ' \(.*\)', '')) $(_OriginalVsixTags) <_OriginalVsixId>