diff --git a/Samples/PhotoEditor/README.md b/Samples/PhotoEditor/README.md index 7d83a54b6..fab39879a 100644 --- a/Samples/PhotoEditor/README.md +++ b/Samples/PhotoEditor/README.md @@ -32,6 +32,8 @@ A mini-app for viewing and editing image files, demonstrating XAML layout, data ### PhotoEditor C# Sample Application ![Photo Editor csharp sample showing the image collection page, and editing controls](images/CS_Picture1.png) +> **Note**. The C# (`cs-winui`) sample has been refreshed to modern Windows App SDK conventions: it targets Windows App SDK 1.8, uses a Mica backdrop with a `TitleBar`, the `App.MainWindow`/`DispatcherQueue` window lifecycle, and nullable reference types, with the legacy UWP `ApiInformation`/`ConnectedAnimationService.GetForCurrentView` and contract-based conditional XAML removed. It loads its bundled sample photos from the app's install location (`Assets\Samples`). + ## Features Photo Editor demonstrates: @@ -41,8 +43,7 @@ Photo Editor demonstrates: * XAML styling and UI customization, including [connected animations](https://docs.microsoft.com/windows/uwp/design/motion/connected-animation). * Image effects from [**Windows.UI.Composition**](https://docs.microsoft.com/uwp/api/windows.ui.composition). * Loading images from the **Pictures** library using data virtualization to increase performance when there are numerous files. -* The [**Microsoft.Graphics.Win2D**](https://microsoft.github.io/Win2D/WinUI3/html/Introduction.htm) NuGet package (an easy-to-use Windows Runtime API for immediate-mode 2D graphics rendering). -For WinUI). +* The [**Microsoft.Graphics.Win2D**](https://microsoft.github.io/Win2D/WinUI3/html/Introduction.htm) NuGet package (an easy-to-use Windows Runtime API for immediate-mode 2D graphics rendering for WinUI). ### C++/WinRT-specific features diff --git a/Samples/PhotoEditor/cs-winui/.gitignore b/Samples/PhotoEditor/cs-winui/.gitignore new file mode 100644 index 000000000..dd393563d --- /dev/null +++ b/Samples/PhotoEditor/cs-winui/.gitignore @@ -0,0 +1,54 @@ +## .NET / Visual Studio +[Bb]in/ +[Oo]bj/ +[Dd]ebug/ +[Rr]elease/ +.vs/ +*.user +*.suo +*.userosscache +*.sln.docstates +artifacts/ + +# Build logs +[Ll]og/ +[Ll]ogs/ +*.log +*.binlog + +# Test results +[Tt]est[Rr]esult*/ +*.trx +*.coverage +*.coveragexml + +# NuGet +*.nupkg +*.snupkg +*.nuget.props +*.nuget.targets +project.lock.json + +# MSIX packaging output +AppPackages/ +BundleArtifacts/ +*.msix +*.msixupload +*.appx +*.appxbundle +*.appxupload + +# Publish output +publish/ +*.pubxml +PublishScripts/ + +# Code analysis and tooling +_ReSharper*/ +*.DotSettings.user +*.dotCover +.idea/ + +# Generated files +Generated\ Files/ +*_wpftmp.csproj diff --git a/Samples/PhotoEditor/cs-winui/App.xaml b/Samples/PhotoEditor/cs-winui/App.xaml index 67773461c..6ac0286f6 100644 --- a/Samples/PhotoEditor/cs-winui/App.xaml +++ b/Samples/PhotoEditor/cs-winui/App.xaml @@ -1,4 +1,4 @@ - - - - - + + + 0 641 1008 diff --git a/Samples/PhotoEditor/cs-winui/App.xaml.cs b/Samples/PhotoEditor/cs-winui/App.xaml.cs index f5afc4b5d..439f991b2 100644 --- a/Samples/PhotoEditor/cs-winui/App.xaml.cs +++ b/Samples/PhotoEditor/cs-winui/App.xaml.cs @@ -1,23 +1,47 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using Microsoft.UI.Xaml; using System; +using Microsoft.UI.Dispatching; +using Microsoft.UI.Xaml; -// To learn more about WinUI, the WinUI project structure, -// and more about our project templates, see: http://aka.ms/winui-project-info. +namespace PhotoEditor; -namespace PhotoEditor +/// +/// Provides application-specific behavior to supplement the default Application class. +/// +public partial class App : Application { - public partial class App : Application + /// + /// Gets the application's main window. WinUI 3 desktop has no Window.Current, + /// so the sample tracks the main window here (migration: Window.Current -> App.MainWindow). + /// + public static MainWindow MainWindow { get; private set; } = null!; + + /// + /// Gets the DispatcherQueue for the UI thread. Replaces UWP's CoreDispatcher. + /// + public static DispatcherQueue MainDispatcherQueue { get; private set; } = null!; + + /// + /// Gets the HWND of the main window, used to associate pickers with the window + /// (migration: pickers must be initialized with the owning window handle). + /// + public static IntPtr WindowHandle { get; private set; } + + public App() { - protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) - { - Window = new MainWindow(); - Window.Activate(); - WindowHandle = WinRT.Interop.WindowNative.GetWindowHandle(Window); - } - public static MainWindow Window { get; private set; } - public static IntPtr WindowHandle { get; private set; } + InitializeComponent(); + } + + protected override void OnLaunched(LaunchActivatedEventArgs args) + { + MainWindow = new MainWindow(); + MainDispatcherQueue = MainWindow.DispatcherQueue; + WindowHandle = WinRT.Interop.WindowNative.GetWindowHandle(MainWindow); + + // Navigate only after MainWindow is assigned: pages read App.MainWindow in OnNavigatedTo. + MainWindow.NavigateToMainPage(); + MainWindow.Activate(); } -} \ No newline at end of file +} diff --git a/Samples/PhotoEditor/cs-winui/Assets/AppIcon.ico b/Samples/PhotoEditor/cs-winui/Assets/AppIcon.ico new file mode 100644 index 000000000..235dad2c5 Binary files /dev/null and b/Samples/PhotoEditor/cs-winui/Assets/AppIcon.ico differ diff --git a/Samples/PhotoEditor/cs-winui/Assets/LockScreenLogo.scale-200.png b/Samples/PhotoEditor/cs-winui/Assets/LockScreenLogo.scale-200.png index 7440f0d4b..33f889e10 100644 Binary files a/Samples/PhotoEditor/cs-winui/Assets/LockScreenLogo.scale-200.png and b/Samples/PhotoEditor/cs-winui/Assets/LockScreenLogo.scale-200.png differ diff --git a/Samples/PhotoEditor/cs-winui/Assets/SplashScreen.scale-200.png b/Samples/PhotoEditor/cs-winui/Assets/SplashScreen.scale-200.png index 32f486a86..802c79d6d 100644 Binary files a/Samples/PhotoEditor/cs-winui/Assets/SplashScreen.scale-200.png and b/Samples/PhotoEditor/cs-winui/Assets/SplashScreen.scale-200.png differ diff --git a/Samples/PhotoEditor/cs-winui/Assets/Square150x150Logo.scale-200.png b/Samples/PhotoEditor/cs-winui/Assets/Square150x150Logo.scale-200.png index 53ee3777e..ddba42adb 100644 Binary files a/Samples/PhotoEditor/cs-winui/Assets/Square150x150Logo.scale-200.png and b/Samples/PhotoEditor/cs-winui/Assets/Square150x150Logo.scale-200.png differ diff --git a/Samples/PhotoEditor/cs-winui/Assets/Square44x44Logo.scale-200.png b/Samples/PhotoEditor/cs-winui/Assets/Square44x44Logo.scale-200.png index f713bba67..9327dd748 100644 Binary files a/Samples/PhotoEditor/cs-winui/Assets/Square44x44Logo.scale-200.png and b/Samples/PhotoEditor/cs-winui/Assets/Square44x44Logo.scale-200.png differ diff --git a/Samples/PhotoEditor/cs-winui/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/Samples/PhotoEditor/cs-winui/Assets/Square44x44Logo.targetsize-24_altform-unplated.png index dc9f5bea0..e51416a8e 100644 Binary files a/Samples/PhotoEditor/cs-winui/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and b/Samples/PhotoEditor/cs-winui/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/Samples/PhotoEditor/cs-winui/Assets/Square44x44Logo.targetsize-48_altform-lightunplated.png b/Samples/PhotoEditor/cs-winui/Assets/Square44x44Logo.targetsize-48_altform-lightunplated.png new file mode 100644 index 000000000..bf063eb4d Binary files /dev/null and b/Samples/PhotoEditor/cs-winui/Assets/Square44x44Logo.targetsize-48_altform-lightunplated.png differ diff --git a/Samples/PhotoEditor/cs-winui/Assets/StoreLogo.png b/Samples/PhotoEditor/cs-winui/Assets/StoreLogo.png index a4586f26b..be865f0c3 100644 Binary files a/Samples/PhotoEditor/cs-winui/Assets/StoreLogo.png and b/Samples/PhotoEditor/cs-winui/Assets/StoreLogo.png differ diff --git a/Samples/PhotoEditor/cs-winui/Assets/Wide310x150Logo.scale-200.png b/Samples/PhotoEditor/cs-winui/Assets/Wide310x150Logo.scale-200.png index 8b4a5d0dd..314d297f2 100644 Binary files a/Samples/PhotoEditor/cs-winui/Assets/Wide310x150Logo.scale-200.png and b/Samples/PhotoEditor/cs-winui/Assets/Wide310x150Logo.scale-200.png differ diff --git a/Samples/PhotoEditor/cs-winui/DetailPage.xaml b/Samples/PhotoEditor/cs-winui/DetailPage.xaml index f1e1b37fe..709d877d4 100644 --- a/Samples/PhotoEditor/cs-winui/DetailPage.xaml +++ b/Samples/PhotoEditor/cs-winui/DetailPage.xaml @@ -1,15 +1,13 @@ - + mc:Ignorable="d"> @@ -37,11 +35,7 @@ - + @@ -126,14 +121,14 @@ - + + Margin="24,12,0,24" /> @@ -141,14 +136,12 @@ Label="Zoom" Flyout="{StaticResource zoomFlyout}" /> - - + - - + ItemContainerStyle="{StaticResource ImageGridView_DefaultItemContainerStyle}" /> diff --git a/Samples/PhotoEditor/cs-winui/MainPage.xaml.cs b/Samples/PhotoEditor/cs-winui/MainPage.xaml.cs index 628c14284..4b9fe8b05 100644 --- a/Samples/PhotoEditor/cs-winui/MainPage.xaml.cs +++ b/Samples/PhotoEditor/cs-winui/MainPage.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; @@ -6,224 +6,214 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Threading.Tasks; -using Windows.ApplicationModel; -using Windows.Storage; -using Windows.Storage.Search; -using Windows.Storage.Streams; -using Windows.System.Profile; -using Windows.UI.Core; -using Windows.UI.ViewManagement; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media.Animation; using Microsoft.UI.Xaml.Media.Imaging; using Microsoft.UI.Xaml.Navigation; -using Windows.Foundation.Metadata; +using Windows.ApplicationModel; +using Windows.Storage; +using Windows.Storage.Search; + +namespace PhotoEditor; -namespace PhotoEditor +public sealed partial class MainPage : Page, INotifyPropertyChanged { - public sealed partial class MainPage : Page, INotifyPropertyChanged + public static MainPage Current { get; private set; } = null!; + + private ImageFileInfo? persistedItem; + + public ObservableCollection Images { get; } = new(); + + public event PropertyChangedEventHandler? PropertyChanged; + + public MainPage() { - public static MainPage Current; - private ImageFileInfo persistedItem; + InitializeComponent(); + Current = this; + } - public ObservableCollection Images { get; } = new ObservableCollection(); - public event PropertyChangedEventHandler PropertyChanged; + // If the image is edited and saved in the details page, this method gets called + // so that the back navigation connected animation uses the correct image. + public void UpdatePersistedItem(ImageFileInfo item) + { + persistedItem = item; + } - public MainPage() + protected override async void OnNavigatedTo(NavigationEventArgs e) + { + if (Images.Count == 0) { - this.InitializeComponent(); - Current = this; + await GetItemsAsync(); } - // If the image is edited and saved in the details page, this method gets called - // so that the back navigation connected animation uses the correct image. - public void UpdatePersistedItem(ImageFileInfo item) - { - persistedItem = item; - } + base.OnNavigatedTo(e); + } - protected async override void OnNavigatedTo(NavigationEventArgs e) + // Called by the Loaded event of the ImageGridView. + private async void StartConnectedAnimationForBackNavigation() + { + // Run the connected animation for navigation back to the main page from the detail page. + if (persistedItem != null) { - if (Images.Count == 0) + ImageGridView.ScrollIntoView(persistedItem); + ConnectedAnimation? animation = + ConnectedAnimationService.GetForCurrentView().GetAnimation("backAnimation"); + if (animation != null) { - await GetItemsAsync(); + await ImageGridView.TryStartConnectedAnimationAsync(animation, persistedItem, "ItemImage"); } - - base.OnNavigatedTo(e); } + } + + private void ImageGridView_ItemClick(object sender, ItemClickEventArgs e) + { + // Prepare the connected animation for navigation to the detail page. + persistedItem = e.ClickedItem as ImageFileInfo; + ImageGridView.PrepareConnectedAnimation("itemAnimation", e.ClickedItem, "ItemImage"); + + Frame.Navigate(typeof(DetailPage), e.ClickedItem); + } - // Called by the Loaded event of the ImageGridView. - private async void StartConnectedAnimationForBackNavigation() + private async Task GetItemsAsync() + { + QueryOptions options = new() + { + FolderDepth = FolderDepth.Deep, + }; + options.FileTypeFilter.Add(".jpg"); + options.FileTypeFilter.Add(".png"); + options.FileTypeFilter.Add(".gif"); + + // Load the sample pictures that ship with the app. To browse the user's own + // photos instead, request the 'Pictures Library' capability and use + // KnownFolders.PicturesLibrary here. + StorageFolder appInstalledFolder = Package.Current.InstalledLocation; + StorageFolder picturesFolder = await appInstalledFolder.GetFolderAsync(@"Assets\Samples"); + + var result = picturesFolder.CreateFileQueryWithOptions(options); + + IReadOnlyList imageFiles = await result.GetFilesAsync(); + bool unsupportedFilesFound = false; + foreach (StorageFile file in imageFiles) { - // Run the connected animation for navigation back to the main page from the detail page. - if (persistedItem != null) + // Only files on the local computer are supported. + // Files on OneDrive or a network location are excluded. + if (file.Provider.Id == "computer") { - ImageGridView.ScrollIntoView(persistedItem); - ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("backAnimation"); - if (animation != null) - { - await ImageGridView.TryStartConnectedAnimationAsync(animation, persistedItem, "ItemImage"); - } + Images.Add(await LoadImageInfo(file)); + } + else + { + unsupportedFilesFound = true; } } - private void ImageGridView_ItemClick(object sender, ItemClickEventArgs e) - { - // Prepare the connected animation for navigation to the detail page. - persistedItem = e.ClickedItem as ImageFileInfo; - ImageGridView.PrepareConnectedAnimation("itemAnimation", e.ClickedItem, "ItemImage"); - - this.Frame.Navigate(typeof(DetailPage), e.ClickedItem); - } - - private async Task GetItemsAsync() + if (unsupportedFilesFound) { - QueryOptions options = new QueryOptions(); - options.FolderDepth = FolderDepth.Deep; - options.FileTypeFilter.Add(".jpg"); - options.FileTypeFilter.Add(".png"); - options.FileTypeFilter.Add(".gif"); - - // Get the Pictures library. (Requires 'Pictures Library' capability.) - //Windows.Storage.StorageFolder picturesFolder = Windows.Storage.KnownFolders.PicturesLibrary; - // OR - // Get the Sample pictures. - StorageFolder appInstalledFolder = Package.Current.InstalledLocation; - StorageFolder picturesFolder = await appInstalledFolder.GetFolderAsync("Assets\\Samples"); - - var result = picturesFolder.CreateFileQueryWithOptions(options); - - IReadOnlyList imageFiles = await result.GetFilesAsync(); - bool unsupportedFilesFound = false; - foreach (StorageFile file in imageFiles) + ContentDialog unsupportedFilesDialog = new() { - // Only files on the local computer are supported. - // Files on OneDrive or a network location are excluded. - if (file.Provider.Id == "computer") - { - Images.Add(await LoadImageInfo(file)); - } - else - { - unsupportedFilesFound = true; - } - } + Title = "Unsupported images found", + Content = "This sample app only supports images stored locally on the computer. We found files in your library that are stored in OneDrive or another network location. We didn't load those images.", + CloseButtonText = "Ok", + XamlRoot = XamlRoot, + }; - if (unsupportedFilesFound == true) - { - ContentDialog unsupportedFilesDialog = new ContentDialog - { - Title = "Unsupported images found", - Content = "This sample app only supports images stored locally on the computer. We found files in your library that are stored in OneDrive or another network location. We didn't load those images.", - CloseButtonText = "Ok" - }; + await unsupportedFilesDialog.ShowAsync(); + } + } - if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - unsupportedFilesDialog.XamlRoot = ImageGridView.XamlRoot; - } + public static async Task LoadImageInfo(StorageFile file) + { + var properties = await file.Properties.GetImagePropertiesAsync(); + ImageFileInfo info = new(properties, file, file.DisplayName, file.DisplayType); - ContentDialogResult resultNotUsed = await unsupportedFilesDialog.ShowAsync(); + return info; + } - if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - unsupportedFilesDialog.XamlRoot = this.Content.XamlRoot; - } + public double ItemSize + { + get => _itemSize; + set + { + if (_itemSize != value) + { + _itemSize = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ItemSize))); } } + } + private double _itemSize; - public async static Task LoadImageInfo(StorageFile file) + private void DetermineItemSize() + { + if (FitScreenToggle != null + && FitScreenToggle.IsOn + && ImageGridView != null + && ZoomSlider != null) { - var properties = await file.Properties.GetImagePropertiesAsync(); - ImageFileInfo info = new ImageFileInfo( - properties, file, - file.DisplayName, file.DisplayType); - - return info; + // The 'margins' value represents the total of the margins around the + // image in the grid item. 8 from the ItemTemplate root grid + 8 from + // the ItemContainerStyle * (Right + Left). If those values change, + // this value needs to be updated to match. + int margins = (int)Resources["LargeItemMarginValue"] * 4; + double gridWidth = ImageGridView.ActualWidth - (int)Resources["DefaultWindowSidePaddingValue"]; + double itemWidth = ZoomSlider.Value + margins; + // We need at least 1 column. + int columns = (int)Math.Max(gridWidth / itemWidth, 1); + + // Adjust the available grid width to account for margins around each item. + double adjustedGridWidth = gridWidth - (columns * margins); + + ItemSize = adjustedGridWidth / columns; } + else + { + // ZoomSlider lives in a Flyout, so it may not be realized yet the first + // time SizeChanged fires; fall back to the slider's default value. + ItemSize = ZoomSlider?.Value ?? 270; + } + } - public double ItemSize + private void ImageGridView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) + { + if (args.InRecycleQueue) { - get => _itemSize; - set - { - if (_itemSize != value) - { - _itemSize = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ItemSize))); - } - } + var templateRoot = (Grid)args.ItemContainer.ContentTemplateRoot; + var image = (Image)templateRoot.FindName("ItemImage"); + image.Source = null; } - private double _itemSize; - private void DetermineItemSize() + if (args.Phase == 0) { - if (FitScreenToggle != null - && FitScreenToggle.IsOn == true - && ImageGridView != null - && ZoomSlider != null) - { - // The 'margins' value represents the total of the margins around the - // image in the grid item. 8 from the ItemTemplate root grid + 8 from - // the ItemContainerStyle * (Right + Left). If those values change, - // this value needs to be updated to match. - int margins = (int)this.Resources["LargeItemMarginValue"] * 4; - double gridWidth = ImageGridView.ActualWidth - (int)this.Resources["DefaultWindowSidePaddingValue"]; - double ItemWidth = ZoomSlider.Value + margins; - // We need at least 1 column. - int columns = (int)Math.Max(gridWidth / ItemWidth, 1); - - // Adjust the available grid width to account for margins around each item. - double adjustedGridWidth = gridWidth - (columns * margins); - - ItemSize = (adjustedGridWidth / columns); - } - else - { - ItemSize = ZoomSlider.Value; - } + args.RegisterUpdateCallback(ShowImage); + args.Handled = true; } + } - private void ImageGridView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) + private async void ShowImage(ListViewBase sender, ContainerContentChangingEventArgs args) + { + if (args.Phase == 1) { - if (args.InRecycleQueue) - { - var templateRoot = args.ItemContainer.ContentTemplateRoot as Grid; - var image = (Image)templateRoot.FindName("ItemImage"); + // It's phase 1, so show this item's image. + var templateRoot = (Grid)args.ItemContainer.ContentTemplateRoot; + var image = (Image)templateRoot.FindName("ItemImage"); + image.Opacity = 1; - image.Source = null; - } + var item = (ImageFileInfo)args.Item; - if (args.Phase == 0) + try { - args.RegisterUpdateCallback(ShowImage); - args.Handled = true; + image.Source = await item.GetImageThumbnailAsync(); } - } - - private async void ShowImage(ListViewBase sender, ContainerContentChangingEventArgs args) - { - if (args.Phase == 1) + catch (Exception) { - // It's phase 1, so show this item's image. - var templateRoot = args.ItemContainer.ContentTemplateRoot as Grid; - var image = (Image)templateRoot.FindName("ItemImage"); - image.Opacity = 100; - - var item = args.Item as ImageFileInfo; - - try + // File could be corrupt, or it might have an image file + // extension, but not really be an image file. + BitmapImage bitmapImage = new() { - image.Source = await item.GetImageThumbnailAsync(); - } - catch (Exception) - { - // File could be corrupt, or it might have an image file - // extension, but not really be an image file. - BitmapImage bitmapImage = new BitmapImage(); - bitmapImage.UriSource = new Uri(image.BaseUri, "Assets/StoreLogo.png"); - image.Source = bitmapImage; - } + UriSource = new Uri(image.BaseUri, "Assets/StoreLogo.png"), + }; + image.Source = bitmapImage; } } } diff --git a/Samples/PhotoEditor/cs-winui/MainWindow.xaml b/Samples/PhotoEditor/cs-winui/MainWindow.xaml index 562002224..61f95822b 100644 --- a/Samples/PhotoEditor/cs-winui/MainWindow.xaml +++ b/Samples/PhotoEditor/cs-winui/MainWindow.xaml @@ -1,14 +1,32 @@ - - - - + + + + + + + + + + + + + + + + + + diff --git a/Samples/PhotoEditor/cs-winui/MainWindow.xaml.cs b/Samples/PhotoEditor/cs-winui/MainWindow.xaml.cs index e0181dab1..ab8a82f98 100644 --- a/Samples/PhotoEditor/cs-winui/MainWindow.xaml.cs +++ b/Samples/PhotoEditor/cs-winui/MainWindow.xaml.cs @@ -1,35 +1,30 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. 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; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -// To learn more about WinUI, the WinUI project structure, -// and more about our project templates, see: http://aka.ms/winui-project-info. +namespace PhotoEditor; -namespace PhotoEditor +/// +/// The application window. Hosts the photo collection and editor pages in a Frame, +/// with a Mica backdrop and a title bar that carries the app identity. +/// +public sealed partial class MainWindow : Window { + public MainWindow() + { + InitializeComponent(); + + ExtendsContentIntoTitleBar = true; + SetTitleBar(AppTitleBar); + } + /// - /// An empty window that can be used on its own or navigated to within a Frame. + /// Navigates the root frame to the collection page. Called from + /// after is assigned. /// - public sealed partial class MainWindow : Window + public void NavigateToMainPage() { - public MainWindow() - { - this.InitializeComponent(); - rootFrame.Navigate(typeof(MainPage)); - } + RootFrame.Navigate(typeof(MainPage)); } } diff --git a/Samples/PhotoEditor/cs-winui/Package.appxmanifest b/Samples/PhotoEditor/cs-winui/Package.appxmanifest index abddf45ae..666f19117 100644 --- a/Samples/PhotoEditor/cs-winui/Package.appxmanifest +++ b/Samples/PhotoEditor/cs-winui/Package.appxmanifest @@ -2,24 +2,28 @@ + xmlns:systemai="http://schemas.microsoft.com/appx/manifest/systemai/windows10" + IgnorableNamespaces="uap rescap systemai"> + + PhotoEditor - Microsoft Corporation + AppPublisher Assets\StoreLogo.png - - + + @@ -44,5 +48,6 @@ + diff --git a/Samples/PhotoEditor/cs-winui/PhotoEditor.csproj b/Samples/PhotoEditor/cs-winui/PhotoEditor.csproj index 5b3dfda4d..65a062374 100644 --- a/Samples/PhotoEditor/cs-winui/PhotoEditor.csproj +++ b/Samples/PhotoEditor/cs-winui/PhotoEditor.csproj @@ -1,15 +1,15 @@ WinExe - net6.0-windows10.0.19041.0 + net8.0-windows10.0.26100.0 10.0.17763.0 PhotoEditor app.manifest x86;x64;ARM64 - win10-x86;win10-x64;win10-arm64 - win10-$(Platform).pubxml + win-x86;win-x64;win-arm64 true true + enable @@ -18,21 +18,41 @@ + + + + - - - - - + + + + + + + + + + + + + + true + diff --git a/Samples/PhotoEditor/cs-winui/Properties/PublishProfiles/win10-arm64.pubxml b/Samples/PhotoEditor/cs-winui/Properties/PublishProfiles/win10-arm64.pubxml deleted file mode 100644 index a132e44c6..000000000 --- a/Samples/PhotoEditor/cs-winui/Properties/PublishProfiles/win10-arm64.pubxml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - FileSystem - arm64 - win10-arm64 - bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ - true - False - False - True - - - \ No newline at end of file diff --git a/Samples/PhotoEditor/cs-winui/Properties/PublishProfiles/win10-x64.pubxml b/Samples/PhotoEditor/cs-winui/Properties/PublishProfiles/win10-x64.pubxml deleted file mode 100644 index 26ea7e55c..000000000 --- a/Samples/PhotoEditor/cs-winui/Properties/PublishProfiles/win10-x64.pubxml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - FileSystem - x64 - win10-x64 - bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ - true - False - False - True - - - \ No newline at end of file diff --git a/Samples/PhotoEditor/cs-winui/Properties/PublishProfiles/win10-x86.pubxml b/Samples/PhotoEditor/cs-winui/Properties/PublishProfiles/win10-x86.pubxml deleted file mode 100644 index 34d14d4d4..000000000 --- a/Samples/PhotoEditor/cs-winui/Properties/PublishProfiles/win10-x86.pubxml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - FileSystem - x86 - win10-x86 - bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ - true - False - False - True - - - \ No newline at end of file diff --git a/Samples/PhotoEditor/cs-winui/app.manifest b/Samples/PhotoEditor/cs-winui/app.manifest index 901cbf251..971e8601f 100644 --- a/Samples/PhotoEditor/cs-winui/app.manifest +++ b/Samples/PhotoEditor/cs-winui/app.manifest @@ -4,12 +4,7 @@ - - true/PM - PerMonitorV2, PerMonitor + PerMonitorV2 - + \ No newline at end of file