mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 11:44:59 +00:00
refactor: move binding for ToolTip.IsOpen
from code to axaml
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
0cb2ca78fe
commit
e7f0217a7b
2 changed files with 7 additions and 17 deletions
|
@ -203,6 +203,13 @@
|
|||
FullMessage="{Binding #ThisControl.FullMessage}"
|
||||
HorizontalAlignment="Stretch"
|
||||
TextWrapping="Wrap">
|
||||
<ToolTip.IsOpen>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="$self.IsPointerOver"/>
|
||||
<Binding Path="$self.(ToolTip.Tip)" Converter="{x:Static ObjectConverters.IsNotNull}"/>
|
||||
</MultiBinding>
|
||||
</ToolTip.IsOpen>
|
||||
|
||||
<v:CommitMessagePresenter.DataTemplates>
|
||||
<DataTemplate DataType="m:Commit">
|
||||
<StackPanel MinWidth="400" Orientation="Vertical">
|
||||
|
|
|
@ -5,8 +5,6 @@ using System.Threading.Tasks;
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Documents;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Threading;
|
||||
using Avalonia.VisualTree;
|
||||
|
@ -26,21 +24,6 @@ namespace SourceGit.Views
|
|||
|
||||
protected override Type StyleKeyOverride => typeof(SelectableTextBlock);
|
||||
|
||||
public CommitMessagePresenter()
|
||||
{
|
||||
var bindings = new MultiBinding()
|
||||
{
|
||||
Converter = BoolConverters.And,
|
||||
Bindings = new[]
|
||||
{
|
||||
new Binding() { Path = "IsPointerOver", Source = this },
|
||||
new Binding() { Path = "(ToolTip.Tip)", Source = this, TypeResolver = (_, name) => name == "ToolTip" ? typeof(ToolTip) : null, Converter = ObjectConverters.IsNotNull },
|
||||
}
|
||||
};
|
||||
|
||||
Bind(ToolTip.IsOpenProperty, bindings);
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||
{
|
||||
base.OnPropertyChanged(change);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue