ReadOnlyDependencyPropertyBindingBehavior

The ReadOnlyDependencyPropertyBindingBehavior allows you to bind read-only dependency and attached properties to ViewModel properties.

To bind a read-only dependency property, attach the behavior to the target control and then choose one of the following:

  1. Specify the property name using the behavior's Property.

    <TreeView>
        <dxmvvm:Interaction.Behaviors>
            <dxmvvm:ReadOnlyDependencyPropertyBindingBehavior Property="SelectedItem" />
        </dxmvvm:Interaction.Behaviors>
    
  2. Specify the property name using the behavior's DependencyProperty.

    <TreeView>
        <dxmvvm:Interaction.Behaviors>
            <dxmvvm:ReadOnlyDependencyPropertyBindingBehavior DependencyProperty="{x:Static TreeView.SelectedItemProperty}" />
        </dxmvvm:Interaction.Behaviors>
    
TIP

You can also use the DependencyProperty to bind attached properties.

Once you have specified the property name with either of the two methods, use the the behavior's Binding property to specify a binding to the target ViewModel's property .

View Example