[MainPage.xaml]


<UserControl x:Class="RiaPasswordBox.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:DesignHeight="300" d:DesignWidth="400">

 

    <Grid x:Name="LayoutRoot" Background="White">

        <StackPanel x:Name="myStackPanel">

            <PasswordBox PasswordChar="*" Foreground="Red"></PasswordBox>

 

        </StackPanel>

    </Grid>

</UserControl>







[MainPage.xaml.cs]


using System.Windows;

using System.Windows.Controls;

using System.Windows.Media;

 

namespace RiaPasswordBox

{

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

 

            this.Loaded += new RoutedEventHandler(MainPage_Loaded);

        }

 

        void MainPage_Loaded(object sender, RoutedEventArgs e)

        {

            // 코드 기반으로 암호 텍스트박스 설정

            PasswordBox pwd = new PasswordBox();

 

            // 주요 속성 지정

            pwd.Foreground = new SolidColorBrush(Colors.Red);

            pwd.FontSize = 30;

            pwd.Password = "1234"; // TextBox Text속성

            pwd.FontFamily = new FontFamily("malgun gothic");           

            pwd.PasswordChar = '?';

            pwd.BorderBrush = new SolidColorBrush(Colors.Blue);

            pwd.BorderThickness = new Thickness(5);


           
//
컨트롤/레이아웃에 추가

            this.myStackPanel.Children.Add(pwd);

        }

    }

}

 

 










'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

드래그 앤 드롭  (0) 2009.12.01
TextBlock 컨트롤 : 텍스트 출력  (0) 2009.12.01
TextBox 컨트롤  (0) 2009.12.01
Label 컨트롤  (0) 2009.12.01
Button컨트롤  (0) 2009.12.01
Posted by holland14
: