示例#1
0
        internal UIElement GetWrapper()
        {
            HeaderFooterItem headerFooterItem = m_owner as HeaderFooterItem;

            if (headerFooterItem == null)
            {
                headerFooterItem =
                    m_dataGridContext.GetContainerFromItem(m_owner) as HeaderFooterItem;
            }

            if (headerFooterItem == null)
            {
                return(null);
            }

            IDataGridItemContainer dataGridItemContainer = HeaderFooterItem.FindIDataGridItemContainerInChildren(
                headerFooterItem, headerFooterItem.AsVisual());

            if (dataGridItemContainer != null)
            {
                return(dataGridItemContainer as UIElement);
            }

            return(headerFooterItem);
        }
        private void AddChildrenFooters(
            HeadersFootersGeneratorNode footerNode,
            Hashtable oldHeaderFooterChildren,
            List <AutomationPeer> list)
        {
            if (m_parentDataGridContext == null)
            {
                // Add fixed header to the children list
                Panel fixedFooterPanel = m_dataGridControl.FixedFootersHostPanel;

                if (fixedFooterPanel != null)
                {
                    int index = 0;

                    foreach (DependencyObject headerFooter in fixedFooterPanel.Children)
                    {
                        HeaderFooterItem headerFooterItem = headerFooter as HeaderFooterItem;

                        if (headerFooterItem != null)
                        {
                            HeaderFooterItemAutomationPeer automationPeer = oldHeaderFooterChildren[headerFooter] as HeaderFooterItemAutomationPeer;

                            if (automationPeer == null)
                            {
                                automationPeer = new HeaderFooterItemAutomationPeer(m_dataGridContext, headerFooter);
                            }

                            automationPeer.SetExtraInfo(HeaderFooterItemAutomationPeer.HeaderFooterType.FixedFooter, index);
                            m_headerFooterChildren[headerFooter] = automationPeer;
                            list.Add(automationPeer);
                        }

                        index++;
                    }
                }
            }

            if (footerNode != null)
            {
                DataGridGroupAutomationPeer.AddFooterPeer(m_dataGridContext, footerNode, list, m_headerFooterChildren, oldHeaderFooterChildren);
            }
        }
        internal UIElement GetWrapper()
        {
            HeaderFooterItem headerFooterItem = m_owner as HeaderFooterItem;

            if (headerFooterItem == null)
            {
                headerFooterItem = m_dataGridContext.GetContainerFromItem(m_owner) as HeaderFooterItem;
            }

            if (headerFooterItem == null)
            {
                return(null);
            }

            var container = headerFooterItem.GetTemplatedDescendantDataGridItemContainers().FirstOrDefault();

            if (container != null)
            {
                return(container as UIElement);
            }

            return(headerFooterItem);
        }
    private PassiveLayoutDecorator GetPassiveLayoutDecorator( HeaderFooterItem item )
    {
      if( ( item == null ) || ( VisualTreeHelper.GetChildrenCount( item ) == 0 ) )
        return null;

      DependencyObject firstChild = VisualTreeHelper.GetChild( item, 0 );
      PassiveLayoutDecorator decorator = firstChild as PassiveLayoutDecorator;

      if( ( decorator == null ) && ( VisualTreeHelper.GetChildrenCount( firstChild ) > 0 ) )
      {
        decorator = VisualTreeHelper.GetChild( firstChild, 0 ) as PassiveLayoutDecorator;
      }

      return decorator;
    }