Exemplo n.º 1
0
        protected TreeItem(object instance, TreeItem parent, TreeModel model, int level)
        {
            _instance = instance;
            _parent = parent;
            Model = model;
            Level = level;

            var frameworkElement = instance as FrameworkElement;
            if (frameworkElement != null)
            {
                if (frameworkElement.IsLoaded)
                {
                    frameworkElement.Unloaded += OnUnloaded;
                }
                else
                {
                    frameworkElement.Loaded += OnLoaded;
                }
            }

            var itemsControl = instance as ItemsControl;
            if (itemsControl != null)
            {
                itemsControl.ItemContainerGenerator.ItemsChanged += OnListChanged;
            }

            _children.CollectionChanged += OnChildenCountChanged;
        }
Exemplo n.º 2
0
 public ApplicationTreeItem(Application app, TreeModel model, TreeType treeType)
     : base(app, null, model, 0)
 {
     Name = "Application";
     IsExpanded = true;
     _treeType = treeType;
 }
        public PresentationSourceTreeItem(PresentationSource presentationSource, TreeModel model, TreeType treeType)
            : base(presentationSource, null, model, 0)
        {
            Name = "PresentationSource";
            IsExpanded = true;

            _treeType = treeType;
            _presentationSource = presentationSource;
        }
Exemplo n.º 4
0
        public LogicalTreeItem(object instance, TreeItem parent, TreeModel model, int level)
            : base(instance, parent, model, level)
        {
            var frameworkElement = instance as FrameworkElement;
            if (frameworkElement != null && !string.IsNullOrEmpty(frameworkElement.Name))
            {
                var name = frameworkElement.GetType().Name;
                Name = string.Format("{0} ({1})", name, frameworkElement.Name);
            }
            else
            {
                Name = instance.GetType().Name;
            }

            if (!LogicalTreeItemLookup.ContainsKey(instance))
            {
                LogicalTreeItemLookup.Add(instance, this);
            }
            else
            {
                LogicalTreeItemLookup[instance] = this;
            }
        }
Exemplo n.º 5
0
 public AutomationItem(object item, TreeItem parent, TreeModel model, int level)
     : base(item, parent, model, level)
 {
     _element = (AutomationElement)item;
     Name     = _element.Current.ControlType.LocalizedControlType + " " + _element.Current.Name;
 }
Exemplo n.º 6
0
 public AutomationItem(object item, TreeItem parent, TreeModel model, int level)
     : base(item, parent, model,level)
 {
     _element = (AutomationElement)item;
     Name = _element.Current.ControlType.LocalizedControlType + " " + _element.Current.Name;
 }