I'm using a XamDataGrid with the Office2013 theme. When selecting multiple records, the record selector column has the blue background only for the last record selected -- all the others have a white background.
I would like to override the style such that the record selector has the same background as the fields when the row is selected.
I have tried this, but it doesn't seem to work:
<Style TargetType="{x:Type igDP:RecordSelector}" BasedOn="{x:Static igThemes:DataPresenterOffice2013.RecordSelector}"><Setter Property="Background" Value="White" /> <Style.Triggers> <DataTrigger Binding="{Binding Record.IsSelected}" Value="False"> <Setter Property="Background" Value="White" /> </DataTrigger> <DataTrigger Binding="{Binding Record.IsSelected}" Value="True"> <Setter Property="Background" Value="Red" /> </DataTrigger> </Style.Triggers> </Style>
Hello Walter,
Thank you for your post.
The behavior that you are currently seeing is the expected behavior of the RecordSelector in the XamDataGrid. The reason, is because the records in the grid have two "selection" states: Selected and Active. Currently, the behavior of the RecordSelector is that it will be highlighted if the corresponding record is Active, and only a single record can be active at the same time. If you select multiple records, the active one is the one you have most recently selected.
This highlighting is not controlled by the Background property of the RecordSelector, though. It is controlled by a couple of Rectangles in the template for the RecordSelector, which are highlighted in a trigger for that template when the corresponding record gets activated or deactivated.
To get the RecordSelector to remain highlighted for the selected records, I would recommend including the default style for it, which for Office2013, can commonly be found in the DataPresenterOffice2013_Express.xaml file at this directory: C:\Program Files (x86)\Infragistics\<your version here>\WPF\DefaultStyles\DataPresenter. In the default template, there are a couple of EventTriggers for the routed events of RecordSelector.Activated and RecordSelector.Deactivated. I propose that you remove these, and replace them with a DataTrigger that binds to IsSelected = true. Then, you can add the RecordActiveTrue storyboard from the RecordSelector.Activated event trigger to the DataTrigger.EnterActions, and the RecordActiveFalse storyboard from the RecordSelector.Deactivated event trigger to the DataTrigger.ExitActions.
I have attached a sample project to demonstrate the above. I hope this helps you.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support