I’m repeating same binding parameters for every textbox and they’re quite long strings (which is not good for many reasons). And I’m wondering if there’s a way to make them shorter?
For instance all my controls on forms are using the following binding template:
Text="{Binding SourceProperty, UpdateSourceTrigger=PropertyChanged,
ValidatesOnExceptions=True, ValidatesOnDataErrors=True,
NotifyOnValidationError=True}"
I’d would like to have something shorter that ideally will take SourceProperty as parameter. Possbly like this:
Text="{MyBinding SourceProperty}"
or
Text="{Binding SourceProperty, Params=MyParams}"
One possible option would be to inherit from Binding and create new markup extension. Did someone tried this?
Any other ideas how to make these repetetive bindings look better?
Your first suspicion is likely correct. A custom mark-up extension might be the best bet. I would check out this article.