Skip to main content
A newer version of this page is available. .
All docs
V20.2

ReadOnlyDependencyPropertyBindingBehavior Class

Namespace: DevExpress.Mvvm.UI

Assembly: DevExpress.Xpf.Core.v20.2.dll

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Core, DevExpress.Wpf.Core

Declaration

public class ReadOnlyDependencyPropertyBindingBehavior :
    Behavior<DependencyObject>

Remarks

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

Inheritance

Object
DispatcherObject
DependencyObject
Freezable
Animatable
DevExpress.Mvvm.UI.Interactivity.AttachableObjectBase
DevExpress.Mvvm.UI.Interactivity.Behavior
DevExpress.Mvvm.UI.Interactivity.Behavior<DependencyObject>
ReadOnlyDependencyPropertyBindingBehavior
See Also