Skip to content

Commit 233224b

Browse files
authored
Folder path is now displayed when hovering a tab. (#6808) (#9700)
* Folder path is now displayed when hovering a tab. (#6808) * Added comment to new HoverDisplayText property according to new coding rules. (#6808) * Binded HoverDisplayText in the proper way on multitasking controls. (#6808) * Generalized the concept of HoverableDisplay in an interface. (#6808) * Revert "Generalized the concept of HoverableDisplay in an interface. (#6808)" This reverts commit fe46ee0.
1 parent 0c0598b commit 233224b

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

src/Files.Uwp/Helpers/MultitaskingTabsHelpers.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ public static async Task AddNewTab(Type type, object tabViewItemArgs, int atInde
6767
{
6868
Header = null,
6969
IconSource = fontIconSource,
70-
Description = null
70+
Description = null,
71+
HoverDisplayText = null
7172
};
7273
tabItem.Control.NavigationArguments = new TabItemArguments()
7374
{

src/Files.Uwp/UserControls/MultitaskingControl/HorizontalMultitaskingControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@
590590
Header="{x:Bind Header, Mode=OneWay}"
591591
IconSource="{x:Bind IconSource, Mode=OneWay}"
592592
Style="{StaticResource Local.TabViewItem}"
593-
ToolTipService.ToolTip="{x:Null}" />
593+
ToolTipService.ToolTip="{x:Bind HoverDisplayText, Mode=OneWay}" />
594594
</DataTemplate>
595595
</muxc:TabView.TabItemTemplate>
596596
<muxc:TabView.TabStripFooter>

src/Files.Uwp/UserControls/MultitaskingControl/TabItem/TabItem.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ public string Description
2929
set => SetProperty(ref description, value);
3030
}
3131

32+
private string hoverDisplayText;
33+
34+
/// <summary>
35+
/// The text that should be displayed in the tooltip when hovering the tab item.
36+
/// </summary>
37+
public string HoverDisplayText
38+
{
39+
get => hoverDisplayText;
40+
set => SetProperty(ref hoverDisplayText, value);
41+
}
42+
3243
private IconSource iconSource;
3344

3445
public IconSource IconSource

src/Files.Uwp/UserControls/MultitaskingControl/VerticalTabViewControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
Header="{x:Bind Header, Mode=OneWay}"
120120
IconSource="{x:Bind IconSource, Mode=OneWay}"
121121
Style="{StaticResource TabViewItemStyle}"
122-
ToolTipService.ToolTip="{x:Null}">
122+
ToolTipService.ToolTip="{x:Bind HoverDisplayText, Mode=OneWay}">
123123
<muxc:TabViewItem.Resources>
124124
<StaticResource x:Key="TabViewItemSeparator" ResourceKey="SystemControlTransparentBrush" />
125125
</muxc:TabViewItem.Resources>

src/Files.Uwp/ViewModels/MainPageViewModel.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ public static async Task AddNewTabByPathAsync(Type type, string path, int atInde
192192
{
193193
Header = null,
194194
IconSource = null,
195-
Description = null
195+
Description = null,
196+
HoverDisplayText = null
196197
};
197198
tabItem.Control.NavigationArguments = new TabItemArguments()
198199
{
@@ -219,12 +220,12 @@ public async void UpdateInstanceProperties(object navigationArg)
219220
}
220221
else
221222
{
222-
(windowTitle, _) = await GetSelectedTabInfoAsync(paneArgs.LeftPaneNavPathParam);
223+
(windowTitle, _, _) = await GetSelectedTabInfoAsync(paneArgs.LeftPaneNavPathParam);
223224
}
224225
}
225226
else if (navigationArg is string pathArgs)
226227
{
227-
(windowTitle, _) = await GetSelectedTabInfoAsync(pathArgs);
228+
(windowTitle, _, _) = await GetSelectedTabInfoAsync(pathArgs);
228229
}
229230
if (AppInstances.Count > 1)
230231
{
@@ -250,19 +251,20 @@ public static async Task UpdateTabInfo(TabItem tabItem, object navigationArg)
250251
}
251252
else
252253
{
253-
(tabItem.Header, tabItem.IconSource) = await GetSelectedTabInfoAsync(paneArgs.LeftPaneNavPathParam);
254+
(tabItem.Header, tabItem.IconSource, tabItem.HoverDisplayText) = await GetSelectedTabInfoAsync(paneArgs.LeftPaneNavPathParam);
254255
}
255256
}
256257
else if (navigationArg is string pathArgs)
257258
{
258-
(tabItem.Header, tabItem.IconSource) = await GetSelectedTabInfoAsync(pathArgs);
259+
(tabItem.Header, tabItem.IconSource, tabItem.HoverDisplayText) = await GetSelectedTabInfoAsync(pathArgs);
259260
}
260261
}
261262

262-
public static async Task<(string tabLocationHeader, Microsoft.UI.Xaml.Controls.IconSource tabIcon)> GetSelectedTabInfoAsync(string currentPath)
263+
public static async Task<(string tabLocationHeader, Microsoft.UI.Xaml.Controls.IconSource tabIcon, string hoverDisplayText)> GetSelectedTabInfoAsync(string currentPath)
263264
{
264265
string tabLocationHeader;
265266
var iconSource = new Microsoft.UI.Xaml.Controls.ImageIconSource();
267+
string hoverDisplayText = currentPath;
266268

267269
if (string.IsNullOrEmpty(currentPath) || currentPath == "Home".GetLocalized())
268270
{
@@ -336,7 +338,7 @@ public static async Task UpdateTabInfo(TabItem tabItem, object navigationArg)
336338
}
337339
}
338340

339-
return (tabLocationHeader, iconSource);
341+
return (tabLocationHeader, iconSource, hoverDisplayText);
340342
}
341343

342344
public async void OnNavigatedTo(NavigationEventArgs e)
@@ -477,7 +479,8 @@ public static async Task AddNewTabByParam(Type type, object tabViewItemArgs, int
477479
{
478480
Header = null,
479481
IconSource = null,
480-
Description = null
482+
Description = null,
483+
HoverDisplayText = null
481484
};
482485
tabItem.Control.NavigationArguments = new TabItemArguments()
483486
{

0 commit comments

Comments
 (0)