<prism:InteractionRequestTrigger..../>
<UserControl x:Class="InteractivityQuickstart.Views.InteractionRequestView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:prism="http://www.codeplex.com/prism" xmlns:views="clr-namespace:InteractivityQuickstart.Views" xmlns:viewModels="clr-namespace:InteractivityQuickstart.ViewModels" mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="600"> <UserControl.DataContext> <viewModels:InteractionRequestViewModel /> </UserControl.DataContext> <i:Interaction.Triggers> <!-- All the InteractionRequestTriggers here subscribe to the corresponding interaction requests through simple bindings --> <!-- In this case all of them raise a PopupWindowAction, but you can use other actions too --> <!-- ERROR IS THIS LINE --> <prism:InteractionRequestTrigger SourceObject="{Binding ConfirmationRequest, Mode=OneWay}"> <!-- This PopupWindowAction does not have a custom view defined, therefore it will try to use a DefaultNotificationWindow --> <!-- which is a window used by default by Prism to shown INotification implementations --> <!-- That window will be show as a modal dialog and centered over this window --> <prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True"/> </prism:InteractionRequestTrigger> <prism:InteractionRequestTrigger SourceObject="{Binding NotificationRequest, Mode=OneWay}"> <!-- This PopupWindowAction does not have a custom view defined, therefore it will try to use a DefaultConfirmationWindow --> <!-- which is a window used by default by Prism to shown IConfirmation implementations --> <!-- That window will be show as a modal dialog and centered over this window --> <prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True"/> </prism:InteractionRequestTrigger> <prism:InteractionRequestTrigger SourceObject="{Binding CustomPopupViewRequest, Mode=OneWay}"> <!-- This PopupWindowAction has a custom view defined. When this action is executed the view will be shown inside a new window --> <!-- Take into account that the view is created only once and will be reused each time the action is executed --> <prism:PopupWindowAction> <prism:PopupWindowAction.WindowContent> <views:CustomPopupView /> </prism:PopupWindowAction.WindowContent> </prism:PopupWindowAction> </prism:InteractionRequestTrigger> <prism:InteractionRequestTrigger SourceObject="{Binding ItemSelectionRequest, Mode=OneWay}"> <!-- This PopupWindowAction has a custom view defined. When this action is executed the view will be shown inside a new window --> <!-- Take into account that the view and its view model are created only once and will be reused each time the action is executed --> <prism:PopupWindowAction> <prism:PopupWindowAction.WindowContent> <views:ItemSelectionView /> </prism:PopupWindowAction.WindowContent> </prism:PopupWindowAction> </prism:InteractionRequestTrigger> </i:Interaction.Triggers> <Grid> <StackPanel> <TextBlock Margin="5" FontSize="24" Foreground="DarkGreen" TextWrapping="Wrap">Interaction Requests</TextBlock> <TextBlock Margin="5" TextWrapping="Wrap">The InteractionRequest and InteractionRequestTriggers classes usually work in pairs like this:</TextBlock> <TextBlock Margin="5,0" TextWrapping="Wrap">The <Bold>InteractionRequest</Bold> goes in the view model and is exposed through a property. When the view model needs to interact with the user, it invokes the Raise method to start the interaction.</TextBlock> <TextBlock Margin="5" TextWrapping="Wrap">The <Bold>InteractionRequestTrigger</Bold> goes in the view and subscribes to the InteractionRequest through bindings. When the interaction is raised it will executes its corresponding actions.</TextBlock> <TextBlock Margin="5" TextWrapping="Wrap">In this Quickstart, we are using <Bold>PopupWindowActions</Bold> to shown popups when an interaction is raised.</TextBlock> <Button AutomationProperties.AutomationId="NotificationButton" x:Name="temp" Margin="5" Content="Raise Default Notification" Command="{Binding RaiseNotificationCommand}" /> <Button AutomationProperties.AutomationId="ConfirmationButton" Margin="5" Content="Raise Default Confirmation" Command="{Binding RaiseConfirmationCommand}" /> <Button AutomationProperties.AutomationId="CustomPopupButton" Margin="5" Content="Raise Custom Popup View Interaction" Command="{Binding RaiseCustomPopupViewCommand}" /> <Button AutomationProperties.AutomationId="ItemSelectionButton" Margin="5" Content="Raise Item Selection Popup" Command="{Binding RaiseItemSelectionCommand}" /> <TextBlock Margin="5" TextWrapping="Wrap"> Each of the following buttons execute a different command in the view model that raise their corresponding interaction request. There is an trigger for each of these buttons that execute a PopupWindowAction with the different settings. </TextBlock> </StackPanel> <TextBlock AutomationProperties.AutomationId="ResultTextBlock" Margin="5" FontWeight="Bold" Foreground="DarkRed" VerticalAlignment="Bottom" Text="{Binding InteractionResultMessage}"/> </Grid> </UserControl>
TriggerBase
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)