Skip to content

Commit 043b58b

Browse files
committed
Improvements to PathBox Usage Experience
1 parent 4e10ac7 commit 043b58b

File tree

3 files changed

+81
-3
lines changed

3 files changed

+81
-3
lines changed

Files UWP/GenericFileBrowser.xaml.cs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,34 +109,113 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
109109
if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)))
110110
{
111111
P.path = "Desktop";
112+
foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
113+
{
114+
if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "DesktopIC")
115+
{
116+
MainPage.Select.itemSelected = NavItemChoice;
117+
break;
118+
}
119+
}
112120
}
113121
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)))
114122
{
115123
P.path = "Documents";
124+
foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
125+
{
126+
if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "DocumentsIC")
127+
{
128+
MainPage.Select.itemSelected = NavItemChoice;
129+
break;
130+
}
131+
}
116132
}
117133
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\Downloads"))
118134
{
119135
P.path = "Downloads";
136+
foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
137+
{
138+
if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "DownloadsIC")
139+
{
140+
MainPage.Select.itemSelected = NavItemChoice;
141+
break;
142+
}
143+
}
120144
}
121145
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)))
122146
{
123147
P.path = "Pictures";
148+
foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
149+
{
150+
if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "PicturesIC")
151+
{
152+
MainPage.Select.itemSelected = NavItemChoice;
153+
break;
154+
}
155+
}
124156
}
125157
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyMusic)))
126158
{
127159
P.path = "Music";
160+
foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
161+
{
162+
if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "MusicIC")
163+
{
164+
MainPage.Select.itemSelected = NavItemChoice;
165+
break;
166+
}
167+
}
128168
}
129169
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\OneDrive"))
130170
{
131171
P.path = "OneDrive";
172+
foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
173+
{
174+
if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "OneD_IC")
175+
{
176+
MainPage.Select.itemSelected = NavItemChoice;
177+
break;
178+
}
179+
}
132180
}
133181
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos)))
134182
{
135183
P.path = "Videos";
184+
foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
185+
{
186+
if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "VideosIC")
187+
{
188+
MainPage.Select.itemSelected = NavItemChoice;
189+
break;
190+
}
191+
}
136192
}
137193
else
138194
{
139195
P.path = parameters;
196+
if(parameters.Contains("C:\\") || parameters.Contains("c:\\"))
197+
{
198+
foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
199+
{
200+
if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Tag.ToString() == "LDPage")
201+
{
202+
MainPage.Select.itemSelected = NavItemChoice;
203+
break;
204+
}
205+
}
206+
}
207+
else
208+
{
209+
foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
210+
{
211+
Debug.WriteLine(parameters.Split("\\")[0]);
212+
if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Tag.ToString().Contains(parameters.Split("\\")[0]))
213+
{
214+
MainPage.Select.itemSelected = NavItemChoice;
215+
break;
216+
}
217+
}
218+
}
140219
}
141220

142221
}

Files UWP/MainPage.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
x:Class="Files.MainPage"
77
xmlns:local="using:Files"
88
xmlns:UILib="using:Microsoft.UI.Xaml.Controls"
9-
xmlns:Windows10InsiderPreview="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
109
mc:Ignorable="d">
1110

1211
<Page.Resources>

Files UWP/MainPage.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public async void PopulateNavViewWithExternalDrives()
117117
}
118118
});
119119
}
120-
120+
121121
private static SelectItem select = new SelectItem();
122122
public static SelectItem Select { get { return MainPage.select; } }
123123

@@ -271,7 +271,7 @@ public Microsoft.UI.Xaml.Controls.NavigationViewItemBase itemSelected
271271
{
272272
_itemSelected = value;
273273
NotifyPropertyChanged("itemSelected");
274-
Debug.WriteLine("NotifyPropertyChanged was called successfully for NavView Selection");
274+
//Debug.WriteLine("NotifyPropertyChanged was called successfully for NavView Selection");
275275
}
276276
}
277277
}

0 commit comments

Comments
 (0)