Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Switched to StackPanel in the Details Layout template #10936

Merged
merged 3 commits into from
Jan 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -532,26 +532,14 @@
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate x:DataType="local2:ListedItem">
<Grid
<StackPanel
HorizontalAlignment="Stretch"
AutomationProperties.Name="{x:Bind Name, Mode=OneWay}"
IsRightTapEnabled="True"
Loaded="Grid_Loaded"
Loaded="StackPanel_Loaded"
Orientation="Horizontal"
ToolTipService.ToolTip="{x:Bind ItemTooltipText, Mode=OneWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding ColumnsViewModel.IconColumn.LengthIncludingGridSplitter, ElementName=PageRoot, Mode=OneWay}" />
<ColumnDefinition Width="{Binding ColumnsViewModel.NameColumn.LengthIncludingGridSplitter, ElementName=PageRoot, Mode=OneWay}" />
<ColumnDefinition Width="{Binding ColumnsViewModel.TagColumn.LengthIncludingGridSplitter, ElementName=PageRoot, Mode=OneWay}" />
<ColumnDefinition Width="{Binding ColumnsViewModel.OriginalPathColumn.LengthIncludingGridSplitter, ElementName=PageRoot, Mode=OneWay}" />
<ColumnDefinition Width="{Binding ColumnsViewModel.DateDeletedColumn.LengthIncludingGridSplitter, ElementName=PageRoot, Mode=OneWay}" />
<ColumnDefinition Width="{Binding ColumnsViewModel.DateModifiedColumn.LengthIncludingGridSplitter, ElementName=PageRoot, Mode=OneWay}" />
<ColumnDefinition Width="{Binding ColumnsViewModel.DateCreatedColumn.LengthIncludingGridSplitter, ElementName=PageRoot, Mode=OneWay}" />
<ColumnDefinition Width="{Binding ColumnsViewModel.ItemTypeColumn.LengthIncludingGridSplitter, ElementName=PageRoot, Mode=OneWay}" />
<ColumnDefinition Width="{Binding ColumnsViewModel.SizeColumn.LengthIncludingGridSplitter, ElementName=PageRoot, Mode=OneWay}" />
<ColumnDefinition Width="{Binding ColumnsViewModel.StatusColumn.LengthIncludingGridSplitter, ElementName=PageRoot, Mode=OneWay}" />
</Grid.ColumnDefinitions>
<Grid
Grid.Column="0"
Width="24"
Height="Auto"
HorizontalAlignment="Center"
Expand Down Expand Up @@ -619,8 +607,7 @@
</Grid>

<Grid
Grid.Column="1"
MinWidth="{Binding ColumnsViewModel.NameColumn.LengthIncludingGridSplitter.Value, ElementName=PageRoot, Mode=OneWay}"
Width="{Binding ColumnsViewModel.NameColumn.LengthIncludingGridSplitter.Value, ElementName=PageRoot, Mode=OneWay}"
Padding="12,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Expand Down Expand Up @@ -649,7 +636,6 @@

<Grid
x:Name="ItemTagGrid"
Grid.Column="2"
Width="{Binding ColumnsViewModel.TagColumn.Length.Value, ElementName=PageRoot, Mode=OneWay}"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Expand All @@ -676,7 +662,6 @@

<TextBlock
x:Name="ItemOriginalPathGrid"
Grid.Column="3"
Width="{Binding ColumnsViewModel.OriginalPathColumn.LengthIncludingGridSplitter.Value, ElementName=PageRoot, Mode=OneWay}"
Padding="12,0,0,0"
HorizontalAlignment="Stretch"
Expand All @@ -687,7 +672,6 @@

<TextBlock
x:Name="ItemDateDeletedGrid"
Grid.Column="4"
Width="{Binding ColumnsViewModel.DateDeletedColumn.LengthIncludingGridSplitter.Value, ElementName=PageRoot, Mode=OneWay}"
Padding="12,0,0,0"
HorizontalAlignment="Stretch"
Expand All @@ -698,7 +682,6 @@

<TextBlock
x:Name="ItemDateModifiedGrid"
Grid.Column="5"
Width="{Binding ColumnsViewModel.DateModifiedColumn.LengthIncludingGridSplitter.Value, ElementName=PageRoot, Mode=OneWay}"
Padding="12,0,0,0"
HorizontalAlignment="Stretch"
Expand All @@ -709,7 +692,6 @@

<TextBlock
x:Name="ItemDateCreatedGrid"
Grid.Column="6"
Width="{Binding ColumnsViewModel.DateCreatedColumn.LengthIncludingGridSplitter.Value, ElementName=PageRoot, Mode=OneWay}"
Padding="12,0,0,0"
HorizontalAlignment="Stretch"
Expand All @@ -720,7 +702,6 @@

<TextBlock
x:Name="ItemTypeGrid"
Grid.Column="7"
Width="{Binding ColumnsViewModel.ItemTypeColumn.LengthIncludingGridSplitter.Value, ElementName=PageRoot, Mode=OneWay}"
Padding="12,0,0,0"
HorizontalAlignment="Stretch"
Expand All @@ -731,7 +712,6 @@

<TextBlock
x:Name="ItemSizeGrid"
Grid.Column="8"
Width="{Binding ColumnsViewModel.SizeColumn.LengthIncludingGridSplitter.Value, ElementName=PageRoot, Mode=OneWay}"
Padding="12,0,0,0"
HorizontalAlignment="Stretch"
Expand All @@ -742,7 +722,6 @@

<FontIcon
x:Name="ItemStatusGrid"
Grid.Column="9"
Width="{Binding ColumnsViewModel.StatusColumn.LengthIncludingGridSplitter.Value, ElementName=PageRoot, Mode=OneWay}"
Margin="12,0,0,0"
HorizontalAlignment="Stretch"
Expand All @@ -751,7 +730,7 @@
FontSize="12"
Glyph="{x:Bind SyncStatusUI.Glyph, Mode=OneWay}"
Visibility="{Binding ColumnsViewModel.StatusColumn.Visibility, ElementName=PageRoot, Mode=OneWay}" />
</Grid>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
<i:Interaction.Behaviors>
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,11 @@ public override void Dispose()

#endregion IDisposable

private void Grid_Loaded(object sender, RoutedEventArgs e)
private void StackPanel_Loaded(object sender, RoutedEventArgs e)
{
// This is the best way I could find to set the context flyout, as doing it in the styles isn't possible
// because you can't use bindings in the setters
DependencyObject item = VisualTreeHelper.GetParent(sender as Grid);
DependencyObject item = VisualTreeHelper.GetParent(sender as StackPanel);
yaira2 marked this conversation as resolved.
Show resolved Hide resolved
while (item is not ListViewItem)
item = VisualTreeHelper.GetParent(item);
if (item is ListViewItem itemContainer)
Expand Down