Creating a dialog box
A dialog box is a Window
that is typically used to get some data from the user, before some operation can proceed. This is sometimes referred to as a modal window (as opposed to modeless, or non-modal). In this recipe, we'll take a look at how to create and manage such a dialog box.
Getting ready
Make sure Visual Studio is up and running.
How to do it...
We'll create a dialog box that's invoked from the main window to request some information from the user:
- Create a new WPF application named
CH05.Dialogs
. - Add a new
Window
namedDetailsDialog.xaml
(aDetailsDialog
class is created). - Visual Studio opens
DetailsDialog.xaml
. Set someWindow
properties:FontSize
to16
,ResizeMode
toNoResize
,SizeToContent
toHeight
, and make sure the ...
Get Windows Presentation Foundation 4.5 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.