ViewModelBase Class
The BindableBase descendant that implements the ISupportUIServices interface and allows you to access UI Services registered within a View.
Namespace: DevExpress.Mvvm
Assembly: DevExpress.WinUI.Mvvm.v22.1.dll
NuGet Package: DevExpress.WinUI
Declaration
Remarks
The ViewModel class implements the ISupportUIServices interface and allows you to access UI Services defined in the view.
The following code sample gets an IMessageBoxService instance that is defined in the view:
<UserControl ...
xmlns:dx="using:DevExpress.WinUI.Core"
xmlns:ViewModel="using:WinUIApp.ViewModels">
<UserControl.DataContext>
<ViewModel:ViewModel/>
</UserControl.DataContext>
<dx:Interaction.Behaviors>
<dx:MessageBoxService/>
</dx:Interaction.Behaviors>
<!-- Registers a service into a specified ViewModel: -->
<dx:Interaction.Behaviors>
<dx:MessageBoxService ServiceClient="{x:Bind ViewModel}"/>
</dx:Interaction.Behaviors>
</UserControl>
public class ViewModel : ViewModelBase {
public IMessageBoxService MessageBoxService => GetUIService<IMessageBoxService>();
}
In the code sample above, the UIServiceBase.ServiceClient property specifies the ViewModel where the service is registered.
Implements
Inheritance
Object
BindableBase
ViewModelBase
See Also