Skip to content

Commit f06a1f9

Browse files
committed
Start work on clickable path bar
1 parent 5aebbc7 commit f06a1f9

File tree

4 files changed

+418
-6
lines changed

4 files changed

+418
-6
lines changed

Files UWP/FilesUWP.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
<Version>5.1.0</Version>
293293
</PackageReference>
294294
<PackageReference Include="Microsoft.UI.Xaml">
295-
<Version>2.1.190606001</Version>
295+
<Version>2.2.190702001-prerelease</Version>
296296
</PackageReference>
297297
</ItemGroup>
298298
<ItemGroup>

Files UWP/Filesystem/ItemViewModel.cs

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Windows.Storage.Search;
1919
using Windows.UI.Core;
2020
using Windows.UI.Popups;
21+
using Windows.UI.Text;
2122
using Windows.UI.Xaml;
2223
using Windows.UI.Xaml.Controls;
2324
using Windows.UI.Xaml.Media.Animation;
@@ -84,6 +85,78 @@ public ItemViewModel()
8485
tabInstance.ShareItems.PropertyChanged += ShareItems_PropertyChanged;
8586
tabInstance.LayoutItems.PropertyChanged += LayoutItems_PropertyChanged;
8687
tabInstance.AlwaysPresentCommands.PropertyChanged += AlwaysPresentCommands_PropertyChanged;
88+
89+
Universal.PropertyChanged += Universal_PropertyChanged;
90+
}
91+
92+
/*
93+
* Ensure that the path bar gets updated for user interaction
94+
* whenever the path changes. We will get the individual directories from
95+
* the updated, most-current path and add them to the UI.
96+
*/
97+
98+
private void Universal_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
99+
{
100+
// Clear the path UI
101+
GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Clear();
102+
Style tabStyleFixed = GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Resources["PathSectionTabStyle"] as Style;
103+
FontWeight weight = new FontWeight()
104+
{
105+
Weight = FontWeights.SemiBold.Weight
106+
};
107+
List<string> pathComponents = new List<string>();
108+
if (e.PropertyName == "path")
109+
{
110+
// If path is a library, simplify it
111+
112+
// If path is found to not be a library
113+
pathComponents = Universal.path.Split("\\", StringSplitOptions.RemoveEmptyEntries).ToList();
114+
int index = 0;
115+
foreach(string s in pathComponents)
116+
{
117+
string componentLabel = null;
118+
string tag = "";
119+
if (s.Contains(":"))
120+
{
121+
if (s == @"C:" || s == @"c:")
122+
{
123+
componentLabel = @"Local Disk (C:\)";
124+
}
125+
else
126+
{
127+
componentLabel = @"Drive (" + s + @"\)";
128+
}
129+
tag = s + @"\";
130+
131+
GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Add(new Microsoft.UI.Xaml.Controls.TabViewItem()
132+
{
133+
Header = componentLabel + " >",
134+
Tag = tag,
135+
CornerRadius = new CornerRadius(0),
136+
Style = tabStyleFixed,
137+
FontWeight = weight
138+
});
139+
}
140+
else
141+
{
142+
componentLabel = s;
143+
foreach (string part in pathComponents.GetRange(0, index + 1))
144+
{
145+
tag = tag + part + @"\";
146+
}
147+
148+
GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Add(new Microsoft.UI.Xaml.Controls.TabViewItem()
149+
{
150+
Header = componentLabel + " >",
151+
Tag = tag,
152+
CornerRadius = new CornerRadius(0),
153+
Style = tabStyleFixed,
154+
FontWeight = weight
155+
});
156+
}
157+
index++;
158+
}
159+
}
87160
}
88161

89162
private void AlwaysPresentCommands_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)

0 commit comments

Comments
 (0)