Take the 2-minute tour ×

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?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

When you declare property, use FrameworkPropertyMetadataOptions.BindsTwoWayByDefault.

public DependencyProperty SomeProperty =
    DependencyProperty.Register("Some", typeof(bool), typeof(Window1),
        new FrameworkPropertyMetadata(default(bool),
share|improve this answer
add comment

Your Answer


