I'm working on an application where a double click on a row in one XamDataGrid (the "SummaryGrid") causes a corresponding grid to be populated below. I want to be able to visually cue the user as to which row is selected in the SummaryGrid, and my idea was to make the first field bold for the current row.
This only works up to a point, though. If you scroll the grid so that the bolded row is no longer visible, then some other rowwill have its first field bolded. For instance, if the top row is selected, as soon as I scroll down one row, making it invisible, the row now visible at the bottom has its first field bolded.
I am getting a handle on the cell value presenter like so: CellValuePresenter.FromRecordAndField((DataRecord)SummaryGrid.Records[0], SummaryGrid.Records[0].FieldLayout.Fields[0]);
I then just set cvp.FontWeight. I am guessing that the cvp is not strictly bound to the record, or I am doing something wrong in how I acquire the cvp. Any tips on fixing this issue, or how I should be programmatically set the font wieght of a cell?
Hello,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post and I suggest you use the following style for the CellValuePresenter of the Field in which you want to have Bold Values:
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="BoldStyle"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=Record.IsSelected}" Value="True"> <Setter Property="TextElement.FontWeight" Value="Bold"/> </DataTrigger> </Style.Triggers> </Style>
Feel free to write me if you have further questions.