Exemple #1
0
        // workaround, pending bug 953483.  The panel is
        // being removed from the tree, so it should release
        // its resources (chiefly - stop listening for generator's
        // ItemsChanged event).  Until there's a mechanism for
        // this, just mark the panel as a non-ItemsHost, so
        // that the next time it gets ItemsChanged it will
        // stop listening.  (See also bug 942265)
        private void ClearPanel()
        {
            Panel oldPanel = (this.VisualChildrenCount > 0) ? this.GetVisualChild(0) as Panel : null;
            Type  type     = null;

            if (Template != null)
            {
                // Get the type of the template content's root

                // Is this a FEF-based template?
                if (Template.VisualTree != null)
                {
                    type = Template.VisualTree.Type;
                }

                // Or, is it a (non-empty) Baml-based template?
                else if (Template.HasXamlNodeContent)
                {
                    System.Xaml.XamlType xType = (Template.Template as TemplateContent).RootType;
                    type = xType.UnderlyingType;
                }
            }

            if (oldPanel != null && oldPanel.GetType() == type)
            {
                oldPanel.IsItemsHost = false;
            }
        }
        // Token: 0x06005112 RID: 20754 RVA: 0x0016BC38 File Offset: 0x00169E38
        private void ClearPanel()
        {
            Panel panel = (this.VisualChildrenCount > 0) ? (this.GetVisualChild(0) as Panel) : null;
            Type  right = null;

            if (this.Template != null)
            {
                if (this.Template.VisualTree != null)
                {
                    right = this.Template.VisualTree.Type;
                }
                else if (this.Template.HasXamlNodeContent)
                {
                    XamlType rootType = this.Template.Template.RootType;
                    right = rootType.UnderlyingType;
                }
            }
            if (panel != null && panel.GetType() == right)
            {
                panel.IsItemsHost = false;
            }
        }