# Services in ViewModelBase Descendants | WPF Controls | DevExpress Documentation

The [ViewModelBase](/WPF/17351/mvvm-framework/viewmodels/viewmodelbase) class implements the **ISupportServices** interface, which maintains the **Services** mechanism. The **ViewModelBase.GetService** method, which employs the ISupportServices interface, allows you to access services registered in a View.

- XAML

<section id="tabpanel_z3FkRBOTwO_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code class="lang-xaml">&lt;UserControl x:Class=&quot;ViewModelBaseSample.View&quot; 
             xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
             xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
             xmlns:ViewModels=&quot;clr-namespace:ViewModelBaseSample.ViewModels&quot; ...&gt; 
    &lt;UserControl.DataContext&gt; 
        &lt;ViewModels:ViewModel/&gt; 
    &lt;/UserControl.DataContext&gt; 
    &lt;dxmvvm:Interaction.Behaviors&gt;
        &lt;dx:DXMessageBoxService/&gt;
    &lt;/dxmvvm:Interaction.Behaviors&gt;
    ...
&lt;/UserControl&gt;
</code></pre></section>

- C#
- VB.NET

<section id="tabpanel_z3FkRBOTwO-1_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code class="lang-csharp">public class ViewModel : ViewModelBase {
    public IMessageBoxService MessageBoxService { get { return GetService&lt;IMessageBoxService&gt;(); } }
}
</code></pre></section>
<section id="tabpanel_z3FkRBOTwO-1_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code class="lang-vb">Public Class ViewModel
    Inherits ViewModelBase
    Public ReadOnly Property MessageBoxService As IMessageBoxService
        Get
            Return GetService(Of IMessageBoxService)()
        End Get
    End Property
End Class
</code></pre></section>

If it is necessary to use several services of the same type, assign the **Name** property for these services and access a specific service by its name.

- XAML

<section id="tabpanel_z3FkRBOTwO-2_tabid-xaml" role="tabpanel" data-tab="tabid-xaml">
<pre><code class="lang-xaml">&lt;UserControl x:Class=&quot;ViewModelBaseSample.View&quot; 
             xmlns:dx=&quot;http://schemas.devexpress.com/winfx/2008/xaml/core&quot;
             xmlns:dxmvvm=&quot;http://schemas.devexpress.com/winfx/2008/xaml/mvvm&quot; 
             xmlns:ViewModels=&quot;clr-namespace:ViewModelBaseSample.ViewModels&quot; ...&gt; 
    &lt;UserControl.DataContext&gt; 
        &lt;ViewModels:ViewModel/&gt; 
    &lt;/UserControl.DataContext&gt; 
    &lt;dxmvvm:Interaction.Behaviors&gt;
        &lt;dx:DXMessageBoxService x:Name=&quot;service1&quot;/&gt;
        &lt;dx:DXMessageBoxService x:Name=&quot;service2&quot;/&gt;
    &lt;/dxmvvm:Interaction.Behaviors&gt;
    ...
&lt;/UserControl&gt;
</code></pre></section>

- C#
- VB.NET

<section id="tabpanel_z3FkRBOTwO-3_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code class="lang-csharp">public class ViewModel : ViewModelBase {
    public IMessageBoxService MessageBoxService1 { get { return GetService&lt;IMessageBoxService&gt;(&quot;service1&quot;); } }
    public IMessageBoxService MessageBoxService2 { get { return GetService&lt;IMessageBoxService&gt;(&quot;service2&quot;); } }
}
</code></pre></section>
<section id="tabpanel_z3FkRBOTwO-3_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code class="lang-vb">Public Class ViewModel
    Inherits ViewModelBase
    Public ReadOnly Property MessageBoxService1 As IMessageBoxService
        Get
            Return GetService(Of IMessageBoxService)(&quot;service1&quot;)
        End Get
    End Property
    Public ReadOnly Property MessageBoxService2 As IMessageBoxService
        Get
            Return GetService(Of IMessageBoxService)(&quot;service2&quot;)
        End Get
    End Property
End Class
</code></pre></section>

View Models can be related to each other with the parent-child relationship. This is achieved with the **ISupportParentViewModel** interface. You can pass the main View Model to the child using the **ISupportParentViewModel.ParentViewModel** property. This allows the child View Model to access Services that are registered for the main View Model. Please review the following topic for more information about this mechanism: [ViewModel relationships (ISupportParentViewModel)](/WPF/17449/mvvm-framework/viewmodels/viewmodel-relationships-isupportparentviewmodel).

Here is an example that demonstrates the use of services when View Models derived from the ViewModelBase class are related to each other with the parent-child relationship: [DXMessageBoxService](/WPF/17415/mvvm-framework/services/predefined-set/message-box-services/dxmessageboxservice).