Skip to content

Commit 604a0ef

Browse files
Fix: Reduced tooltip size when only the drive name is available (#12231)
1 parent 8d4436b commit 604a0ef

File tree

1 file changed

+140
-145
lines changed

1 file changed

+140
-145
lines changed

src/Files.App/UserControls/SidebarControl.xaml

Lines changed: 140 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -100,168 +100,163 @@
100100
Visibility="{x:Bind ItemVisibility}">
101101
<ToolTipService.ToolTip>
102102
<ToolTip>
103-
<Grid
104-
x:Name="DriveTooltip"
105-
Padding="0"
106-
HorizontalAlignment="Stretch"
107-
ColumnSpacing="8"
108-
CornerRadius="4"
109-
RowSpacing="8">
110-
<Grid.ColumnDefinitions>
111-
<ColumnDefinition Width="72" />
112-
<ColumnDefinition
113-
Width="Auto"
114-
MinWidth="100"
115-
MaxWidth="140" />
116-
<ColumnDefinition Width="*" />
117-
<ColumnDefinition Width="Auto" />
118-
</Grid.ColumnDefinitions>
119-
<Grid.RowDefinitions>
120-
<RowDefinition Height="Auto" />
121-
<RowDefinition Height="Auto" />
122-
<RowDefinition Height="Auto" />
123-
<RowDefinition Height="Auto" />
124-
</Grid.RowDefinitions>
125-
103+
<StackPanel>
126104
<!-- Displays the drive name, this is hidden when the extended details are shown -->
127105
<TextBlock
128106
x:Name="DriveNameTextBlock"
129107
x:Load="{x:Bind ShowDriveDetails, Converter={StaticResource BoolNegationConverter}}"
130108
Text="{x:Bind Text, Mode=OneWay}" />
131109

132-
<!-- Label -->
133-
<TextBlock
134-
x:Name="DriveLabel"
135-
Grid.ColumnSpan="3"
136-
Padding="8,8,0,0"
137-
VerticalAlignment="Center"
110+
<Grid
111+
x:Name="DriveTooltip"
112+
Padding="0"
113+
HorizontalAlignment="Stretch"
138114
x:Load="{x:Bind ShowDriveDetails}"
139-
FontSize="14"
140-
FontWeight="Medium"
141-
Text="{x:Bind Text, Mode=OneWay}" />
115+
ColumnSpacing="8"
116+
CornerRadius="4"
117+
RowSpacing="8">
118+
<Grid.ColumnDefinitions>
119+
<ColumnDefinition Width="72" />
120+
<ColumnDefinition
121+
Width="Auto"
122+
MinWidth="100"
123+
MaxWidth="140" />
124+
<ColumnDefinition Width="*" />
125+
<ColumnDefinition Width="Auto" />
126+
</Grid.ColumnDefinitions>
127+
<Grid.RowDefinitions>
128+
<RowDefinition Height="Auto" />
129+
<RowDefinition Height="Auto" />
130+
<RowDefinition Height="Auto" />
131+
<RowDefinition Height="Auto" />
132+
</Grid.RowDefinitions>
142133

143-
<!-- Space used progress -->
144-
<ProgressRing
145-
x:Name="SpaceUserProgressRing"
146-
Grid.Row="1"
147-
Grid.RowSpan="3"
148-
Grid.Column="0"
149-
Width="60"
150-
Height="60"
151-
HorizontalAlignment="Left"
152-
x:Load="{x:Bind ShowDriveDetails}"
153-
Background="{ThemeResource ProgressRingBackgroundThemeBrush}"
154-
IsIndeterminate="False"
155-
Value="{x:Bind PercentageUsed, Mode=OneWay}">
134+
<!-- Label -->
135+
<TextBlock
136+
x:Name="DriveLabel"
137+
Grid.ColumnSpan="3"
138+
Padding="8,8,0,0"
139+
VerticalAlignment="Center"
140+
FontSize="14"
141+
FontWeight="Medium"
142+
Text="{x:Bind Text, Mode=OneWay}" />
156143

157-
<ProgressRing.Template>
158-
<ControlTemplate TargetType="ProgressRing">
159-
<Grid x:Name="LayoutRoot" Background="Transparent">
160-
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
161-
<TextBlock
162-
Margin="0"
163-
FontWeight="SemiBold"
164-
Text="{Binding Value, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource StringFormatConverter}, ConverterParameter='{}{0:0}%', Mode=OneWay}"
165-
TextAlignment="Center" />
166-
</StackPanel>
144+
<!-- Space used progress -->
145+
<ProgressRing
146+
x:Name="SpaceUserProgressRing"
147+
Grid.Row="1"
148+
Grid.RowSpan="3"
149+
Grid.Column="0"
150+
Width="60"
151+
Height="60"
152+
HorizontalAlignment="Left"
153+
Background="{ThemeResource ProgressRingBackgroundThemeBrush}"
154+
IsIndeterminate="False"
155+
Value="{x:Bind PercentageUsed, Mode=OneWay}">
167156

168-
<!-- AnimatedVisualPlayer for Lottie -->
169-
<AnimatedVisualPlayer
170-
x:Name="LottiePlayer"
171-
AutoPlay="false"
172-
Opacity="1"
173-
Stretch="fill" />
157+
<ProgressRing.Template>
158+
<ControlTemplate TargetType="ProgressRing">
159+
<Grid x:Name="LayoutRoot" Background="Transparent">
160+
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
161+
<TextBlock
162+
Margin="0"
163+
FontWeight="SemiBold"
164+
Text="{Binding Value, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource StringFormatConverter}, ConverterParameter='{}{0:0}%', Mode=OneWay}"
165+
TextAlignment="Center" />
166+
</StackPanel>
174167

175-
<VisualStateManager.VisualStateGroups>
176-
<VisualStateGroup x:Name="CommonStates">
177-
<VisualState x:Name="Inactive">
178-
<VisualState.Setters>
179-
<Setter Target="LayoutRoot.Opacity" Value="0" />
180-
</VisualState.Setters>
181-
</VisualState>
182-
<VisualState x:Name="DeterminateActive" />
183-
<VisualState x:Name="Active" />
184-
</VisualStateGroup>
185-
</VisualStateManager.VisualStateGroups>
186-
</Grid>
187-
</ControlTemplate>
188-
</ProgressRing.Template>
189-
</ProgressRing>
168+
<!-- AnimatedVisualPlayer for Lottie -->
169+
<AnimatedVisualPlayer
170+
x:Name="LottiePlayer"
171+
AutoPlay="false"
172+
Opacity="1"
173+
Stretch="fill" />
190174

191-
<!-- Disk used space -->
192-
<StackPanel
193-
x:Name="UsedSpaceDrivePanel"
194-
Grid.Row="1"
195-
Grid.Column="1"
196-
x:Load="{x:Bind ShowDriveDetails}"
197-
Orientation="Horizontal">
198-
<Rectangle
199-
Width="16"
200-
Height="16"
201-
Margin="0,0,12,0"
202-
Fill="{Binding Foreground, ElementName=SpaceUserProgressRing}"
203-
RadiusX="2"
204-
RadiusY="2"
205-
Stroke="{ThemeResource TextControlElevationBorderBrush}" />
175+
<VisualStateManager.VisualStateGroups>
176+
<VisualStateGroup x:Name="CommonStates">
177+
<VisualState x:Name="Inactive">
178+
<VisualState.Setters>
179+
<Setter Target="LayoutRoot.Opacity" Value="0" />
180+
</VisualState.Setters>
181+
</VisualState>
182+
<VisualState x:Name="DeterminateActive" />
183+
<VisualState x:Name="Active" />
184+
</VisualStateGroup>
185+
</VisualStateManager.VisualStateGroups>
186+
</Grid>
187+
</ControlTemplate>
188+
</ProgressRing.Template>
189+
</ProgressRing>
190+
191+
<!-- Disk used space -->
192+
<StackPanel
193+
x:Name="UsedSpaceDrivePanel"
194+
Grid.Row="1"
195+
Grid.Column="1"
196+
Orientation="Horizontal">
197+
<Rectangle
198+
Width="16"
199+
Height="16"
200+
Margin="0,0,12,0"
201+
Fill="{Binding Foreground, ElementName=SpaceUserProgressRing}"
202+
RadiusX="2"
203+
RadiusY="2"
204+
Stroke="{ThemeResource TextControlElevationBorderBrush}" />
205+
<TextBlock
206+
VerticalAlignment="Center"
207+
FontWeight="Bold"
208+
Text="{helpers:ResourceString Name=PropertiesDriveUsedSpace/Text}" />
209+
</StackPanel>
206210
<TextBlock
207-
VerticalAlignment="Center"
208-
FontWeight="Bold"
209-
Text="{helpers:ResourceString Name=PropertiesDriveUsedSpace/Text}" />
210-
</StackPanel>
211-
<TextBlock
212-
x:Name="UsedSpaceDriveValue"
213-
Grid.Row="1"
214-
Grid.Column="2"
215-
x:Load="{x:Bind ShowDriveDetails}"
216-
Style="{StaticResource PropertyValueTextBlock}"
217-
Text="{x:Bind UsedSpaceText, Mode=OneWay}" />
211+
x:Name="UsedSpaceDriveValue"
212+
Grid.Row="1"
213+
Grid.Column="2"
214+
Style="{StaticResource PropertyValueTextBlock}"
215+
Text="{x:Bind UsedSpaceText, Mode=OneWay}" />
218216

219-
<!-- Disk free space -->
220-
<StackPanel
221-
x:Name="FreeSpaceDrivePanel"
222-
Grid.Row="2"
223-
Grid.Column="1"
224-
x:Load="{x:Bind ShowDriveDetails}"
225-
Orientation="Horizontal">
226-
<Rectangle
227-
Width="16"
228-
Height="16"
229-
Margin="0,0,12,0"
230-
Fill="{ThemeResource ProgressRingBackgroundThemeBrush}"
231-
RadiusX="2"
232-
RadiusY="2"
233-
Stroke="{ThemeResource TextControlElevationBorderBrush}" />
217+
<!-- Disk free space -->
218+
<StackPanel
219+
x:Name="FreeSpaceDrivePanel"
220+
Grid.Row="2"
221+
Grid.Column="1"
222+
Orientation="Horizontal">
223+
<Rectangle
224+
Width="16"
225+
Height="16"
226+
Margin="0,0,12,0"
227+
Fill="{ThemeResource ProgressRingBackgroundThemeBrush}"
228+
RadiusX="2"
229+
RadiusY="2"
230+
Stroke="{ThemeResource TextControlElevationBorderBrush}" />
231+
<TextBlock
232+
VerticalAlignment="Center"
233+
FontWeight="Bold"
234+
Text="{helpers:ResourceString Name=PropertiesDriveFreeSpace/Text}" />
235+
</StackPanel>
234236
<TextBlock
237+
x:Name="FreeSpaceDriveValue"
238+
Grid.Row="2"
239+
Grid.Column="2"
240+
Style="{StaticResource PropertyValueTextBlock}"
241+
Text="{x:Bind FreeSpaceText, Mode=OneWay}" />
242+
243+
<!-- Drive capacity -->
244+
<TextBlock
245+
x:Name="MaxSpaceDriveLabel"
246+
Grid.Row="3"
247+
Grid.Column="1"
248+
Padding="28,0,0,0"
235249
VerticalAlignment="Center"
236250
FontWeight="Bold"
237-
Text="{helpers:ResourceString Name=PropertiesDriveFreeSpace/Text}" />
238-
</StackPanel>
239-
<TextBlock
240-
x:Name="FreeSpaceDriveValue"
241-
Grid.Row="2"
242-
Grid.Column="2"
243-
x:Load="{x:Bind ShowDriveDetails}"
244-
Style="{StaticResource PropertyValueTextBlock}"
245-
Text="{x:Bind FreeSpaceText, Mode=OneWay}" />
246-
247-
<!-- Drive capacity -->
248-
<TextBlock
249-
x:Name="MaxSpaceDriveLabel"
250-
Grid.Row="3"
251-
Grid.Column="1"
252-
Padding="28,0,0,0"
253-
VerticalAlignment="Center"
254-
x:Load="{x:Bind ShowDriveDetails}"
255-
FontWeight="Bold"
256-
Text="{helpers:ResourceString Name=PropertiesDriveCapacity/Text}" />
257-
<TextBlock
258-
x:Name="MaxSpaceDriveValue"
259-
Grid.Row="3"
260-
Grid.Column="2"
261-
x:Load="{x:Bind ShowDriveDetails}"
262-
Style="{StaticResource PropertyValueTextBlock}"
263-
Text="{x:Bind MaxSpaceText, Mode=OneWay}" />
264-
</Grid>
251+
Text="{helpers:ResourceString Name=PropertiesDriveCapacity/Text}" />
252+
<TextBlock
253+
x:Name="MaxSpaceDriveValue"
254+
Grid.Row="3"
255+
Grid.Column="2"
256+
Style="{StaticResource PropertyValueTextBlock}"
257+
Text="{x:Bind MaxSpaceText, Mode=OneWay}" />
258+
</Grid>
259+
</StackPanel>
265260
</ToolTip>
266261
</ToolTipService.ToolTip>
267262
<NavigationViewItem.Icon>

0 commit comments

Comments
 (0)