Permalink
Browse files

Fix code formatting.

1 parent 82ca308 commit 9f3335fabf0e3b631a6775b1ada2f571b5ccb84b @dgrunwald dgrunwald committed Dec 3, 2016
Showing with 27 additions and 24 deletions.
  1. +1 −1 SharpTreeView/SharpTreeViewAutomationPeer.cs
  2. +26 −23 SharpTreeView/SharpTreeViewItemAutomationPeer.cs
@@ -9,7 +9,7 @@ namespace ICSharpCode.TreeView
{
class SharpTreeViewAutomationPeer : FrameworkElementAutomationPeer
{
- internal SharpTreeViewAutomationPeer(SharpTreeView owner ): base(owner)
+ internal SharpTreeViewAutomationPeer(SharpTreeView owner ): base(owner)
{
}
//private SharpTreeView SharpTreeView { get { return (SharpTreeView)base.Owner; } }
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
using System.Text;
+using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
@@ -14,11 +16,10 @@ internal SharpTreeViewItemAutomationPeer(SharpTreeViewItem owner)
: base(owner)
{
SharpTreeViewItem.DataContextChanged += OnDataContextChanged;
- SharpTreeNode node = SharpTreeViewItem.DataContext as SharpTreeNode;
- if (node == null) return;
-
- node.PropertyChanged += OnPropertyChanged;
-
+ SharpTreeNode node = SharpTreeViewItem.DataContext as SharpTreeNode;
+ if (node == null) return;
+
+ node.PropertyChanged += OnPropertyChanged;
}
private SharpTreeViewItem SharpTreeViewItem { get { return (SharpTreeViewItem)base.Owner; } }
protected override AutomationControlType GetAutomationControlTypeCore()
@@ -32,6 +33,7 @@ public override object GetPattern(PatternInterface patternInterface)
return this;
return base.GetPattern(patternInterface);
}
+
public void Collapse()
{
}
@@ -40,35 +42,36 @@ public void Expand()
{
}
- public ExpandCollapseState ExpandCollapseState
- {
+ public ExpandCollapseState ExpandCollapseState {
get {
SharpTreeNode node = SharpTreeViewItem.DataContext as SharpTreeNode;
- if (node == null || !node.ShowExpander)
+ if (node == null || !node.ShowExpander)
return ExpandCollapseState.LeafNode;
- return node.IsExpanded?ExpandCollapseState.Expanded:ExpandCollapseState.Collapsed;
+ return node.IsExpanded ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed;
}
}
- private void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+
+ private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName != "IsExpanded") return;
-SharpTreeNode node = sender as SharpTreeNode;
- if (node == null || node.Children.Count == 0) return;
+ SharpTreeNode node = sender as SharpTreeNode;
+ if (node == null || node.Children.Count == 0) return;
bool newValue = node.IsExpanded;
bool oldValue = !newValue;
- RaisePropertyChangedEvent(
- ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty,
- oldValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed,
- newValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed);
- }
-private void OnDataContextChanged(object sender,System.Windows.DependencyPropertyChangedEventArgs e)
+ RaisePropertyChangedEvent(
+ ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty,
+ oldValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed,
+ newValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed);
+ }
+
+ private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
SharpTreeNode oldNode = e.OldValue as SharpTreeNode;
- if (oldNode != null)
- oldNode.PropertyChanged -= OnPropertyChanged;
- SharpTreeNode newNode = e.NewValue as SharpTreeNode;
- if (newNode != null)
- newNode.PropertyChanged += OnPropertyChanged;
+ if (oldNode != null)
+ oldNode.PropertyChanged -= OnPropertyChanged;
+ SharpTreeNode newNode = e.NewValue as SharpTreeNode;
+ if (newNode != null)
+ newNode.PropertyChanged += OnPropertyChanged;
}
}
}

0 comments on commit 9f3335f

Please sign in to comment.