Page 151 - DCAP408_WEB_PROGRAMMING
P. 151
Unit 9: Child and Pop Up Windows
btnLogin_Click(sender, e); Notes
}
}
}
private void txtPassword_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
btnLogin_Click(sender, e);
}
}
private void txtPassword_MouseLeftButtonUp(object sender,
MouseButtonEventArgs e)
{
btnLogin_Click(sender, e);
}
}
}
The validation routines are shallow. Please use them as a starting point for your own app
requirements. The KeyUp and Mouse events are to make sure the enter button moves the cursor
to the next logical place in the child window. It just saves the customer a step.
Main Page’s Calling Code
using System;
using System.Net;
using System.Windows;
using System.Windows.Input;
using Microsoft.Phone.Controls;
namespace LoginChildWindow
{
public partial class MainPage : PhoneApplicationPage
{
public string Username { get; set; }
public string Password { get; set; }
// Constructor
public MainPage()
{
LOVELY PROFESSIONAL UNIVERSITY 145