mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-21 21:30:37 +08:00
refactor: move binding for ToolTip.IsOpen from code to axaml
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user