Browse Source

Merge branch 'master' into 9612-duplicate-setters

pull/10113/head
Dan Walmsley 3 years ago
committed by GitHub
parent
commit
375beb8f2c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 29
      src/Avalonia.Controls/TreeViewItem.cs

29
src/Avalonia.Controls/TreeViewItem.cs

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

Loading…
Cancel
Save