All docs
V21.2
21.2
21.1
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

DependencyPropertyBehavior Class

Allows you to bind a ViewModel property to a control’s non-dependency property.

Namespace: DevExpress.Mvvm.UI

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

Declaration

public class DependencyPropertyBehavior :
    Behavior<DependencyObject>

Remarks

To bind a ViewModel property to a control’s non-dependency property, specify the following DependencyPropertyBehavior properties:

Property Description
Binding Gets or sets the binding that should be applied to the specified property. This is a dependency property.
EventName Gets or sets the name of the event the DependencyPropertyBehavior handles to update the binding.
PropertyName Gets or sets a control’s property name (the binding’s target).

The following code sample binds the ViewModel’s SelectedTextBoxText property to the TextBox.SelectedText non-dependency property:

<UserControl x:Class="Example.View.MainView"
<!-- ... -->
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
    <!-- ... -->
        <StackPanel Orientation="Horizontal" VerticalAlignment="Top">
            <!--The TextBox.SelectedText property is not a dependency property-->
            <TextBox Width="200" Text="Select some text in this box">
                <dxmvvm:Interaction.Behaviors>
                    <dxmvvm:DependencyPropertyBehavior PropertyName="SelectedText" EventName="SelectionChanged" Binding="{Binding SelectedTextBoxText, Mode=TwoWay}"/>
                </dxmvvm:Interaction.Behaviors>
            </TextBox>
            <TextBox Width="200" Text="{Binding SelectedTextBoxText}" IsReadOnly="True"/>
        </StackPanel>
        <!-- ... -->
</UserControl>
using DevExpress.Mvvm;

namespace Example.ViewModel {
    public class MainViewModel : ViewModelBase {
        public virtual string SelectedTextBoxText { get; set; }
    }
}

Run Demo: Behaviors Module in the WPF MVVM Demo

View Example: WPF MVVM Framework - Bind a ViewModel's Property to a Control's Non Dependency Property

Inheritance

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