How do you display a custom UserControl
as a dialog in C#/WPF (.NET 3.5)?
Place it in a Window and call Window.ShowDialog. (Also, add references to: PresentationCore, WindowsBase and PresentationFramework if you have not already done so.)
private void Button1_Click(object sender, EventArgs e) { Window window = new Window { Title = "My User Control Dialog", Content = new MyUserControl() }; window.ShowDialog(); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With