Click here to Skip to main content
13,045,019 members (38,850 online)
Click here to Skip to main content

Stats

202K views
8.5K downloads
89 bookmarked
Posted 17 May 2009

WPF Modal Dialog

, 17 Mar 2013
How to set up a modal (blocking) dialog inside a WPF window.
<Window x:Class="Technewlogic.Samples.WpfModalDialog.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:controls="clr-namespace:Technewlogic.Samples.WpfModalDialog"
    Title="MainWindow" Height="300" Width="300">
	
	<Grid>
		<Grid x:Name="ModalDialogParent">
			<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top">
				<TextBox x:Name="MessageTextBox" Text="Hello World!" Margin="3" />
				<Button x:Name="ShowModalDialog" Click="ShowModalDialog_Click"
						Content="Show Modal Dialog" Margin="3" />
				<TextBlock x:Name="ResultText" />
			</StackPanel>
		</Grid>

		<controls:ModalDialog x:Name="ModalDialog" />
	</Grid>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

Share

About the Author

Ronald Schlenker
Software Developer (Senior) www.technewlogic.de
Germany Germany
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170713.1 | Last Updated 18 Mar 2013
Article Copyright 2009 by Ronald Schlenker
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid