Hello,
I want to bind my Custom property to IsEnabled property of DataRecord of xamDataGrd.
Is there any way to do this? Can I do it using Style or something?
Thanks & Regards,
Abdi
Hello Abdeali,
You can create a style for DataRecordPresenter in the resources of XamDataGrid and by using a Setter you can bind it’s IsEnabled property to your custom property:
<Style TargetType="{x:Type igWPF:DataRecordPresenter}"> <Setter Property="IsEnabled" Value="{Binding Source={StaticResource vm},Path=Enabled}"/></Style>
I have attached simple project where you can see this approach.
Please let me know if you require any further assistance regarding this matter.
Sincerely, ZhivkoEntry Level Software Developer
Thanks for the reply. I am very close to the solution as per your suggestion. The only issue is I am unable to bind my property (from a collection) in DataTrigger:
<Style TargetType="{x:Type igDP:DataRecordPresenter}"> <Setter Property="IsEnabled" Value="False"/> <Style.Triggers> <DataTrigger Binding="{Binding Record.DataItem.ReReversedTransactionID}" Value="{x:Null}" > <Setter Property="IsEnabled" Value="True"/> </DataTrigger>
</Style.Triggers>
</Style>
Here ReReversedTransactionID is the property i am trying to bind. The row should get enabled when value of this property is null. This style is under the xamDataGrid.Resources. This grid is bind with a DataSource and this property is present in this datasource.
Thanks,