how to change text (foreground) color at runtime.
Please assist.
Hello Glenn,
Please clarify on which part you need assistance and it would be best if you provide the source code you are trying to achieve this with so we can figure out the problem more easily.
Alex.
Yanko,
I applied your notes and find that only the first column in the grid reflects the color change.
Ideas?
Glenn
Hi,
Thanks. The sample you have given above is working fine. But in my case I want to change the backcolor for a particular row. For an example, in my application I will have an context menu as "Change Background" for each row. Whenever I click the "Change Background" menu for the particular row, I have to change the back color for that particular row. And I want all these Style and Data Trigger Setting to be done in the code and not in the xaml because I am going to create the xamdatagrid in the code only and not in xaml.
Is this possible? I am expecting a quick reply because I am lagging a lot because of this issue Thanks in advance.
Thanks and Regards
Florence
You can set both the background color and the foreground color of a particular row at runtime by using style triggers.
Here is how you can do it in Xaml.
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsActive}" Value="True">
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
<Setter Property="Foreground" Value="DarkRed"/>
</Style.Triggers>
</Style>
</igDP:XamDataGrid.Resources>
After running the application just select a row of the xamDataGrid to fire the triggers.
Best Regards,
Look at the used style which allows you to change the text color of entire row on mouse hover. You can use the idea with slight modification.
http://forums.infragistics.com/forums/t/7640.aspx
Yanko