[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Collapse]MVVM Framework
  [Expand]View Models
    Getting Started
    Services in ViewModelBase descendants
    Services in POCO objects
    Services in custom ViewModels
    View creation mechanisms
   [Expand]Predefined Set
    How to create a Custom Service
   Data Annotation Attributes
   Weak Event
 [Expand]Controls and Libraries
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to create a Custom Service

Follow the two steps outlined below to create a custom service.

  • Create a service interface that will be available from the View Model layer.
  • Create a ServiceBase descendant (or a ViewServiceBase descendant) that implements the service interface.

The ServiceBase class is descended from the Behavior<FrameworkElement> class. Please review the following documentation topic to learn which properties and methods the Behavior<T> class provides and how to use them when creating a Behavior descendant: How to: Create a Custom Behavior.

The example below demonstrates how to create a custom service (a ServiceBase descendant) that provides the capability to show a message box with text defined in Xaml.

Is this topic helpful?​​​​​​​