No path is too difficult. No destination is too far !
How to open popup in wpf?
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
}
| Print article | This entry was posted by Ashish Sehajpal on February 16, 2010 at 5:04 pm, and is filed under Development. Follow any responses to this post through RSS 2.0. Both comments and pings are currently closed. |
Comments are closed.
about 1 year ago
Wow this is a great resource.. I’m enjoying it.. good article