Esempio 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;
        }
 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;
        }
Esempio 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;
            }
        }
Esempio 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;
 }
Esempio 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;
 }