Beispiel #1
0
        protected override Size ArrangeOverride(Size arrangeSize)
        {
            Size finalSize = base.ArrangeOverride(arrangeSize);

            DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this);

            DataGridControl dataGridControl = (dataGridContext != null)
        ? dataGridContext.DataGridControl
        : null;

            RowSelectorPane rowSelectorPane = null;

            // dataGridControl can be null in design-time
            if (dataGridControl != null)
            {
                TableViewScrollViewer scrollViewer = dataGridControl.ScrollViewer as TableViewScrollViewer;
                rowSelectorPane = (scrollViewer != null) ? scrollViewer.RowSelectorPane : null;
            }

            if (rowSelectorPane == null)
            {
                return(finalSize);
            }

            Visibility rowSelectorPaneVisibility = ( Visibility )rowSelectorPane.GetValue(RowSelectorPane.VisibilityProperty);

            if (rowSelectorPaneVisibility != Visibility.Visible)
            {
                return(finalSize);
            }

            foreach (UIElement child in this.InternalChildren)
            {
                Vector offset      = VisualTreeHelper.GetOffset(child);
                Size   desiredSize = child.DesiredSize;

                rowSelectorPane.SetRowSelectorPosition(child, new Rect(offset.X, offset.Y, desiredSize.Width, desiredSize.Height), this);
            }

            return(finalSize);
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            m_rowSelectorPane = this.Template.FindName("PART_RowSelectorPane", this) as RowSelectorPane;
        }
    public override void OnApplyTemplate()
    {
      base.OnApplyTemplate();

      m_rowSelectorPane = this.Template.FindName( "PART_RowSelectorPane", this ) as RowSelectorPane;
    }