DataGrid row styling based on a bound item's property value #107
-
Hi, What would be the best way to set a DataGrid row's styling if one of it's bound item's property is of a certain value. To be more precice, I have a DataGrid bound to a AvaloniaList of Account objects which has a property named AccountType. I'd like rows that have AccountType = 5 to be bold or perhaps insert a string infront of one of the cell's text for them to stand out from the regular accounttypes. I've extended DataTriggerBehavior and set breakpoints to track what is getting passed to OnValueChanged() and can't figure out the proper <i:Interaction.Behaviors> structure in the xaml in order to evaluate Account.AccountType in the OnValueChanged() when binding the items to the datagrid. Could someone with more AvaloniaBehaviors experience give me a hand please? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's not AvaloniaBehaviors related answer, but you could subscribe on DataGrid.LoadingRow event and set row's property or a style class depending on a data context. |
Beta Was this translation helpful? Give feedback.
It's not AvaloniaBehaviors related answer, but you could subscribe on DataGrid.LoadingRow event and set row's property or a style class depending on a data context.