Windows Phone Toolkit 紹介 その14 PhoneTextBox

火曜日 , 27, 3月 2012 Leave a comment

PhoneTextBoxはTextBoxにウォーターボックスなどの拡張を加えたコントロールです。

 

基本編

 

PhoneTextBoxの導入は簡単。

[Windows Phone] WindowsPhoneToolkit 紹介 その0 インストールなどを参考にSilverlightToolkitをインストールします。

 

続いてXAMLコードに以下を追加します。

 

<toolkit:PhoneTextBox Hint="名前を入力してください" Margin="0,0,0,537" />

 

画像を表示したい場合は以下、

 

<toolkit:PhoneTextBox x:Name="icon" Hint="名前を入力してください" Margin="0,76,0,461" ActionIconTapped="icon_ActionIconTapped" />

 

        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            Uri uri = new Uri("002.png", UriKind.Relative);
            BitmapImage bmp = new BitmapImage(uri);

            this.icon.ActionIcon = bmp;
        }

 

入力文字数に制限をかける場合は以下、

 

<toolkit:PhoneTextBox Hint="名前を入力してください" DisplayedMaxLength="20" LengthIndicatorVisible="True"  Margin="0,152,0,355" Name="phoneTextBox1" />

 

 

 

これまでのSilverlight Toolkitコントロールの紹介を見る

 


Please give us your valuable comment

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください