|
|
|
@ -1,11 +1,11 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using Avalonia.Controls.Generators; |
|
|
|
using Avalonia.Controls.Metadata; |
|
|
|
using Avalonia.Controls.Mixins; |
|
|
|
using Avalonia.Controls.Primitives; |
|
|
|
using Avalonia.Controls.Templates; |
|
|
|
using Avalonia.Data; |
|
|
|
using Avalonia.Input; |
|
|
|
using Avalonia.LogicalTree; |
|
|
|
using Avalonia.Threading; |
|
|
|
@ -22,11 +22,10 @@ namespace Avalonia.Controls |
|
|
|
/// <summary>
|
|
|
|
/// Defines the <see cref="IsExpanded"/> property.
|
|
|
|
/// </summary>
|
|
|
|
public static readonly DirectProperty<TreeViewItem, bool> IsExpandedProperty = |
|
|
|
AvaloniaProperty.RegisterDirect<TreeViewItem, bool>( |
|
|
|
public static readonly StyledProperty<bool> IsExpandedProperty = |
|
|
|
AvaloniaProperty.Register<TreeViewItem, bool>( |
|
|
|
nameof(IsExpanded), |
|
|
|
o => o.IsExpanded, |
|
|
|
(o, v) => o.IsExpanded = v); |
|
|
|
defaultBindingMode: BindingMode.TwoWay); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Defines the <see cref="IsSelected"/> property.
|
|
|
|
@ -46,7 +45,6 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
private TreeView? _treeView; |
|
|
|
private Control? _header; |
|
|
|
private bool _isExpanded; |
|
|
|
private int _level; |
|
|
|
private bool _templateApplied; |
|
|
|
private bool _deferredBringIntoViewFlag; |
|
|
|
@ -68,8 +66,8 @@ namespace Avalonia.Controls |
|
|
|
/// </summary>
|
|
|
|
public bool IsExpanded |
|
|
|
{ |
|
|
|
get { return _isExpanded; } |
|
|
|
set { SetAndRaise(IsExpandedProperty, ref _isExpanded, value); } |
|
|
|
get => GetValue(IsExpandedProperty); |
|
|
|
set => SetValue(IsExpandedProperty, value); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -77,8 +75,8 @@ namespace Avalonia.Controls |
|
|
|
/// </summary>
|
|
|
|
public bool IsSelected |
|
|
|
{ |
|
|
|
get { return GetValue(IsSelectedProperty); } |
|
|
|
set { SetValue(IsSelectedProperty, value); } |
|
|
|
get => GetValue(IsSelectedProperty); |
|
|
|
set => SetValue(IsSelectedProperty, value); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -86,8 +84,8 @@ namespace Avalonia.Controls |
|
|
|
/// </summary>
|
|
|
|
public int Level |
|
|
|
{ |
|
|
|
get { return _level; } |
|
|
|
private set { SetAndRaise(LevelProperty, ref _level, value); } |
|
|
|
get => _level; |
|
|
|
private set => SetAndRaise(LevelProperty, ref _level, value); |
|
|
|
} |
|
|
|
|
|
|
|
internal TreeView? TreeViewOwner => _treeView; |
|
|
|
@ -115,11 +113,6 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e) |
|
|
|
{ |
|
|
|
base.OnDetachedFromLogicalTree(e); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void OnRequestBringIntoView(RequestBringIntoViewEventArgs e) |
|
|
|
{ |
|
|
|
if (e.TargetObject == this) |
|
|
|
@ -266,7 +259,7 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Invoked when the <see cref="DoubleTapped"/> event occurs in the header.
|
|
|
|
/// Invoked when the <see cref="InputElement.DoubleTapped"/> event occurs in the header.
|
|
|
|
/// </summary>
|
|
|
|
protected virtual void OnHeaderDoubleTapped(TappedEventArgs e) |
|
|
|
{ |
|
|
|
|