DependencyPropertyBehavior Class
Allows you to bind a ViewModel property to a control’s non-dependency property.
Namespace: DevExpress.Mvvm.UI
Assembly: DevExpress.Xpf.Core.v24.1.dll
NuGet Package: DevExpress.Wpf.Core
Declaration
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; }
}
}
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