void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (e.NewValue == null || ((TreeNode)e.NewValue) == null)
            {
                // Clear properties pane:
                _xamlPropertiesPane.Refresh(e.NewValue);

                // Clear highlight:
                XamlInspectionHelper.HighlightElement(null, _rectangleUsedToHighlight, _webControl.Browser);
            }
            else
            {
                // Refresh the properties pane:
                var treeNode = (TreeNode)e.NewValue;
                _xamlPropertiesPane.Refresh(treeNode.Element);

                // Highlight the element in the web browser:
                XamlInspectionHelper.HighlightElement(treeNode.Element, _rectangleUsedToHighlight, _webControl.Browser);
            }
        }
        public bool TryRefresh(Assembly entryPointAssembly, XamlPropertiesPane xamlPropertiesPane, WPFBrowserView webControl, Rectangle highlightElement)
        {
            int nbTreeViewElements;

            _xamlPropertiesPane       = xamlPropertiesPane;
            _webControl               = webControl;
            _rectangleUsedToHighlight = highlightElement;
            _hasBeenFullyExpanded     = false;

            var isSuccess = XamlInspectionHelper.TryInitializeTreeView(this.TreeViewForXamlInspection, entryPointAssembly, out nbTreeViewElements);

            if (isSuccess)
            {
                this.NumberTreeViewElement.Text = "Element count: " + nbTreeViewElements;
            }
            else
            {
                this.NumberTreeViewElement.Text = "";
            }
            return(isSuccess);
        }