Skip to content

Folder path is now displayed when hovering a tab. (#6808) #9700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Files.Uwp/Helpers/MultitaskingTabsHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public static async Task AddNewTab(Type type, object tabViewItemArgs, int atInde
{
Header = null,
IconSource = fontIconSource,
Description = null
Description = null,
HoverDisplayText = null
};
tabItem.Control.NavigationArguments = new TabItemArguments()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@
Header="{x:Bind Header, Mode=OneWay}"
IconSource="{x:Bind IconSource, Mode=OneWay}"
Style="{StaticResource Local.TabViewItem}"
ToolTipService.ToolTip="{x:Null}" />
ToolTipService.ToolTip="{x:Bind HoverDisplayText, Mode=OneWay}" />
</DataTemplate>
</muxc:TabView.TabItemTemplate>
<muxc:TabView.TabStripFooter>
Expand Down
11 changes: 11 additions & 0 deletions src/Files.Uwp/UserControls/MultitaskingControl/TabItem/TabItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ public string Description
set => SetProperty(ref description, value);
}

private string hoverDisplayText;

/// <summary>
/// The text that should be displayed in the tooltip when hovering the tab item.
/// </summary>
public string HoverDisplayText
{
get => hoverDisplayText;
set => SetProperty(ref hoverDisplayText, value);
}

private IconSource iconSource;

public IconSource IconSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
Header="{x:Bind Header, Mode=OneWay}"
IconSource="{x:Bind IconSource, Mode=OneWay}"
Style="{StaticResource TabViewItemStyle}"
ToolTipService.ToolTip="{x:Null}">
ToolTipService.ToolTip="{x:Bind HoverDisplayText, Mode=OneWay}">
<muxc:TabViewItem.Resources>
<StaticResource x:Key="TabViewItemSeparator" ResourceKey="SystemControlTransparentBrush" />
</muxc:TabViewItem.Resources>
Expand Down
19 changes: 11 additions & 8 deletions src/Files.Uwp/ViewModels/MainPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ public static async Task AddNewTabByPathAsync(Type type, string path, int atInde
{
Header = null,
IconSource = null,
Description = null
Description = null,
HoverDisplayText = null
};
tabItem.Control.NavigationArguments = new TabItemArguments()
{
Expand All @@ -219,12 +220,12 @@ public async void UpdateInstanceProperties(object navigationArg)
}
else
{
(windowTitle, _) = await GetSelectedTabInfoAsync(paneArgs.LeftPaneNavPathParam);
(windowTitle, _, _) = await GetSelectedTabInfoAsync(paneArgs.LeftPaneNavPathParam);
}
}
else if (navigationArg is string pathArgs)
{
(windowTitle, _) = await GetSelectedTabInfoAsync(pathArgs);
(windowTitle, _, _) = await GetSelectedTabInfoAsync(pathArgs);
}
if (AppInstances.Count > 1)
{
Expand All @@ -250,19 +251,20 @@ public static async Task UpdateTabInfo(TabItem tabItem, object navigationArg)
}
else
{
(tabItem.Header, tabItem.IconSource) = await GetSelectedTabInfoAsync(paneArgs.LeftPaneNavPathParam);
(tabItem.Header, tabItem.IconSource, tabItem.HoverDisplayText) = await GetSelectedTabInfoAsync(paneArgs.LeftPaneNavPathParam);
}
}
else if (navigationArg is string pathArgs)
{
(tabItem.Header, tabItem.IconSource) = await GetSelectedTabInfoAsync(pathArgs);
(tabItem.Header, tabItem.IconSource, tabItem.HoverDisplayText) = await GetSelectedTabInfoAsync(pathArgs);
}
}

public static async Task<(string tabLocationHeader, Microsoft.UI.Xaml.Controls.IconSource tabIcon)> GetSelectedTabInfoAsync(string currentPath)
public static async Task<(string tabLocationHeader, Microsoft.UI.Xaml.Controls.IconSource tabIcon, string hoverDisplayText)> GetSelectedTabInfoAsync(string currentPath)
{
string tabLocationHeader;
var iconSource = new Microsoft.UI.Xaml.Controls.ImageIconSource();
string hoverDisplayText = currentPath;

if (string.IsNullOrEmpty(currentPath) || currentPath == "Home".GetLocalized())
{
Expand Down Expand Up @@ -336,7 +338,7 @@ public static async Task UpdateTabInfo(TabItem tabItem, object navigationArg)
}
}

return (tabLocationHeader, iconSource);
return (tabLocationHeader, iconSource, hoverDisplayText);
}

public async void OnNavigatedTo(NavigationEventArgs e)
Expand Down Expand Up @@ -477,7 +479,8 @@ public static async Task AddNewTabByParam(Type type, object tabViewItemArgs, int
{
Header = null,
IconSource = null,
Description = null
Description = null,
HoverDisplayText = null
};
tabItem.Control.NavigationArguments = new TabItemArguments()
{
Expand Down