Skip to content

Commit 61b4128

Browse files
authored
Feature: Added horizontal layout to the preview pane (#12496)
1 parent 8fc9011 commit 61b4128

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

src/Files.App/UserControls/Pane/PreviewPane.xaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,16 @@
127127
<RowDefinition Height="2*" MinHeight="100" />
128128
<RowDefinition x:Name="PropertiesRow" Height="3*" />
129129
</Grid.RowDefinitions>
130+
<Grid.ColumnDefinitions>
131+
<ColumnDefinition Width="2*" MinWidth="100" />
132+
<ColumnDefinition x:Name="PropertiesColumn" Width="3*" />
133+
</Grid.ColumnDefinitions>
130134

131135
<!-- Panes -->
132136
<StackPanel
133137
Grid.Row="0"
138+
Grid.Column="0"
139+
Grid.ColumnSpan="2"
134140
Padding="12"
135141
HorizontalAlignment="Left"
136142
VerticalAlignment="Center"
@@ -147,6 +153,8 @@
147153
<Grid
148154
x:Name="RootPreviewGrid"
149155
Grid.Row="1"
156+
Grid.Column="0"
157+
Grid.ColumnSpan="2"
150158
Margin="8"
151159
HorizontalAlignment="Stretch"
152160
VerticalAlignment="Stretch"
@@ -186,6 +194,8 @@
186194
<ScrollViewer
187195
x:Name="RootPropertiesScrollViewer"
188196
Grid.Row="2"
197+
Grid.Column="0"
198+
Grid.ColumnSpan="2"
189199
AutomationProperties.Name="{helpers:ResourceString Name=PreviewPaneFileDetails/AutomationProperties/Name}"
190200
Visibility="Visible">
191201
<StackPanel Orientation="Vertical">
@@ -300,6 +310,11 @@
300310
<VisualState.StateTriggers>
301311
<triggers:IsEqualStateTrigger Value="{x:Bind PaneSettingsService.ShowPreviewOnly, Mode=OneWay}" To="False" />
302312
</VisualState.StateTriggers>
313+
<VisualState.Setters>
314+
<Setter Target="RootPropertiesScrollViewer.Visibility" Value="Visible" />
315+
<Setter Target="PropertiesRow.Height" Value="3*" />
316+
<Setter Target="PropertiesColumn.Width" Value="3*" />
317+
</VisualState.Setters>
303318
</VisualState>
304319
<VisualState>
305320
<VisualState.StateTriggers>
@@ -308,6 +323,31 @@
308323
<VisualState.Setters>
309324
<Setter Target="RootPropertiesScrollViewer.Visibility" Value="Collapsed" />
310325
<Setter Target="PropertiesRow.Height" Value="0" />
326+
<Setter Target="PropertiesColumn.Width" Value="0" />
327+
</VisualState.Setters>
328+
</VisualState>
329+
</VisualStateGroup>
330+
331+
<!-- Orientations -->
332+
<VisualStateGroup x:Name="Orientation">
333+
<VisualState x:Name="Vertical">
334+
<VisualState.Setters>
335+
<Setter Target="RootPreviewGrid.(Grid.Column)" Value="0" />
336+
<Setter Target="RootPropertiesScrollViewer.Column" Value="0" />
337+
<Setter Target="RootPropertiesScrollViewer.(Grid.RowSpan)" Value="1" />
338+
<Setter Target="RootPropertiesScrollViewer.(Grid.ColumnSpan)" Value="2" />
339+
<Setter Target="RootPreviewGrid.(Grid.ColumnSpan)" Value="2" />
340+
<Setter Target="RootPreviewGrid.(Grid.RowSpan)" Value="1" />
341+
</VisualState.Setters>
342+
</VisualState>
343+
<VisualState x:Name="Horizontal">
344+
<VisualState.Setters>
345+
<Setter Target="RootPropertiesScrollViewer.(Grid.Column)" Value="1" />
346+
<Setter Target="RootPropertiesScrollViewer.(Grid.RowSpan)" Value="2" />
347+
<Setter Target="RootPropertiesScrollViewer.(Grid.ColumnSpan)" Value="1" />
348+
<Setter Target="RootPreviewGrid.(Grid.ColumnSpan)" Value="1" />
349+
<Setter Target="RootPreviewGrid.(Grid.RowSpan)" Value="2" />
350+
<Setter Target="RootPropertiesScrollViewer.(Grid.Row)" Value="1" />
311351
</VisualState.Setters>
312352
</VisualState>
313353
</VisualStateGroup>

src/Files.App/UserControls/Pane/PreviewPane.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ public void UpdatePosition(double panelWidth, double panelHeight)
4242
{
4343
Position = PreviewPanePositions.Right;
4444
(MinWidth, MinHeight) = (150, 0);
45+
VisualStateManager.GoToState(this, "Vertical", true);
4546
}
4647
else
4748
{
4849
Position = PreviewPanePositions.Bottom;
4950
(MinWidth, MinHeight) = (0, 140);
51+
VisualStateManager.GoToState(this, "Horizontal", true);
5052
}
5153
}
5254

0 commit comments

Comments
 (0)