Skip to content

Fix: Reduced tooltip size when only the drive name is available #12231

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 1 commit into from
Apr 30, 2023
Merged
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
285 changes: 140 additions & 145 deletions src/Files.App/UserControls/SidebarControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,168 +100,163 @@
Visibility="{x:Bind ItemVisibility}">
<ToolTipService.ToolTip>
<ToolTip>
<Grid
x:Name="DriveTooltip"
Padding="0"
HorizontalAlignment="Stretch"
ColumnSpacing="8"
CornerRadius="4"
RowSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="72" />
<ColumnDefinition
Width="Auto"
MinWidth="100"
MaxWidth="140" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<StackPanel>
<!-- Displays the drive name, this is hidden when the extended details are shown -->
<TextBlock
x:Name="DriveNameTextBlock"
x:Load="{x:Bind ShowDriveDetails, Converter={StaticResource BoolNegationConverter}}"
Text="{x:Bind Text, Mode=OneWay}" />

<!-- Label -->
<TextBlock
x:Name="DriveLabel"
Grid.ColumnSpan="3"
Padding="8,8,0,0"
VerticalAlignment="Center"
<Grid
x:Name="DriveTooltip"
Padding="0"
HorizontalAlignment="Stretch"
x:Load="{x:Bind ShowDriveDetails}"
FontSize="14"
FontWeight="Medium"
Text="{x:Bind Text, Mode=OneWay}" />
ColumnSpacing="8"
CornerRadius="4"
RowSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="72" />
<ColumnDefinition
Width="Auto"
MinWidth="100"
MaxWidth="140" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<!-- Space used progress -->
<ProgressRing
x:Name="SpaceUserProgressRing"
Grid.Row="1"
Grid.RowSpan="3"
Grid.Column="0"
Width="60"
Height="60"
HorizontalAlignment="Left"
x:Load="{x:Bind ShowDriveDetails}"
Background="{ThemeResource ProgressRingBackgroundThemeBrush}"
IsIndeterminate="False"
Value="{x:Bind PercentageUsed, Mode=OneWay}">
<!-- Label -->
<TextBlock
x:Name="DriveLabel"
Grid.ColumnSpan="3"
Padding="8,8,0,0"
VerticalAlignment="Center"
FontSize="14"
FontWeight="Medium"
Text="{x:Bind Text, Mode=OneWay}" />

<ProgressRing.Template>
<ControlTemplate TargetType="ProgressRing">
<Grid x:Name="LayoutRoot" Background="Transparent">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock
Margin="0"
FontWeight="SemiBold"
Text="{Binding Value, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource StringFormatConverter}, ConverterParameter='{}{0:0}%', Mode=OneWay}"
TextAlignment="Center" />
</StackPanel>
<!-- Space used progress -->
<ProgressRing
x:Name="SpaceUserProgressRing"
Grid.Row="1"
Grid.RowSpan="3"
Grid.Column="0"
Width="60"
Height="60"
HorizontalAlignment="Left"
Background="{ThemeResource ProgressRingBackgroundThemeBrush}"
IsIndeterminate="False"
Value="{x:Bind PercentageUsed, Mode=OneWay}">

<!-- AnimatedVisualPlayer for Lottie -->
<AnimatedVisualPlayer
x:Name="LottiePlayer"
AutoPlay="false"
Opacity="1"
Stretch="fill" />
<ProgressRing.Template>
<ControlTemplate TargetType="ProgressRing">
<Grid x:Name="LayoutRoot" Background="Transparent">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock
Margin="0"
FontWeight="SemiBold"
Text="{Binding Value, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource StringFormatConverter}, ConverterParameter='{}{0:0}%', Mode=OneWay}"
TextAlignment="Center" />
</StackPanel>

<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Inactive">
<VisualState.Setters>
<Setter Target="LayoutRoot.Opacity" Value="0" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="DeterminateActive" />
<VisualState x:Name="Active" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</ProgressRing.Template>
</ProgressRing>
<!-- AnimatedVisualPlayer for Lottie -->
<AnimatedVisualPlayer
x:Name="LottiePlayer"
AutoPlay="false"
Opacity="1"
Stretch="fill" />

<!-- Disk used space -->
<StackPanel
x:Name="UsedSpaceDrivePanel"
Grid.Row="1"
Grid.Column="1"
x:Load="{x:Bind ShowDriveDetails}"
Orientation="Horizontal">
<Rectangle
Width="16"
Height="16"
Margin="0,0,12,0"
Fill="{Binding Foreground, ElementName=SpaceUserProgressRing}"
RadiusX="2"
RadiusY="2"
Stroke="{ThemeResource TextControlElevationBorderBrush}" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Inactive">
<VisualState.Setters>
<Setter Target="LayoutRoot.Opacity" Value="0" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="DeterminateActive" />
<VisualState x:Name="Active" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</ProgressRing.Template>
</ProgressRing>

<!-- Disk used space -->
<StackPanel
x:Name="UsedSpaceDrivePanel"
Grid.Row="1"
Grid.Column="1"
Orientation="Horizontal">
<Rectangle
Width="16"
Height="16"
Margin="0,0,12,0"
Fill="{Binding Foreground, ElementName=SpaceUserProgressRing}"
RadiusX="2"
RadiusY="2"
Stroke="{ThemeResource TextControlElevationBorderBrush}" />
<TextBlock
VerticalAlignment="Center"
FontWeight="Bold"
Text="{helpers:ResourceString Name=PropertiesDriveUsedSpace/Text}" />
</StackPanel>
<TextBlock
VerticalAlignment="Center"
FontWeight="Bold"
Text="{helpers:ResourceString Name=PropertiesDriveUsedSpace/Text}" />
</StackPanel>
<TextBlock
x:Name="UsedSpaceDriveValue"
Grid.Row="1"
Grid.Column="2"
x:Load="{x:Bind ShowDriveDetails}"
Style="{StaticResource PropertyValueTextBlock}"
Text="{x:Bind UsedSpaceText, Mode=OneWay}" />
x:Name="UsedSpaceDriveValue"
Grid.Row="1"
Grid.Column="2"
Style="{StaticResource PropertyValueTextBlock}"
Text="{x:Bind UsedSpaceText, Mode=OneWay}" />

<!-- Disk free space -->
<StackPanel
x:Name="FreeSpaceDrivePanel"
Grid.Row="2"
Grid.Column="1"
x:Load="{x:Bind ShowDriveDetails}"
Orientation="Horizontal">
<Rectangle
Width="16"
Height="16"
Margin="0,0,12,0"
Fill="{ThemeResource ProgressRingBackgroundThemeBrush}"
RadiusX="2"
RadiusY="2"
Stroke="{ThemeResource TextControlElevationBorderBrush}" />
<!-- Disk free space -->
<StackPanel
x:Name="FreeSpaceDrivePanel"
Grid.Row="2"
Grid.Column="1"
Orientation="Horizontal">
<Rectangle
Width="16"
Height="16"
Margin="0,0,12,0"
Fill="{ThemeResource ProgressRingBackgroundThemeBrush}"
RadiusX="2"
RadiusY="2"
Stroke="{ThemeResource TextControlElevationBorderBrush}" />
<TextBlock
VerticalAlignment="Center"
FontWeight="Bold"
Text="{helpers:ResourceString Name=PropertiesDriveFreeSpace/Text}" />
</StackPanel>
<TextBlock
x:Name="FreeSpaceDriveValue"
Grid.Row="2"
Grid.Column="2"
Style="{StaticResource PropertyValueTextBlock}"
Text="{x:Bind FreeSpaceText, Mode=OneWay}" />

<!-- Drive capacity -->
<TextBlock
x:Name="MaxSpaceDriveLabel"
Grid.Row="3"
Grid.Column="1"
Padding="28,0,0,0"
VerticalAlignment="Center"
FontWeight="Bold"
Text="{helpers:ResourceString Name=PropertiesDriveFreeSpace/Text}" />
</StackPanel>
<TextBlock
x:Name="FreeSpaceDriveValue"
Grid.Row="2"
Grid.Column="2"
x:Load="{x:Bind ShowDriveDetails}"
Style="{StaticResource PropertyValueTextBlock}"
Text="{x:Bind FreeSpaceText, Mode=OneWay}" />

<!-- Drive capacity -->
<TextBlock
x:Name="MaxSpaceDriveLabel"
Grid.Row="3"
Grid.Column="1"
Padding="28,0,0,0"
VerticalAlignment="Center"
x:Load="{x:Bind ShowDriveDetails}"
FontWeight="Bold"
Text="{helpers:ResourceString Name=PropertiesDriveCapacity/Text}" />
<TextBlock
x:Name="MaxSpaceDriveValue"
Grid.Row="3"
Grid.Column="2"
x:Load="{x:Bind ShowDriveDetails}"
Style="{StaticResource PropertyValueTextBlock}"
Text="{x:Bind MaxSpaceText, Mode=OneWay}" />
</Grid>
Text="{helpers:ResourceString Name=PropertiesDriveCapacity/Text}" />
<TextBlock
x:Name="MaxSpaceDriveValue"
Grid.Row="3"
Grid.Column="2"
Style="{StaticResource PropertyValueTextBlock}"
Text="{x:Bind MaxSpaceText, Mode=OneWay}" />
</Grid>
</StackPanel>
</ToolTip>
</ToolTipService.ToolTip>
<NavigationViewItem.Icon>
Expand Down