Is there a way to declare a Property/DependencyProperty to use TwoWay binding by default if its bound?

.net, binding, user-controls, wpf

Solution

When you declare property, use `FrameworkPropertyMetadataOptions.BindsTwoWayByDefault`.

public DependencyProperty SomeProperty =
    DependencyProperty.Register("Some", typeof(bool), typeof(Window1),
        new FrameworkPropertyMetadata(default(bool),
            FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));

Problem

Controls like the `TextBox` use `TwoWay` Binding by default ``` <TextBox Text="{Binding Text1}" /> ``` However with Custom User Controls, I will need something like ``` <local:UserControl1 Text="{Binding Text1, Mode=TwoWay}" /> ``` Is there a way I can set bindings on a property to use TwoWay Bindings by default?

Original source