Skip to content

Commit 50fa78d

Browse files
committed
Merge branch 'develop' of https://github.com/duke7553/files-uwp into develop
2 parents 565baf9 + f8fb70d commit 50fa78d

File tree

12 files changed

+205
-264
lines changed

12 files changed

+205
-264
lines changed

Files/Files.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@
149149
<Compile Include="Dialogs\ConfirmDeleteDialog.xaml.cs">
150150
<DependentUpon>ConfirmDeleteDialog.xaml</DependentUpon>
151151
</Compile>
152+
<Compile Include="Helpers\ItemsDataTemplateSelector.cs" />
152153
<Compile Include="UserControls\NavigationToolbar\INavigationToolbar.cs" />
153154
<Compile Include="UserControls\NavigationToolbar\ModernNavigationToolbar.xaml.cs">
154155
<DependentUpon>ModernNavigationToolbar.xaml</DependentUpon>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using Windows.UI.Xaml;
8+
using Windows.UI.Xaml.Controls;
9+
10+
namespace Files.Helpers
11+
{
12+
public class ItemsDataTemplateSelector : DataTemplateSelector
13+
{
14+
public DataTemplate ParentItems { get; set; }
15+
public DataTemplate CurrentItem { get; set; }
16+
17+
protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
18+
{
19+
DataTemplate _returnTemplate = new DataTemplate();
20+
var itemsControl = ItemsControl.ItemsControlFromItemContainer(container);
21+
_returnTemplate = (itemsControl.IndexFromContainer(container) == (itemsControl.ItemsSource as ObservableCollection<Files.PathBoxItem>).Count - 1) ? CurrentItem : ParentItems;
22+
return _returnTemplate;
23+
}
24+
}
25+
}

Files/UserControls/ModernSidebar.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public ModernSidebar()
1717
this.InitializeComponent();
1818

1919
// Check if the acrylic sidebar setting is on
20-
if (App.AppSettings.SidebarThemeMode == Enums.SidebarOpacity.AcrylicEnabled)
20+
if (App.AppSettings.AcrylicSidebar == true)
2121
{
2222
this.Background = (Brush)Application.Current.Resources["BackgroundAcrylicBrush"];
2323
SidebarNavView.Resources["NavigationViewExpandedPaneBackground"] = Application.Current.Resources["BackgroundAcrylicBrush"];

Files/UserControls/NavigationToolbar/ModernNavigationToolbar.xaml

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
77
xmlns:local="using:Files.UserControls"
88
xmlns:local1="using:Files"
9-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:helpers="using:Files.Helpers"
1010
d:DesignHeight="80"
1111
d:DesignWidth="800"
1212
mc:Ignorable="d">
@@ -482,6 +482,37 @@
482482
</Setter>
483483
</Style>
484484

485+
<DataTemplate x:Name="ParentItems">
486+
<Grid
487+
x:Name="ListViewItemContentGrid"
488+
Background="Transparent"
489+
Tag="{Binding Path}">
490+
<StackPanel Orientation="Horizontal" Spacing="5">
491+
<TextBlock
492+
Margin="0,0,0,4"
493+
FontSize="18"
494+
FontWeight="Normal"
495+
Text="{Binding Title}" />
496+
<FontIcon FontSize="10" Glyph="&#xE76C;" />
497+
</StackPanel>
498+
</Grid>
499+
</DataTemplate>
500+
501+
<DataTemplate x:Name="CurrentItem">
502+
<Grid
503+
x:Name="ListViewItemContentGrid"
504+
Background="Transparent"
505+
Tag="{Binding Path}">
506+
<StackPanel Orientation="Horizontal" Spacing="5">
507+
<TextBlock
508+
Margin="0,0,0,4"
509+
FontSize="18"
510+
FontWeight="Medium"
511+
Text="{Binding Title}" />
512+
<FontIcon FontSize="10" Glyph="&#xE76C;" />
513+
</StackPanel>
514+
</Grid>
515+
</DataTemplate>
485516
</UserControl.Resources>
486517
<Grid
487518
x:Name="ToolbarGrid"
@@ -577,7 +608,7 @@
577608

578609
<Grid
579610
Grid.Row="0"
580-
Height="35"
611+
Height="34"
581612
Margin="4,4"
582613
VerticalAlignment="Center">
583614

@@ -592,7 +623,7 @@
592623
BorderThickness="0"
593624
FocusDisengaged="VisiblePath_LostFocus"
594625
FontFamily="Segoe UI"
595-
FontSize="20"
626+
FontSize="18"
596627
FontWeight="SemiBold"
597628
KeyDown="VisiblePath_TextChanged"
598629
LostFocus="VisiblePath_LostFocus"
@@ -629,28 +660,14 @@
629660
ScrollViewer.VerticalScrollMode="Disabled"
630661
SelectionMode="None"
631662
Style="{StaticResource ListViewStyleNoAnimation}">
632-
<ListView.ItemTemplate>
633-
<DataTemplate>
634-
<Grid
635-
x:Name="ListViewItemContentGrid"
636-
Background="Transparent"
637-
Tag="{Binding Path}">
638-
<StackPanel Orientation="Horizontal" Spacing="5">
639-
<TextBlock
640-
Margin="0,0,0,4"
641-
FontSize="20"
642-
FontWeight="Medium"
643-
Text="{Binding Title}" />
644-
<FontIcon FontSize="10" Glyph="&#xE76C;" />
645-
</StackPanel>
646-
</Grid>
647-
</DataTemplate>
648-
</ListView.ItemTemplate>
649663
<ListView.ItemsPanel>
650664
<ItemsPanelTemplate>
651665
<StackPanel Background="Transparent" Orientation="Horizontal" />
652666
</ItemsPanelTemplate>
653667
</ListView.ItemsPanel>
668+
<ListView.ItemTemplateSelector>
669+
<helpers:ItemsDataTemplateSelector CurrentItem="{StaticResource CurrentItem}" ParentItems="{StaticResource ParentItems}" />
670+
</ListView.ItemTemplateSelector>
654671
</ListView>
655672
</Grid>
656673
</Grid>

Files/UserControls/Sidebar.xaml.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,6 @@ public Sidebar()
2727
{
2828
this.InitializeComponent();
2929

30-
// Check if the acrylic sidebar setting is on
31-
if (App.AppSettings.SidebarThemeMode == Enums.SidebarOpacity.AcrylicEnabled)
32-
{
33-
this.Background = (Brush)Application.Current.Resources["BackgroundAcrylicBrush"];
34-
SidebarNavView.Resources["NavigationViewExpandedPaneBackground"] = Application.Current.Resources["BackgroundAcrylicBrush"];
35-
}
36-
else
37-
{
38-
this.Background = (Brush)Application.Current.Resources["SystemControlBackgroundChromeMediumLowBrush"];
39-
SidebarNavView.Resources["NavigationViewExpandedPaneBackground"] = (Brush)Application.Current.Resources["SystemControlBackgroundChromeMediumLowBrush"];
40-
}
4130
}
4231

4332
private INavigationControlItem _SelectedSidebarItem;

0 commit comments

Comments
 (0)