Hi,
I need to change the text color on hover for entire row; is it possible? I have tried different styles but couldn't get it working properly. it works seperately for each cell; means if I hover on a cell, the text changes color. But I want to change the color of text of entire row on mouse over in the same way as we hover and DataRecordCell area changes color of entire row.
If someone knows how can we do it, please let me know.
Thanks
Adeel
You can change the text color (and much more) of entire row on mouse hover. Use the following style.
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:DataRecordCellArea}">
<Setter Property="ForegroundHoverStyle">
<Setter.Value>
<Style>
<Setter Property="TextBlock.FontFamily" Value="Arial" />
<Setter Property="TextBlock.FontSize" Value="15" />
<Setter Property="TextBlock.FontWeight" Value="Bold"/>
<Setter Property="TextBlock.Foreground" Value="Red"/>
</Style>
</Setter.Value>
</Setter>
</igDP:XamDataGrid.Resources>
Best Regards,
I have tried implementing this,and does kind of work, except the text color is not changed to Red but the font size and weight is updated. Is there something i am missing, here is my code:
<Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igDP="http://infragistics.com/DataPresenter" Title="Window1" Height="336" Width="619"> <Grid> <igDP:XamDataGrid BindToSampleData="True"> <igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:DataRecordCellArea}"> <Setter Property="ForegroundHoverStyle"> <Setter.Value> <Style> <Setter Property="TextBlock.FontFamily" Value="Arial" /> <Setter Property="TextBlock.FontSize" Value="15" /> <Setter Property="TextBlock.FontWeight" Value="Bold"/> <Setter Property="TextBlock.Foreground" Value="Red"/> </Style> </Setter.Value> </Setter> <Setter Property="BackgroundHover"> <Setter.Value> <LinearGradientBrush EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#FF2225FF" Offset="0"/> <GradientStop Color="#FFB9D8FF" Offset="1"/> </LinearGradientBrush> </Setter.Value> </Setter> <Setter Property="BorderHoverBrush" Value="#FF000000"/> </Style> </igDP:XamDataGrid.Resources> </igDP:XamDataGrid> </Grid></Window>
Hi rishi_invar,
We’ve taken a look at this here and there appears to be some strange things happening in the WPF Frameworkwhen it comes to resolving inherited property settings (TextBlock.Foreground in this case). The style you have set up seems perfectly reasonable but that is not having the desired effect due to thisWPF framework weirdness.
What you can do to workaround this issue is to use the solution suggested by Joe Modica and Andrew Smith.Special thanks to both of them for the suggested solution.
<Style TargetType="{x:Type igDP:CellValuePresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordCellArea}}}" Value="True"> <Setter Property="ForegroundStyle"> <Setter.Value> <Style> <Setter Property="TextBlock.Foreground" Value="Red"/> </Style> </Setter.Value> </Setter> </DataTrigger> </Style.Triggers></Style>
The attached TextBlockForegroundPropertyIssueSolution sample application contains the full solution implementation.
Best Regards,Yanko
Why is this happening and how can we avoid this?
Regards,
Hello Adeel,
You can see the default styles of all the controls that we ship in the local directory "C:\Program Files\Infragistics\NetAdvantage for WPF 2008 Vol. 2\DefaultStyles" on your computer. You can start building your own custom style based on the defaults. The black color is showing because of some of the triggers in the template. To avoid this you have to re-template the CellValuePresenter.
Hope this helps.
Alex.
I got the opposite of this issue, the foreground of the entire row changes to black automatically when mouse is over that row. It's not my intention to have this behavior. Is it possible to get rid of it? Thanks!
I Have been struggling wtih this issue as well. I just want the text color in all fields of the "Moused Over" row to remain what they were when the Mouse was not over. I have spent far to much time trying to accomplish this. Any help would be appreciated.