Simon D.
Simon D.

Reputation: 4481

How to manage default WPF-databinding behavior for certain

It's easy in WPF to define styles that apply by default to each TextBox, for example.

But these styles and ControlTemplates can not influence the default settings of my bindings, e.g. I want

<TextBox Text="{Binding}" />

to behave like

<TextBox Text="{Binding UpdateSourceTrigger=PropertyChanged}" />

by default.

Also, if I bind the TextBox.Text to a nullable numeric property, I would like to have TargetNullValue='' in the binding, and maybe always say ValidateOnDataErrors=True...

Have you seen a nice way to manage such default behaviors?

Upvotes: 1

Views: 89

Answers (1)

VidasV
VidasV

Reputation: 4895

I suggest you derive from the default binding and inplement everything you want in your custom class. THere is no other way probably.

Upvotes: 2

Related Questions