Password Box with password changed event : PasswordBox « UI Controls « Silverlight






Password Box with password changed event

Password Box with password changed event
    

<UserControl x:Class='SilverlightApplication3.MainPage'
    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' 
    xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006' 
    mc:Ignorable='d' 
    d:DesignWidth='640' 
    d:DesignHeight='480'>
    <StackPanel x:Name="LayoutRoot" Background="White"> 
        <TextBlock Margin="30,10,0,0" Text="Enter Password" FontWeight="bold"/>
        <PasswordBox x:Name="EnterPassword" 
                     Margin="30,10,0,0" 
                     PasswordChanged="EnterPassword_PasswordChanged" MaxLength="11"
                     Height="25" Width="150" HorizontalAlignment="Left" />
        <TextBlock Text="Display Entered Password" Margin="30,10,0,0" FontWeight="bold"/>
        <TextBox x:Name="DisplayPassword" Margin="30,10,0,0" 
                 HorizontalAlignment="Left" IsReadOnly="True" Height="25"
                 Width="150" />
    </StackPanel>
</UserControl>

//File: Page.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightApplication3
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
        private void EnterPassword_PasswordChanged(object sender,RoutedEventArgs e)
        {
            DisplayPassword.Text = EnterPassword.Password;
        }
    }
}

   
    
    
    
  








Related examples in the same category

1.Password for PasswordBoxPassword for PasswordBox
2.PasswordBox with MarginPasswordBox with Margin
3.Display a Password Entry Box and get the inputDisplay a Password Entry Box and get the input
4.The syntax of the PasswordBox.The syntax of the PasswordBox.