Last active
August 29, 2015 14:08
-
-
Save dgwaldo/bd087520b219f90a6ce6 to your computer and use it in GitHub Desktop.
Prism Custom PopupWindowAction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<UserControl x:Class="KNE.Athena.Infrastructure.UserControls.NotificationPopupView" | |
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" | |
mc:Ignorable="d" | |
Width="400" | |
Height="180" | |
Name="Root"> | |
<!--The DefaultConfirmationWindow used for a PopupWindowAction in Prism doesn't have Text wrapping. This gives us text wrapping.--> | |
<DockPanel LastChildFill="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> | |
<Button DockPanel.Dock="Bottom" AutomationProperties.AutomationId="NotificationPopupCloseButton" Margin="10" | |
HorizontalAlignment="Right" Width="75" Click="Button_Click">OK</Button> | |
<Grid DockPanel.Dock="Top"> | |
<TextBlock Margin="10,3" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{Binding Content}" /> | |
</Grid> | |
</DockPanel> | |
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- In your view set the WindowContent property to your user control. | |
Don't forget the xaml namespace xmlns : i=http://schemas.microsoft.com/expression/2010/interactivity" | |
--> | |
< i: Interaction.Triggers> | |
< interactionRequest: InteractionRequestTrigger SourceObject ="{Binding NotificationRequest, Mode =OneWay } "> | |
< interactionRequest: PopupWindowAction IsModal= "True" CenterOverAssociatedObject= "True" > | |
< interactionRequest: PopupWindowAction.WindowContent > | |
< userControls: NotificationPopupView /> | |
</ interactionRequest: PopupWindowAction.WindowContent > | |
</ interactionRequest: PopupWindowAction > | |
</ interactionRequest: InteractionRequestTrigger > | |
</ i: Interaction.Triggers> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Interaction logic for UserControl1.xaml | |
/// </summary> | |
public partial class NotificationPopupView : UserControl, IInteractionRequestAware | |
{ | |
public NotificationPopupView() | |
{ | |
InitializeComponent(); | |
} | |
private void Button_Click(object sender, RoutedEventArgs e) | |
{ | |
if (this.FinishInteraction != null) | |
this.FinishInteraction(); | |
} | |
// Both the FinishInteraction and Notification properties will be set by the PopupWindowAction when the Pop-up is shown. | |
public Action FinishInteraction { get; set; } | |
public INotification Notification { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment