void ShowPopupTextDialog()
{
if (_processResult.Text == null || _processResult.Text.Length == 0)
return;
const int dialogHeight = 300;
const int borderThickness = 7;
//Stack panel with a black background.
StackPanel panelConfirmation = new StackPanel();
panelConfirmation.Background = new SolidColorBrush(Colors.Black);
panelConfirmation.Width = Application.Current.Host.Content.ActualWidth - borderThickness*2;
panelConfirmation.Height = dialogHeight;
//Create a white border.
Border border = new Border();
border.BorderBrush = new SolidColorBrush(Colors.White);
border.BorderThickness = new Thickness(borderThickness);
//Create a close button to exit popup.
Button cancelButton = new Button();
cancelButton.Content = "Close";
cancelButton.Margin = new Thickness(5.0);
cancelButton.Height = 120;
cancelButton.Click += new RoutedEventHandler(cancel_ConfirmationClick);
Button okButton = new Button();
okButton.Content = "Done";
okButton.Margin = new Thickness(5.0);
okButton.Height = 120;
okButton.Click += new RoutedEventHandler(ok_ConfirmationClick);
//Create helper text
TextBlock textblockHelp = new TextBlock();
textblockHelp.FontSize = 24;
textblockHelp.TextAlignment = TextAlignment.Center;
textblockHelp.Foreground = new SolidColorBrush(Colors.White);
textblockHelp.TextWrapping = TextWrapping.Wrap;
textblockHelp.Text = "Barcode: " + _processResult.Text;
textblockHelp.Margin = new Thickness(5.0);
//Add controls to stack panel
panelConfirmation.Children.Add(textblockHelp);
panelConfirmation.Children.Add(okButton);
panelConfirmation.Children.Add(cancelButton);
border.Child = panelConfirmation;
// Set the Child property of Popup to the border
// that contains a stackpanel, textblock and button.
_scanConfirmation.Child = border;
// Set where the popup will show up on the screen.
_scanConfirmation.VerticalOffset = Application.Current.Host.Content.ActualHeight - dialogHeight - borderThickness*2;
_scanConfirmation.HorizontalOffset = 0;
// Open the popup.
_scanConfirmation.IsOpen = true;
}