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
175
Foreground color of a row is overridden when hovering the row.
posted

I'm trying to change the Foreground color of a row by adding a style to CellValuePresenter using the following code:

<Style TargetType="{x:Type igDP:CellValuePresenter}" >
        <Setter Property="Foreground" Value="Red/>
</Style>-->

It works fine as long as nothing changes in the row, but whenever I move with the mouse over that row the foreground color changes back to black.

I tried setting the rest of the Foreground properties to null in the same style (ForegroundHover, ForegroundSelected, etc) but it didn't work.

Any Idea?

  • 175
    posted

    Hello... No comments?

  • 27093
    posted

    Hello,

     

    Excuse me for the late reply. I have created a style for the CellValuePresenter for you that sets all the foreground properties and states I could think of:

     

    <SolidColorBrush Color="YellowGreen" x:Key="CVPOverallForeground" />

           

    <Style TargetType="{x:Type igDP:CellValuePresenter}">

        <!--To color -->

        <Setter Property="Foreground" Value="{StaticResource CVPOverallForeground}"/>

        <!--To color on cell activation -->

        <Setter Property="ForegroundActiveStyle">

            <Setter.Value>

                <Style>

                    <Setter Property="TextElement.Foreground" Value="{StaticResource CVPOverallForeground}" />

                </Style>

            </Setter.Value>

        </Setter>

        <!--To color on cell hover-->

        <Setter Property="ForegroundHoverStyle">

            <Setter.Value>

                <Style>

                    <Setter Property="TextElement.Foreground" Value="{StaticResource CVPOverallForeground}" />

                </Style>

            </Setter.Value>

        </Setter>

        <!--To color on cell selection (no hover)-->

        <Setter Property="ForegroundSelectedStyle">

            <Setter.Value>

                <Style>

                    <Setter Property="TextElement.Foreground" Value="{StaticResource CVPOverallForeground}" />

                </Style>

            </Setter.Value>

        </Setter>

        <Style.Triggers>

            <!--To color on record selection-->

            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.IsSelected}" Value="True">

                <Setter Property="ForegroundStyle">

                    <Setter.Value>

                        <Style>

                            <Setter Property="TextElement.Foreground" Value="{StaticResource CVPOverallForeground}" />

                        </Style>

                    </Setter.Value>

                </Setter>

            </DataTrigger>

            <!--To color on record hover (no selection) -->

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

                <Setter Property="ForegroundStyle">

                    <Setter.Value>

                        <Style>

                            <Setter Property="TextElement.Foreground" Value="{StaticResource CVPOverallForeground}" />

                        </Style>

                    </Setter.Value>

                </Setter>

            </Trigger>

        </Style.Triggers>

    </Style>

     

    Please let me know if I have missed out something or if you require any further assistance on the matter.

     

    Sincerely,

    Petar Monov

    Developer Support Engineer

    Infragistics Bulgaria

    www.infragistics.com/support