How to apply Foreground Color for Disable (IsEnabled=False) Records in xamdatagrid
I am using following code is enabled working fine but foreground color not applied for records
<igDP:XamDataGrid Name="XamDataGridSqlViews" GroupByAreaLocation="None" IsSynchronizedWithCurrentItem="True">
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="BorderThickness" Value="1,0,1,1"/>
<Setter Property="BorderBrush" Value="LightGray"/>
</Style>
<Style TargetType="{x:Type igDP:DataRecordCellArea}">
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="Black" />
<Setter Property="BackgroundHover" Value="AliceBlue"/>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.IsMandatory}" Value="True">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
<Setter Property="Foreground" Value="Red"/>
</Style.Triggers>
</igDP:XamDataGrid.Resources>
</igDP:XamDataGrid>
Hello Koteswara,
Thank you for your post. I have been looking into it and I can say that when you set the DataRecordCellArea’s IsEnabled Property to false, the style that is applied overrides the Foreground. In order to set the foreground to a color you want you should create a Style for the Editor that is inside the CellValuePresenter and add a similar Trigger. I created a sample project for you showing how to do so. I can also say that you should create similar Style for all kind of Editors that your XamDataGrid will use, in my case this is only XamNumericEditor. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Foreground color applied successfully . but when I check the checkbox that record also disabled.
that is not my requirement.
mandatory always disabled.
and others always enabled
Please send solution ASAP
Hi Stefan,
No more arguments
Its working fine
Thank you very much
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.