Exemplo n.º 1
0
        internal void SetRowSelectorPosition(DependencyObject container, Rect containerRect, FrameworkElement referenceElement)
        {
            Debug.Assert(( Visibility )this.GetValue(RowSelectorPane.VisibilityProperty) == Visibility.Visible, "We should not be creating RowSelectors if we are not Visible.");

            // Try to re-use the RowSelector already assigned to the container.
            if (this.TryReUseVisibleRowSelector(container, containerRect))
            {
                return;
            }

            var decorator = this.RecycleOrCreateRowSelector(container);

            Debug.Assert(decorator != null, "An attempt was made to set the position of a row selector that does not exist.");

            RowSelectorPane.PrepareRowSelector(decorator, container, containerRect, referenceElement);

            m_visibleSelectors.Add(container, decorator);

            this.InvalidateMeasure();
        }
Exemplo n.º 2
0
        private static void OnParentGridControlChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            RowSelectorPane rowSelectorPane = ( RowSelectorPane )sender;
            DataGridControl newGrid         = e.NewValue as DataGridControl;
            DataGridControl oldGrid         = e.OldValue as DataGridControl;

            if (oldGrid != null)
            {
                // The RowSelectorPane must clear its internal state when the ParentGridControl changes
                rowSelectorPane.m_pendingCleanup.Clear();
                rowSelectorPane.m_recyclingQueue.Clear();
                rowSelectorPane.m_visibleSelectors.Clear();
                rowSelectorPane.InternalChildren.Clear();
            }

            if (newGrid != null)
            {
                rowSelectorPane.PrepareDefaultStyleKey(newGrid.GetView());
            }

            rowSelectorPane.InvalidateMeasure();
        }
Exemplo n.º 3
0
        private void CleanUpUnusedRowSelectors()
        {
            m_pendingCleanupOperation = null;

            for (int i = m_pendingCleanup.Count - 1; i >= 0; i--)
            {
                var decorator = m_pendingCleanup[i];

                RowSelectorPane.ClearRowSelector(decorator);

                if (decorator.RowSelector != null)
                {
                    m_recyclingQueue.Enqueue(decorator);
                }
                else
                {
                    // The RowSelector has become useless, so we destroy it.
                    this.InternalChildren.Remove(decorator);
                }
            }

            m_pendingCleanup.Clear();
        }