|
4 | 4 | using System;
|
5 | 5 | using System.Collections.Generic;
|
6 | 6 | using System.Collections.ObjectModel;
|
| 7 | +using System.ComponentModel; |
7 | 8 | using System.IO;
|
8 | 9 | using System.Linq;
|
| 10 | +using System.Runtime.CompilerServices; |
9 | 11 | using System.Runtime.InteropServices.WindowsRuntime;
|
10 | 12 | using Windows.Foundation;
|
11 | 13 | using Windows.Foundation.Collections;
|
|
24 | 26 |
|
25 | 27 | namespace Files.UserControls
|
26 | 28 | {
|
27 |
| - public sealed partial class NavigationToolbar : UserControl, INavigationToolbar |
| 29 | + public sealed partial class NavigationToolbar : UserControl, INavigationToolbar, INotifyPropertyChanged |
28 | 30 | {
|
29 |
| - private bool ManualEntryBoxLoaded { get; set; } = false; |
30 |
| - private bool ClickablePathLoaded { get; set; } = true; |
| 31 | + private bool manualEntryBoxLoaded = false; |
| 32 | + private bool ManualEntryBoxLoaded |
| 33 | + { |
| 34 | + get |
| 35 | + { |
| 36 | + return manualEntryBoxLoaded; |
| 37 | + } |
| 38 | + set |
| 39 | + { |
| 40 | + if(value != manualEntryBoxLoaded) |
| 41 | + { |
| 42 | + manualEntryBoxLoaded = value; |
| 43 | + NotifyPropertyChanged("ManualEntryBoxLoaded"); |
| 44 | + } |
| 45 | + } |
| 46 | + } |
| 47 | + |
| 48 | + private bool clickablePathLoaded = true; |
| 49 | + private bool ClickablePathLoaded |
| 50 | + { |
| 51 | + get |
| 52 | + { |
| 53 | + return clickablePathLoaded; |
| 54 | + } |
| 55 | + set |
| 56 | + { |
| 57 | + if(value != clickablePathLoaded) |
| 58 | + { |
| 59 | + clickablePathLoaded = value; |
| 60 | + NotifyPropertyChanged("ClickablePathLoaded"); |
| 61 | + } |
| 62 | + } |
| 63 | + } |
| 64 | + |
31 | 65 | private bool SearchBoxLoaded { get; set; }
|
32 | 66 | private string PathText { get; set; }
|
33 | 67 |
|
@@ -72,7 +106,7 @@ bool INavigationToolbar.IsEditModeEnabled
|
72 | 106 | {
|
73 | 107 | get
|
74 | 108 | {
|
75 |
| - return VisiblePath.IsLoaded; |
| 109 | + return ManualEntryBoxLoaded; |
76 | 110 | }
|
77 | 111 | set
|
78 | 112 | {
|
@@ -142,15 +176,22 @@ string INavigationToolbar.PathControlDisplayText
|
142 | 176 | set
|
143 | 177 | {
|
144 | 178 | PathText = value;
|
| 179 | + NotifyPropertyChanged("PathText"); |
145 | 180 | }
|
146 | 181 | }
|
147 | 182 | private ObservableCollection<PathBoxItem> pathComponents = new ObservableCollection<PathBoxItem>();
|
| 183 | + |
| 184 | + public event PropertyChangedEventHandler PropertyChanged; |
| 185 | + private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") |
| 186 | + { |
| 187 | + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
| 188 | + } |
| 189 | + |
148 | 190 | ObservableCollection<PathBoxItem> INavigationToolbar.PathComponents => pathComponents;
|
149 | 191 |
|
150 | 192 | private void ManualPathEntryItem_Click(object sender, RoutedEventArgs e)
|
151 | 193 | {
|
152 |
| - VisiblePath.Visibility = Visibility.Visible; |
153 |
| - ClickablePath.Visibility = Visibility.Collapsed; |
| 194 | + (this as INavigationToolbar).IsEditModeEnabled = true; |
154 | 195 | VisiblePath.Focus(FocusState.Programmatic);
|
155 | 196 | VisiblePath.SelectAll();
|
156 | 197 | }
|
|
0 commit comments