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
2090
Highlight selected row when
posted

Hello,

I am using xamDataGrid and it does a great job. At the moment I try to optimize the userexperience and make the GUI as clear as possible.

The xamDataGrid shows a list of employees, where the Background of the name is datadriven. When I select one or multiple rows I would like to set the background of the selected rows in a different color. It seems that the Background has a higher priority - it always wins. The background of a selected row in the column RESSOURCEN_NAME is correct when the mouse is over that cell. All other columns work as expected - the don't have additional color settings.

It would be great if there is a way to achive this - or alternativly to show a thick border in a different color on all selected rows.

Thanks

Niko

<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:DataRecordCellArea }" x:Key="HighlightSelection">
 <Setter Property="BackgroundActive" Value="#0CA80E" />
 <Setter Property="BackgroundSelected" Value="#0CA80E" />
 </Style>
</igDP:XamDataGrid.Resources>

<igDP:Field Label="Ressource" Name="RESSOURCEN_NAME" AllowEdit="False">
 <igDP:Field.Settings>
      <igDP:FieldSettings>
       <igDP:FieldSettings.CellValuePresenterStyle>
            <Style TargetType="{x:Type igDP:CellValuePresenter}">
               <!-- There is no difference if I keep the next two lines or not -->
               <Setter Property="BackgroundActive" Value="#0CA80E" />                <Setter Property="BackgroundSelected" Value="#0CA80E" />                <Setter Property="FontStyle" Value="{Binding DataItem.RessourcenFontStyle}" />             <Setter Property="Background" Value="{Binding DataItem.Color}" />           </Style>
      </igDP:FieldSettings.CellValuePresenterStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
Parents
  • 2151
    Offline posted

    Hello Nikolaus,

     

    Thank you for your post.

     

    The style targeting the DataRecordCellArea type will be applied to the rows only if the CellClickAction is set to SelectRecord or if you select records using the record selector on the left side of the xamDataGrid. Also you have to remove the x:Key property.

     

    On the other hand the style targeting the CellValuePresenter type will be applied on the cells under the specific field only and more specific their “BackgroundActive” and “BackgroundSelected” properties will be applied only if you have the CellClickAction set to SelectCell, otherwise cells do not get “selected” at all.

     

    If I understand you correctly you want to have a record selection (not cell selection only) so I made a sample for you showing how to configure the xamDataGrid to show modified selection colors when record selection is enabled. Also the data driven background colorization is still present.

     

    Please do not hesitate to let me know if you have any further questions on this matter.

     

    Sincerely,

    Radko Kolev

    Infragistics Inc.

    www.infragistics.com/support

     

    Different Colors on Record Selection.zip
Reply Children