PasswordInputPrompt

Overview

Basically PasswordInputPrompt is an UI component that derives from the toolkit`s UserPrompt class . As its name says it is a kind of extended popup that prompt user to enter password input. As a result the entered text is not visible, only password characters that represents the text are displayed.


Getting Started

To begin using PasswordInputPrompt first add a reference to the Coding4Fun.Phone.Controls.dll assembly.

Creating PasswordInputPrompt:

C#:
   PasswordInputPrompt passwordInput = new PasswordInputPrompt();
    passwordInput.Title = "Basic PasswordInputPrompt";
    passwordInput.Message = "Please Enter Password!";
    
    passwordInput.Completed += input_Completed;
    passwordInput.Show();

void input_Completed(object sender, PopUpEventArgs<string, PopUpResult> e)
{
    //add some code here
}

Key Features

PasswordInputPrompt exposes the following properties that can be used to customize its content:
  • ActionPopUpButtons
  • IsAppBarVisible
  • IsCancelVisible
  • Message
  • Title
  • Value
  • Overlay
  • HasGesturesDisabled

NOTE: What is the HasGesturesDisabled property? : With the current Gesture Service in the Silverlight Toolkit (Feb 2011 release), if two controls are overlapped and the bottom control has a listener attached, events will still bubble through with no way to cancel it without putting on a listener. In a control that is called PopUp, it is self defeating to have this bubble through effect happening. If the SL toolkit corrects the behavior, we’ll remove the HasGesturesDisabled property as it would no longer be needed. This would also remove the dependency on the Silverlight Toolkit.

You can show PasswordInputPrompt using its Show() method.
When the PasswordInputPrompt popup is closed the Completed event is fired.

Example1:
PasswordInputPrompt passwordInput = new PasswordInputPrompt
    {
        Title = "Simple usage",
        Message = "Please Enter Password!",
    };
 
    passwordInput.Show();


Example2:
 PasswordInputPrompt passwordInput = new PasswordInputPrompt
    {
        Title = "PasswordInput with Cancel btn",
        Message = "Please Enter Password or press Cancel!",
        IsCancelVisible = true
    };
 
    passwordInput.Show();


Example3:
    PasswordInputPrompt passwordInput = new PasswordInputPrompt
    {
        Title = "PasswordInput with Colors",
        Message = "Please Enter Password!",
        Background = new SolidColorBrush(Colors.Gray),
	
        // Background = new SolidColorBrush(Colors.Purple),
        Foreground = new SolidColorBrush(Color.FromArgb(255, 132, 247, 255))
    };
 
    passwordInput.Show();


Example4:
PasswordInputPrompt passwordInput;
private void btnAddCustomButton_Click(object sender, RoutedEventArgs e)
{
    passwordInput = new PasswordInputPrompt();
    Button customButton = new Button() { Content = "Custom Button" };
    customButton.Click += new RoutedEventHandler(customButton_Click);
    passwordInput.ActionPopUpButtons.Add(customButton);
 
    passwordInput.Show();
}

void customButton_Click(object sender, RoutedEventArgs e)
{
    //do something here
    this.passwordInput.Background = new SolidColorBrush(Colors.Green);
}


Example5:
var passwordInput = new PasswordInputPrompt
    {
        Title = "PasswordInput with Changed Overlay Color",
        Message = "Please Enter Password!",
        Overlay = new SolidColorBrush(Color.FromArgb(200, 132, 247, 255))
    };
 
    passwordInput.Show();


Example6:
PasswordInputPrompt passwordInput = new PasswordInputPrompt();
    passwordInput.Value = "some value";
  
    passwordInput.Show();


Example7:
var passwordInput = new PasswordInputPrompt
    {
        Title = "Appbar Visibility Test",
        Message = "Please Enter Password!",
        IsAppBarVisible = true
    };
 
    passwordInput.Show();

Last edited May 3, 2011 at 3:43 PM by WinPhoneGeek, version 1

Comments

No comments yet.