Skip to content

Commit 33e6324

Browse files
authored
Fixed an issue where the devices FullPath would show instead of FullName on hover (#3215)
1 parent 73ef37f commit 33e6324

File tree

5 files changed

+64
-7
lines changed

5 files changed

+64
-7
lines changed

Files/App.xaml.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,23 @@ public static async void CloseApp()
504504
public class WSLDistroItem : INavigationControlItem
505505
{
506506
public string Glyph { get; set; } = null;
507+
507508
public string Text { get; set; }
508-
public string Path { get; set; }
509+
510+
private string path;
511+
public string Path
512+
{
513+
get => path;
514+
set
515+
{
516+
path = value;
517+
HoverDisplayText = Path.Contains("?") ? Text : Path;
518+
}
519+
}
520+
public string HoverDisplayText { get; private set; }
521+
509522
public NavigationControlItemType ItemType => NavigationControlItemType.LinuxDistro;
523+
510524
public Uri Logo { get; set; }
511525
}
512526
}

Files/Filesystem/DriveItem.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,19 @@ namespace Files.Filesystem
1515
public class DriveItem : ObservableObject, INavigationControlItem
1616
{
1717
public string Glyph { get; set; }
18-
public string Path { get; set; }
18+
19+
private string path;
20+
public string Path
21+
{
22+
get => path;
23+
set
24+
{
25+
path = value;
26+
HoverDisplayText = Path.Contains("?") ? Text : Path;
27+
}
28+
}
29+
30+
public string HoverDisplayText { get; private set; }
1931
public string DeviceID { get; set; }
2032
public StorageFolder Root { get; set; }
2133
public NavigationControlItemType ItemType { get; set; } = NavigationControlItemType.Drive;

Files/Filesystem/INavigationControlItem.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
public interface INavigationControlItem
44
{
55
public string Glyph { get; }
6+
67
public string Text { get; }
8+
79
public string Path { get; }
10+
11+
public string HoverDisplayText { get; }
12+
813
public NavigationControlItemType ItemType { get; }
914
}
1015

Files/Filesystem/LocationItem.cs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,19 @@ public class LocationItem : INavigationControlItem
66
{
77
public string Glyph { get; set; }
88
public string Text { get; set; }
9-
public string Path { get; set; }
9+
10+
private string path;
11+
public string Path
12+
{
13+
get => path;
14+
set
15+
{
16+
path = value;
17+
HoverDisplayText = Path.Contains("?") ? Text : Path;
18+
}
19+
}
20+
21+
public string HoverDisplayText { get; private set; }
1022
public FontFamily Font { get; set; } = new FontFamily("Segoe MDL2 Assets");
1123
public NavigationControlItemType ItemType => NavigationControlItemType.Location;
1224
public bool IsDefaultLocation { get; set; }
@@ -15,8 +27,22 @@ public class LocationItem : INavigationControlItem
1527
public class HeaderTextItem : INavigationControlItem
1628
{
1729
public string Glyph { get; set; } = null;
30+
1831
public string Text { get; set; }
19-
public string Path { get; set; } = null;
32+
33+
private string path;
34+
public string Path
35+
{
36+
get => path;
37+
set
38+
{
39+
path = value;
40+
HoverDisplayText = Path.Contains("?") ? Text : Path;
41+
}
42+
}
43+
44+
public string HoverDisplayText { get; private set; }
45+
2046
public NavigationControlItemType ItemType => NavigationControlItemType.Header;
2147
}
2248
}

Files/UserControls/SidebarControl.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
IsRightTapEnabled="True"
5757
RightTapped="NavigationViewLocationItem_RightTapped"
5858
Tag="{x:Bind Path}"
59-
ToolTipService.ToolTip="{x:Bind Path}">
59+
ToolTipService.ToolTip="{x:Bind HoverDisplayText}">
6060
<muxc:NavigationViewItem.Icon>
6161
<FontIcon
6262
FontFamily="{x:Bind Font}"
@@ -80,7 +80,7 @@
8080
IsRightTapEnabled="True"
8181
RightTapped="NavigationViewDriveItem_RightTapped"
8282
Tag="{x:Bind Path}"
83-
ToolTipService.ToolTip="{x:Bind Path, Mode=OneWay}"
83+
ToolTipService.ToolTip="{x:Bind HoverDisplayText, Mode=OneWay}"
8484
Visibility="{x:Bind ItemVisibility}">
8585
<muxc:NavigationViewItem.Icon>
8686
<FontIcon
@@ -100,7 +100,7 @@
100100
DragEnter="NavigationViewItem_DragEnter"
101101
DragLeave="NavigationViewItem_DragLeave"
102102
Tag="{x:Bind Path}"
103-
ToolTipService.ToolTip="{x:Bind Path, Mode=OneWay}">
103+
ToolTipService.ToolTip="{x:Bind HoverDisplayText, Mode=OneWay}">
104104
<muxc:NavigationViewItem.Icon>
105105
<BitmapIcon
106106
Width="30"

0 commit comments

Comments
 (0)