using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
namespace MECF.Framework.UI.Core.ExtendedControls
{
///
/// ObjectInTreeView.xaml 的交互逻辑
///
public partial class ObjectInTreeView : UserControl
{
public ObjectInTreeView()
{
InitializeComponent();
}
public object ObjectToVisualize
{
get { return (object) GetValue(ObjectToVisualizeProperty); }
set { SetValue(ObjectToVisualizeProperty, value); }
}
public static readonly DependencyProperty ObjectToVisualizeProperty =
DependencyProperty.Register("ObjectToVisualize", typeof(object), typeof(ObjectInTreeView),
new PropertyMetadata(null, OnObjectChanged));
private static void OnObjectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
ObjectTreeNode tree = ObjectTreeNode.CreateTree(e.NewValue);
(d as ObjectInTreeView).TreeNodes = new List() {tree};
}
public List TreeNodes
{
get { return (List) GetValue(TreeNodesProperty); }
set { SetValue(TreeNodesProperty, value); }
}
public static readonly DependencyProperty TreeNodesProperty =
DependencyProperty.Register("TreeNodes", typeof(List), typeof(ObjectInTreeView),
new PropertyMetadata(null));
}
}