Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

CurrentDialogService

  • 2 minutes to read

The CurrentDialogService allows you to control the associated dialog window and specify the dialog result in the Close method at the View Model level. The CurrentDialogService implements the ICurrentDialogService interface.

The table below lists the Close method overloads:

Method Action
Close(MessageResult dialogResult) Closes the associated dialog window with a specified result of the MessageResult type
Close(UICommand dialogResult) Closes the associated dialog window with a specified result of the UICommand type and invokes UICommand.Command. You can use only one of the UICommands that were initially passed to the dialog service in the ShowDialog method.

#Example

View Example

<UserControl
    x:Class="DialogServiceExample.Views.SimpleDialogView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm">

    <dxmvvm:Interaction.Behaviors>
        <dx:CurrentDialogService />
    </dxmvvm:Interaction.Behaviors>

    <StackPanel>
        <ComboBox SelectedItem="{Binding DialogResult}">
            <ComboBox.Items>
                <dxmvvm:MessageResult>Yes</dxmvvm:MessageResult>
                <dxmvvm:MessageResult>No</dxmvvm:MessageResult>
                <dxmvvm:MessageResult>Cancel</dxmvvm:MessageResult>
            </ComboBox.Items>
        </ComboBox>
        <Button Command="{Binding CloseCommand}" Content="Close the dialog from the dialog view model" />
    </StackPanel>

</UserControl>
See Also