Skip to content

Commit be0ab46

Browse files
marcelwgnyaira2
andauthored
Fix: Fixed issue of overlapping brushes leaving gap in the Columns View (#15096)
Co-authored-by: Yair <39923744+yaira2@users.noreply.github.com>
1 parent 58552ac commit be0ab46

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

src/Files.App/Helpers/Layout/LayoutSizeKindHelper.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,17 @@ public static int GetColumnsViewRowHeight(ColumnsViewSizeKind columnsViewSizeKin
103103
switch (columnsViewSizeKind)
104104
{
105105
case ColumnsViewSizeKind.Compact:
106-
return 28;
106+
return 24;
107107
case ColumnsViewSizeKind.Small:
108-
return 36;
108+
return 32;
109109
case ColumnsViewSizeKind.Medium:
110-
return 40;
110+
return 36;
111111
case ColumnsViewSizeKind.Large:
112-
return 44;
112+
return 40;
113113
case ColumnsViewSizeKind.ExtraLarge:
114-
return 48;
114+
return 44;
115115
default:
116-
return 36;
116+
return 32;
117117
}
118118
}
119119

src/Files.App/Views/Layouts/ColumnLayoutPage.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
<Grid
207207
x:Name="FilesRootGrid"
208208
Height="{Binding RowHeight, ElementName=PageRoot, Mode=OneWay}"
209+
Margin="0,2,0,2"
209210
Padding="12,0,12,0"
210211
HorizontalAlignment="Stretch"
211212
VerticalAlignment="Center"

src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ internal void ClearOpenedFolderSelectionIndicator()
9292
return;
9393

9494
openedFolderPresenter.Background = new SolidColorBrush(Microsoft.UI.Colors.Transparent);
95-
var presenter = openedFolderPresenter.FindDescendant<Grid>()!;
96-
presenter!.Background = new SolidColorBrush(Microsoft.UI.Colors.Transparent);
95+
SetFolderBackground(openedFolderPresenter, new SolidColorBrush(Microsoft.UI.Colors.Transparent));
9796
openedFolderPresenter = null;
9897
}
9998

@@ -157,8 +156,8 @@ private void HighlightPathDirectory(ListViewBase sender, ContainerContentChangin
157156
if (args.Item is ListedItem item && columnsOwner?.OwnerPath is string ownerPath
158157
&& (ownerPath == item.ItemPath || ownerPath.StartsWith(item.ItemPath) && ownerPath[item.ItemPath.Length] is '/' or '\\'))
159158
{
160-
var presenter = args.ItemContainer.FindDescendant<Grid>()!;
161-
presenter!.Background = this.Resources["ListViewItemBackgroundSelected"] as SolidColorBrush;
159+
SetFolderBackground(args.ItemContainer as ListViewItem, this.Resources["ListViewItemBackgroundSelected"] as SolidColorBrush);
160+
162161
openedFolderPresenter = FileList.ContainerFromItem(item) as ListViewItem;
163162
FileList.ContainerContentChanging -= HighlightPathDirectory;
164163
}
@@ -279,8 +278,7 @@ protected override void FileList_SelectionChanged(object sender, SelectionChange
279278

280279
if (e.RemovedItems.Count > 0 && openedFolderPresenter != null)
281280
{
282-
var presenter = openedFolderPresenter.FindDescendant<Grid>()!;
283-
presenter!.Background = this.Resources["ListViewItemBackgroundSelected"] as SolidColorBrush;
281+
SetFolderBackground(openedFolderPresenter, this.Resources["ListViewItemBackgroundSelected"] as SolidColorBrush);
284282
}
285283

286284
if (SelectedItems?.Count == 1 && SelectedItem?.PrimaryItemAttribute is StorageItemTypes.Folder)
@@ -592,5 +590,16 @@ internal void ClearSelectionIndicator()
592590
FileList.SelectedItem = null;
593591
LockPreviewPaneContent = false;
594592
}
593+
594+
private static void SetFolderBackground(ListViewItem? lvi, SolidColorBrush? backgroundColor)
595+
{
596+
if (lvi == null || backgroundColor == null) return;
597+
598+
599+
if (lvi.FindDescendant<Grid>() is Grid presenter)
600+
{
601+
presenter.Background = backgroundColor;
602+
}
603+
}
595604
}
596605
}

0 commit comments

Comments
 (0)