I would like to put my RowValidationRules class as a resource and then reference the Key on the datagrid but I’m not 100% sure on how to get there.
<Window.Resources><helper:AccountRoleValidationRule x:Key="MyAccountRoleValidator" /></Window.Resources>
<DataGrid.RowValidationRules><helper:AccountRoleValidationRule ValidationStep="UpdatedValue" /></DataGrid.RowValidationRules>
I would like to do something like <DataGrid RowValidationRules="{StaticResource MyAccountRoleValidator}" /> but I get ‘RowValidationRules’ property is read-only and cannot be set from markup.
In the end I’m going to use FindResource(“MyAccountRoleValidator”) from my .xaml.vb file to check the validation result on my CanSave() ICommand.
Try element syntax:
(
StaticResourcewill not show up in the not so intelligent IntelliSense in VS, but when it is written out the property will)