From e608db8a7f727abda72bde9c538d12b3b4319f55 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 21 Nov 2021 19:30:22 +0100 Subject: [PATCH] Apply XAML styler refactor pass to UWP/WinUI 3 samples --- samples/ComputeSharp.SwapChain.Uwp/App.xaml | 4 +- .../Views/MainView.xaml | 190 ++++++++-------- .../Views/MainWindow.xaml | 203 ++++++++++-------- 3 files changed, 212 insertions(+), 185 deletions(-) diff --git a/samples/ComputeSharp.SwapChain.Uwp/App.xaml b/samples/ComputeSharp.SwapChain.Uwp/App.xaml index e516409e..c01ce6cb 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/App.xaml +++ b/samples/ComputeSharp.SwapChain.Uwp/App.xaml @@ -1,6 +1,4 @@  - - + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" /> diff --git a/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml b/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml index 495f471a..fe94efd1 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml +++ b/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml @@ -2,128 +2,146 @@ x:Class="ComputeSharp.SwapChain.Uwp.Views.MainView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations" + xmlns:computesharp="using:ComputeSharp.Uwp" + xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" + xmlns:converters="using:ComputeSharp.SwapChain.Core.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" - xmlns:ui="using:Microsoft.Toolkit.Uwp.UI" - xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations" xmlns:media="using:Microsoft.Toolkit.Uwp.UI.Media" - xmlns:computesharp="using:ComputeSharp.Uwp" - xmlns:converters="using:ComputeSharp.SwapChain.Core.Converters" - xmlns:viewmodels="using:ComputeSharp.SwapChain.Core.ViewModels" xmlns:models="using:ComputeSharp.SwapChain.Core.Models" - mc:Ignorable="d" + xmlns:ui="using:Microsoft.Toolkit.Uwp.UI" + xmlns:viewmodels="using:ComputeSharp.SwapChain.Core.ViewModels" d:DesignHeight="300" d:DesignWidth="400" - SizeChanged="UserControl_SizeChanged"> + SizeChanged="UserControl_SizeChanged" + mc:Ignorable="d"> - + - + change and stop their render loops. This avoids wasting GPU resources when the panel isn't visible. + --> - + - + + TextureUri="ms-appx:///Assets/Misc/noise_low.png" + TintColor="#FF222222" + TintOpacity="0.2" /> - + + VerticalAlignment="Bottom" + Background="#FF222222"> - + - + + Color="Black" /> - + + SelectedItem="{x:Bind ViewModel.SelectedComputeShader, Mode=TwoWay}" + SelectionMode="Single"> - - - - + + + + - + - + + ui:UIElementExtensions.ClipToBounds="True" + AspectRatio="16:9"> - - - - + + + + + VerticalAlignment="Top" + Fill="White" + Points="0,0 32,0 32,32" /> @@ -134,84 +152,82 @@ - + + ShaderRunner="{x:Bind ViewModel.SelectedComputeShader.ShaderRunner, Mode=OneWay}" /> - + + VerticalAlignment="Bottom" + Orientation="Horizontal" + Spacing="20"> - + - + - + - + + HorizontalAlignment="Stretch" + VerticalAlignment="Top" + Fill="Transparent" /> diff --git a/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml b/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml index 2fca877f..3a80242f 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml +++ b/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml @@ -2,129 +2,144 @@ x:Class="ComputeSharp.SwapChain.WinUI.Views.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:animations="using:CommunityToolkit.WinUI.UI.Animations" + xmlns:computesharp="using:ComputeSharp.WinUI" + xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls" + xmlns:converters="using:ComputeSharp.SwapChain.Core.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls" - xmlns:ui="using:CommunityToolkit.WinUI.UI" - xmlns:animations="using:CommunityToolkit.WinUI.UI.Animations" xmlns:media="using:CommunityToolkit.WinUI.UI.Media" - xmlns:computesharp="using:ComputeSharp.WinUI" - xmlns:converters="using:ComputeSharp.SwapChain.Core.Converters" - xmlns:viewmodels="using:ComputeSharp.SwapChain.Core.ViewModels" xmlns:models="using:ComputeSharp.SwapChain.Core.Models" - mc:Ignorable="d" - SizeChanged="UserControl_SizeChanged"> + xmlns:ui="using:CommunityToolkit.WinUI.UI" + xmlns:viewmodels="using:ComputeSharp.SwapChain.Core.ViewModels" + SizeChanged="UserControl_SizeChanged" + mc:Ignorable="d"> - - - + - + change and stop their render loops. This avoids wasting GPU resources when the panel isn't visible. + --> - + - + + TextureUri="ms-appx:///Assets/Misc/noise_low.png" + TintColor="#FF222222" + TintOpacity="0.2" /> - + + VerticalAlignment="Bottom" + Background="#FF222222"> - + - + + Color="Black" /> - + + SelectedItem="{x:Bind ViewModel.SelectedComputeShader, Mode=TwoWay}" + SelectionMode="Single"> - - - - + + + + - + - + + ui:UIElementExtensions.ClipToBounds="True" + AspectRatio="16:9"> - - + + - + When that is working, the ComputeShader.IsSelected property can also be removed, as it will no longer be needed. + --> + VerticalAlignment="Top" + Fill="White" + Points="0,0 32,0 32,32" /> @@ -135,96 +150,94 @@ - + + ShaderRunner="{x:Bind ViewModel.SelectedComputeShader.ShaderRunner, Mode=OneWay}" /> - + + VerticalAlignment="Bottom" + Orientation="Horizontal" + Spacing="20"> - + - + - + - - + + - + + HorizontalAlignment="Stretch" + VerticalAlignment="Top" + Fill="Transparent" />