mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-24 05:35:00 +00:00
enhance: show commit full message tooltip when hover commit subject in FileHistories
view (#1232)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
7890f7abbf
commit
fafa2a53ae
3 changed files with 37 additions and 1 deletions
|
@ -93,7 +93,12 @@
|
|||
<TextBlock Grid.Column="3" Classes="primary" Text="{Binding AuthorTimeShortStr}" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right"/>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="1" Classes="primary" Text="{Binding Subject}" VerticalAlignment="Bottom"/>
|
||||
<TextBlock Grid.Row="1"
|
||||
Classes="primary"
|
||||
Text="{Binding Subject}"
|
||||
VerticalAlignment="Bottom"
|
||||
DataContextChanged="OnCommitSubjectDataContextChanged"
|
||||
PointerMoved="OnCommitSubjectPointerMoved"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
@ -57,5 +59,22 @@ namespace SourceGit.Views
|
|||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCommitSubjectDataContextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is TextBlock textBlock)
|
||||
ToolTip.SetTip(textBlock, null);
|
||||
}
|
||||
|
||||
private void OnCommitSubjectPointerMoved(object sender, PointerEventArgs e)
|
||||
{
|
||||
if (sender is TextBlock { DataContext: Models.Commit commit } textBlock &&
|
||||
DataContext is ViewModels.FileHistories vm)
|
||||
{
|
||||
var tooltip = ToolTip.GetTip(textBlock);
|
||||
if (tooltip == null)
|
||||
ToolTip.SetTip(textBlock, vm.GetCommitFullMessage(commit));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue