Ejemplo n.º 1
0
        private void OnCellMouseEnter(object sender, RoutedEventArgs e)
        {
            Cell cell = (Cell)sender;

            if (cell == null)
            {
                return;
            }

            cell.ToolTip = null;
            double     fitWidth = cell.GetFittedWidth();
            ColumnBase cb       = cell.ParentColumn;

            if (cell.Width < fitWidth)
            {
                if (cell is ColumnManagerCell) // header
                {
                    ColumnManagerCell column = (ColumnManagerCell)cell;

                    column.ToolTip = column.Content.ToString();
                }
                else if (cell is DataCell)
                {
                    cell.ToolTip = Convert.ToString(GetField(cell.ParentRow.DataContext, cb));

                    //EntityBase2 enity = cell.DataContext as EntityBase2;
                    //if (enity != null && cell.Width < fitWidth)
                    //{
                    //    cell.ToolTip = enity.Fields[cell.FieldName].CurrentValue.ToString();
                    //}
                }
            }

            string tip = decoration.GetColumnTooltip(cb.FieldName);

            if (false == string.IsNullOrWhiteSpace(tip))
            {
                if (cell.ToolTip != null)
                {
                    cell.ToolTip += "\n";
                }

                cell.ToolTip += tip;
            }

            // e.Handled = true;
        }
 public ColumnManagerCellAutomationPeer(ColumnManagerCell owner)
     : base(owner)
 {
 }
    private static bool TryHitTestCell( ColumnManagerCell cell, Point point, UIElement dragContainer )
    {
      Row parentRow = cell.ParentRow;

      if( parentRow == null )
        return true;

      FixedCellPanel fixedCellPanel = parentRow.CellsHostPanel as FixedCellPanel;

      if( fixedCellPanel == null )
        return true;

      Decorator scrollingCellsDecorator = fixedCellPanel.ScrollingCellsDecorator;

      if( !scrollingCellsDecorator.IsAncestorOf( cell ) )
        return true;

      Point cellPoint = cell.TranslatePoint( ColumnReorderingDragSourceManager.EmptyPoint, dragContainer );

      Rect cellRect = new Rect( cellPoint.X, cellPoint.Y, cell.ActualWidth, cell.ActualHeight );

      Point scrollingCellsDecoratorPoint = scrollingCellsDecorator.TranslatePoint( ColumnReorderingDragSourceManager.EmptyPoint, dragContainer );

      Rect scrollingCellsDecoratorRect = new Rect( scrollingCellsDecoratorPoint.X, scrollingCellsDecoratorPoint.Y, scrollingCellsDecorator.ActualWidth, scrollingCellsDecorator.ActualHeight );

      if( !cellRect.IntersectsWith( scrollingCellsDecoratorRect ) )
      {
        return false;
      }
      else if( !scrollingCellsDecoratorRect.Contains( point ) )
      {
        return false;
      }

      return true;
    }
    private void SetPopupDragAdorner( ColumnManagerCell columnManagerCell )
    {
      if( columnManagerCell == null )
        return;

      if( m_popupDraggedElementAdorner != null )
      {
        this.AdornerLayerInsideDragContainer.Remove( m_popupDraggedElementAdorner );
        m_popupDraggedElementAdorner = null;
      }

      // Get the Rect for the DataGridControl
      DataGridControl dataGridControl = this.DraggedDataGridContext.DataGridControl;

      Rect dataGridControlRect = new Rect( 0d, 0d, dataGridControl.ActualWidth, dataGridControl.ActualHeight );

      Point elementToDataGridControl = columnManagerCell.TranslatePoint( ColumnReorderingDragSourceManager.EmptyPoint, dataGridControl );

      // Get the Rect for the element that request a ghost
      Rect elementRect = new Rect( elementToDataGridControl, columnManagerCell.RenderSize );

      // This is a special case with the current Element that is always be layouted, but can be out of view
      if( !elementRect.IntersectsWith( dataGridControlRect ) )
        return;

      AnimatedDraggedElementAdorner adorner = new AnimatedDraggedElementAdorner( columnManagerCell, this.AdornerLayerInsideDragContainer, true );

      adorner.AdornedElementImage.Opacity = 0d;

      this.ApplyContainerClip( adorner );

      this.AdornerLayerInsideDragContainer.Add( adorner );

      m_popupDraggedElementAdorner = adorner;
    }
 public ColumnManagerCellAutomationPeer( ColumnManagerCell owner )
   : base( owner )
 {
 }