Class DialogViewModel
Base class for dialog box view models.
public class DialogViewModel : ExtendedNotificationObject, INotifyPropertyChanged, IWithDialogResult
- Inheritance
-
NotificationObjectDialogViewModel
- Implements
- Derived
- Inherited Members
-
NotificationObject.PropertyChanged
Properties
CloseInteractionRequest
Gets an interaction request that can be used by the view model to direct the attached view window to close itself.
[CLSCompliant(false)]
public InteractionRequest<Notification> CloseInteractionRequest { get; }
Property Value
- InteractionRequest<Notification>
Examples
The following example demonstrates how to use this property from XAML in a view that is bound to this view model. It requires references to the System.Windows.Interactivity and Microsoft.Practices.Prism.Interactivity assemblies.
<Window
x:Class="WpfApplication.DemoView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:prism="http://www.codeplex.com/prism"
xmlns:apw="clr-namespace:Acuit.Pinpoint.Windows;assembly=Acuit.Pinpoint.Windows"
x:Name="Window"
>
<i:Interaction.Triggers>
<prism:InteractionRequestTrigger SourceObject="{Binding CloseInteractionRequest}">
<apw:CloseWindowAction TargetName="Window" />
</prism:InteractionRequestTrigger>
</i:Interaction.Triggers>
<!-- etc. -->
</Window>
To raise the close request, call the following from the view model:
CloseInteractionRequest.Raise(null);
DialogResult
Gets or sets the dialog result.
public bool DialogResult { get; protected set; }
Property Value
Remarks
This value will be returned from IUserInterfaceService.ShowDialog(Window) and IUserInterfaceService.ShowDialog(Window, object).