void OnCustomCellAppearance(object sender, PivotCustomCellAppearanceEventArgs e)
        {
            bool columnSelected = e.RowIndex == pivotGrid.FocusedCell.Y;
            bool rowSelected    = e.ColumnIndex == pivotGrid.FocusedCell.X;

            if (columnSelected && !rowSelected || !columnSelected && rowSelected)
            {
                CellMode mode = CellMode.Selected;
                if (e.RowValueType > 0 || e.ColumnValueType > 0)
                {
                    mode = mode | CellMode.Tolal;
                }
                e.Background = GetActualCellBackgroundBrush(mode);
                e.Foreground = GetActualCellForegroundBrush(mode);
            }
        }
예제 #2
0
 void OnCustomAppearance(object sender, PivotCustomCellAppearanceEventArgs e)
 {
     if (!(e.Value is decimal))
     {
         return;
     }
     if (e.DataField.Equals(fieldQuantity1))
     {
         if ((decimal)e.Value >= 0)
         {
             e.Foreground = new SolidColorBrush(Colors.Blue);
         }
         else
         {
             e.Foreground = new SolidColorBrush(Colors.Red);
         }
     }
 }
        private void PivotDgProjectPlanning_CustomCellAppearance(object sender, PivotCustomCellAppearanceEventArgs e)
        {
            var name = e.DataField.Name;

            if (name == "fieldPercentage")
            {
                if (Convert.ToDouble(e.Value) < -20.00)
                {
                    e.Background = new SolidColorBrush(Colors.LightPink);
                }
                else if (Convert.ToDouble(e.Value) > 20.00)
                {
                    e.Background = new SolidColorBrush(Colors.LightYellow);
                }
                else if (Convert.ToDouble(e.Value) >= -20.00 || Convert.ToDouble(e.Value) <= 20.00)
                {
                    e.Background = new SolidColorBrush(Colors.LightGreen);
                }
            }
        }
        // Handles the CustomCellAppearance event. Sets the current cell's foreground color
        // to a color generated in a custom manner.
        void OnCustomAppearance(object sender, PivotCustomCellAppearanceEventArgs e)
        {
            if (!(e.Value is decimal))
            {
                return;
            }
            decimal value        = (decimal)e.Value;
            bool    isGrandTotal = IsGrandTotal(e);

            if (IsValueNotFit(value, isGrandTotal))
            {
                ResetMaxMin();
            }
            EnsureMaxMin();
            if (IsValueNotFit(value, isGrandTotal))
            {
                return;
            }
            e.Foreground =
                new SolidColorBrush(GetColorByValue(value, IsGrandTotal(e)));
        }