Skip to main content
A newer version of this page is available. .

Attaching MVVM Behaviors and Services

To attach the components from DevExpress MVVM Framework (behaviors and services), press the SmartTagCogWheelButton button, then select the required behavior or service from the Add Behavior or Add Service menu.


The list of available behaviors and services can differ depending on which element is selected.

To add a behavior (for instance, the EventToCommand) open the Smart Tag for the window (click the SmartTagButton button) and press Add Behavior.


Click the EventToCommand item and select the newly added element in the list of behaviors. Set the required properties.


As a result, Smart Tag will generate the following code in XAML.

    DataContext="{dxmvvm:ViewModelSource Type={x:Type ViewModel:MainViewModel}}">
        <dxmvvm:EventToCommand Command="{Binding OnLoadedCommand}" EventName="Loaded"/>

A similar code can be used to manually attach other behaviors from the DevExpress MVVM Framework.