Skip to content

Commit d44d2b9

Browse files
committed
ux: use a outer border to hold tooltip of commit message in FileHistories view (#1232)
Signed-off-by: leo <[email protected]>
1 parent f09367a commit d44d2b9

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/Views/FileHistories.axaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,9 @@
9393
<TextBlock Grid.Column="3" Classes="primary" Text="{Binding AuthorTimeShortStr}" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right"/>
9494
</Grid>
9595

96-
<TextBlock Grid.Row="1"
97-
Classes="primary"
98-
Text="{Binding Subject}"
99-
VerticalAlignment="Bottom"
100-
DataContextChanged="OnCommitSubjectDataContextChanged"
101-
PointerMoved="OnCommitSubjectPointerMoved"/>
96+
<Border Grid.Row="1" Background="Transparent" DataContextChanged="OnCommitSubjectDataContextChanged" PointerMoved="OnCommitSubjectPointerMoved">
97+
<TextBlock Classes="primary" Text="{Binding Subject}" VerticalAlignment="Bottom"/>
98+
</Border>
10299
</Grid>
103100
</Border>
104101
</DataTemplate>

src/Views/FileHistories.axaml.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,18 @@ private async void OnSaveAsPatch(object sender, RoutedEventArgs e)
6262

6363
private void OnCommitSubjectDataContextChanged(object sender, EventArgs e)
6464
{
65-
if (sender is TextBlock textBlock)
66-
ToolTip.SetTip(textBlock, null);
65+
if (sender is Border border)
66+
ToolTip.SetTip(border, null);
6767
}
6868

6969
private void OnCommitSubjectPointerMoved(object sender, PointerEventArgs e)
7070
{
71-
if (sender is TextBlock { DataContext: Models.Commit commit } textBlock &&
71+
if (sender is Border { DataContext: Models.Commit commit } border &&
7272
DataContext is ViewModels.FileHistories vm)
7373
{
74-
var tooltip = ToolTip.GetTip(textBlock);
74+
var tooltip = ToolTip.GetTip(border);
7575
if (tooltip == null)
76-
ToolTip.SetTip(textBlock, vm.GetCommitFullMessage(commit));
76+
ToolTip.SetTip(border, vm.GetCommitFullMessage(commit));
7777
}
7878
}
7979
}

0 commit comments

Comments
 (0)