Improve layout of shaders selection panel

このコミットが含まれているのは:
Sergio Pedri committed 2021-11-20 14:21:13 +01:00
1 親 679550a8d0
コミット 1d91cec27b
3ファイル変更
+31 -21

検索条件に一致するファイルはありません

+1 -1
ファイルの表示
@@ -176,7 +176,7 @@
<PackageReference Include="Microsoft.Toolkit.Mvvm">
<Version>7.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls.Core">
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls.Primitives">
<Version>7.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Media">
+22 -19
ファイルの表示
@@ -14,7 +14,8 @@
xmlns:models="using:ComputeSharp.SwapChain.Uwp.Models"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
d:DesignWidth="400"
SizeChanged="UserControl_SizeChanged">
<Grid x:Name="Root">
<Grid.DataContext>
@@ -46,6 +47,7 @@
<!--Shadow panel with the shaders list-->
<Border
x:Name="ShadersListContainerPanel"
Height="320"
Margin="-20,0,-20,0"
Background="#FF222222"
@@ -99,31 +101,32 @@
<!--Shader template-->
<DataTemplate x:DataType="models:ComputeShader">
<Grid
<controls:ConstrainedBox
AspectRatio="16:9"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ui:UIElementExtensions.ClipToBounds="True">
<Grid>
<!--Shader preview-->
<computesharp:ComputeShaderPanel ShaderRunner="{x:Bind ShaderRunner}"/>
<!--Shader preview-->
<computesharp:ComputeShaderPanel
Width="568"
ShaderRunner="{x:Bind ShaderRunner}"/>
<!--Note: here we have a selection property to work around {x:Bind} not working correctly outside of the
<!--Note: here we have a selection property to work around {x:Bind} not working correctly outside of the
current template scope. Once that's fixed in WinUI 3, this can be rewritten as a multi-binding like this:
Visibility="{x:Bind system:Object.ReferenceEquals((local:ComputeShader), ViewModel.SelectedComputeShader), Mode=OneWay}".
When that is working, the ComputeShader.IsSelected property can also be removed, as it will no longer be needed.-->
<Border
BorderThickness="4"
BorderBrush="White"
Visibility="{x:Bind IsSelected, Mode=OneWay}">
<Polygon
VerticalAlignment="Top"
HorizontalAlignment="Right"
Points="0,0 32,0 32,32"
Fill="White"/>
</Border>
</Grid>
<Border
BorderThickness="4"
BorderBrush="White"
Visibility="{x:Bind IsSelected, Mode=OneWay}">
<Polygon
VerticalAlignment="Top"
HorizontalAlignment="Right"
Points="0,0 32,0 32,32"
Fill="White"/>
</Border>
</Grid>
</controls:ConstrainedBox>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
+8 -1
ファイルの表示
@@ -1,4 +1,5 @@
using Windows.UI.Xaml;
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
@@ -23,4 +24,10 @@ public sealed partial class MainView : UserControl
{
Root.Children.Remove(ShaderSelectionPanel);
}
// Updates the size of the shaders list panel
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
{
ShadersListContainerPanel.Height = Math.Round(e.NewSize.Height * 0.35);
}
}