Page 147 - DCAP408_WEB_PROGRAMMING
P. 147
Unit 9: Child and Pop Up Windows
After struggling with a navigation issue in my app of when to show/go to/return from the Notes
Settings page that captured the user name and password, I decided to pop up a window on any
page where and when credentials were necessary but not currently known. Since I knew I was
going to add more credential-requiring pages in my app, using a popup allowed me to reduce
my dependency on navigation silliness between the pages, and have a more encapsulated design.
This will show you how to pop up a ChildWindow on the app page to grab the user’s login
credentials. The control allows the old username and password to be passed into the control so
that previous values can appear. The tab order/enter key switches from textbox to textbox to
button.
The sample application included in this post just displays the results on the calling page.
Childwindow Control Reference
The LoginChildWindow inherits from System.Windows.Controls.ChildWindow so you must
add that as a reference.
Loginchildwindow.xaml
<tk:ChildWindow x:Class= “LoginChildWindow.LoginChildWindow”
xmlns=“http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=“http://schemas.microsoft.com/winfx/2006/xaml”
xmlns:d=“http://schemas.microsoft.com/expression/blend/2008”
LOVELY PROFESSIONAL UNIVERSITY 141