No path is too difficult. No destination is too far !
Posts tagged How to open Popup
How to open popup in wpf?
Feb 16th
This is the code to open a popup window in wpf.
We need to create an empty window for popup and we’ll assign the object of the WPF Window to it. In this example we wre trying to open PopupForm.xaml as popup.
private void OpenPopup()
{
var oPopupForm = new ucPopupFormPopup();// create POPUP window
var oWindow = new Window();//setting up its starting position
oWindow.WindowStartupLocation =WindowStartupLocation.CenterScreen;// we can make it available or not in taskbar
oWindow.ShowInTaskbar =false;oWindow.Width = 630;
oWindow.Height = 500;
oWindow.ResizeMode =ResizeMode.NoResize;
oWindow.Title =”Ashish Sehajpal – Trying WPF”;// Access Popup’s Controls
oPopupForm.TextBox1.Text = “Ashish Sehajpal is here.”;// Assign Form to Popup window
oWindow.Content = oPopupForm;// If you need to do some action on popup’s closing
// Assignt the event handler to it
oWindow.Closing += oWindow_Closing;
// it’s time to show POPUP
oWindow.ShowDialog();}
// eventhandler for the popup closeing event
private void oWindow_Closing(object sender, CancelEventArgs e)
{
// do something nice here
}