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
60
CellValuePresenter background overrides active, selected and hover backgrounds.
posted

I'm having an issues setting background color for specific column. I also want to make all other colors override that color, i.e. active, selected, hover colors. I'm able to override some of them using triggers, but not everything.

Here is the sample of the code where hover color for record is not overridden:

 

    <igWPF:XamDataGrid DataSource="{Binding PersonViewModels}">

      <igWPF:XamDataGrid.Resources>

        <Style TargetType="{x:Type igWPF:DataRecordCellArea}">

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

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

          <Setter Property ="BackgroundHover" Value="SkyBlue"/>

        </Style>

        <Style x:Key="DefaultRow" TargetType="{x:Type igWPF:CellValuePresenter}">

          <Setter Property="BackgroundSelected" Value="DarkBlue"/>

        </Style>

        <Style TargetType="{x:Type igWPF:CellValuePresenter}" BasedOn="{StaticResource DefaultRow}"/>

        <Style x:Key="BrownRow" TargetType="{x:Type igWPF:CellValuePresenter}" BasedOn="{StaticResource DefaultRow}">

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

          <Setter Property="BackgroundHover" Value="Brown"/>

          <Style.Triggers>

            <DataTrigger Binding="{Binding Path=IsActive}" Value="True">

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

            </DataTrigger>

          </Style.Triggers>

        </Style>

      </igWPF:XamDataGrid.Resources>

      <igWPF:XamDataGrid.FieldLayouts>

        <igWPF:FieldLayout>

          <igWPF:FieldLayout.Fields>

            <igWPF:Field Name="FirstName" Label="First Name"/>

            <igWPF:Field Name="LastName" Label="Last Name"/>

            <igWPF:Field Name="Age" Label="Age">

              <igWPF:Field.Settings>

                <igWPF:FieldSettings CellValuePresenterStyle="{StaticResource BrownRow}" />

              </igWPF:Field.Settings>

            </igWPF:Field>

          </igWPF:FieldLayout.Fields>

        </igWPF:FieldLayout>

      </igWPF:XamDataGrid.FieldLayouts>

      <igWPF:XamDataGrid.FieldLayoutSettings>

        <igWPF:FieldLayoutSettings AutoGenerateFields="False" SelectionTypeCell="Extended" SelectionTypeRecord="Single" SelectionTypeField="Single"/>

      </igWPF:XamDataGrid.FieldLayoutSettings>

    </igWPF:XamDataGrid>

 

I've tried different options, but still wasn't able to handle all cases properly.  Could anybody help me with this?

Parents Reply Children
No Data