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
935
Background Foreground when editing a cell
posted

I want to set custom foreground and background when editing a cell. Right now have a value that sets the background and foreground through a value converter to different values depending on the value of a specific field. In particular I have a special color combination for when the default value is being used. Unfortunately the colors are not easy to see when changing this value, and do not update to the non-default valued until the cell value is changed.

  • 35319
    posted

    Hello,

     

    I am just checking if you require any further assistance on the matter.

  • 35319
    posted

    Hello,

     

    Thank you for your post. The easiest way to change the background and foreground of the cell when it is in edit mode is to define styles for its editor like e.g. :

     

    <Style TargetType="Editors:XamTextEditor">

                <Style.Triggers>

                    <Trigger Property="IsInEditMode" Value="True">

                        <Setter Property="Background" Value="Yellow"/>

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

                    </Trigger>

                </Style.Triggers>

            </Style>

     

            <Style TargetType="Editors:XamCurrencyEditor">

                <Style.Triggers>

                    <Trigger Property="IsInEditMode" Value="True">

                        <Setter Property="Background" Value="Green"/>

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

                    </Trigger>

                </Style.Triggers>

            </Style>

     

            <Style TargetType="Editors:XamNumericEditor">

                <Style.Triggers>

                    <Trigger Property="IsInEditMode" Value="True">

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

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

                    </Trigger>

                </Style.Triggers>

            </Style>

     

    For more information regarding editors in the XamDataGrid, you can look into the following link :

     

    http://help.infragistics.com/NetAdvantage/WPF/2012.2/CLR4.0/?page=xamData_Default_Editor_Types_for_Different_Data_Types.html

     

    If you need any further assistance on this matter, feel free to ask.