Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
760
Conditional formatting - cell border paint issues
posted

Conditional formatting - cell border paint issues

 

I have the following styles defined in my xaml file..

 

   <UserControl.Resources>

            <Style x:Key="redStyleNumber" TargetType="ig:PivotCellControl">

                <Setter Property="Foreground" Value="Red" />

                <Setter Property="HorizontalAlignment" Value="Right" />                

        </Style>

            <Style x:Key="normalStyleNumber" TargetType="ig:PivotCellControl">

                <Setter Property="Foreground" Value="Black" />

            <Setter Property="HorizontalAlignment" Value="Right" />

        </Style>

and using those styles as shown below in codebehind..

 

 private void pivotGrid_CellControlAttached(object sender, Infragistics.Controls.Grids.PivotCellControlAttachedEventArgs e)

        {

            int column = this.pivotGrid.DataColumns.IndexOf(e.Cell.DataColumn);

            int row = this.pivotGrid.DataRows.IndexOf(e.Cell.DataRow);            

            if (this.pivotGrid.DataSource != null && pivotGrid.DataSource.Result != null)

            {

                ICell cellData = this.pivotGrid.DataSource.Result.Cells[row, column];

                if (cellData != null && (cellData.Value is double?))

                {

                    double value = (double)cellData.Value;

                    if (value < 0)

                    {

                        e.Cell.Style = this.Resources["redStyleNumber"] as Style;

                    }

                    else

                    {

                        e.Cell.Style = this.Resources["normalStyleNumber"] as Style;

                    }

                    e.IsDirty = true;

                }

            }

        }     

the problem is... the cell borders are not rendered correctly with this code.. Didn't create a separate sample for this... Hopefully you'll be able to reproduce with the above code..

Parents
No Data
Reply
  • 7922
    Verified Answer
    posted

    Hi

    Please use HorizontalContentAligment instead HorizontalAligment. The meaning of properties are different and it is normal behavior when you use HorizontalAligment

    <Setter Property="HorizontalContentAlignment" Value="Right" />

    Regards
     Todor

Children