I'm trying to change the styling of the XamGrid to fit our application and can't find a few things. First, when the mouse is over a cell I'd like to change the foreground color of the entire row to a specific color. I've found where to do it for the cell, but I can't seem to find how to make it apply to the entire row when the mouse is over any cell in that row.
Also, I have a TemplateLayoutColumn that will be used to display additional details about the data record and allow the user to edit a few fields in that section. I'd like to remove the highlighting that is done when you mouse over the expanded area. Which style is that that needs to be overridden?
https://ibb.co/ggUhr5
This is a picture of the section I'm looking for.
Hello Christopher,
You can change the foreground of entire row, when the mouse is over a cell from the same row, by creating a style for CellsPanel. This way you can use a DataTrigger to check whether CellsPanel's IsMouseOver property is equal to true and set the TextElement.Foreground to the color you wish:
<Style TargetType="{x:Type igPrim:CellsPanel}"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=IsMouseOver}" Value="true"> <Setter Property="TextElement.Foreground" Value="Red"/> </DataTrigger> </Style.Triggers></Style>
Regarding your second requirement for removing the highlight from expanded area you can handle the Loaded event of ColumnLayoutTemplateRowCellsPanel by using EventSetter in a Style for this element. Once you handle the event you can access the Rectangle that holds this highlight and set its Opacity to 0, for example:
private void Panel_Loaded(object sender, RoutedEventArgs e){ var rec = Utilities.GetDescendantFromName((sender as ColumnLayoutTemplateRowCellsPanel) as DependencyObject, "AltMouseOver") as Rectangle; if (null != rec) rec.Opacity = 0; }
I have attached a simple sample application, where you can test this approach.
Let me know if you have any questions.
Sincerely,ZhivkoAssociate Software Developer