[UWPアプリ][PasswordBox] 基本的な使用方法

スポンサーリンク

PasswordBoxは、ユーザーにパスワードを入力させるためのコントロールです。

以下にPasswordBoxとパスワードを取得するためのButtonコントロールを配置したXAMLの例を示します。

<PasswordBox x:Name="passwordBox" HorizontalAlignment="Left"
             Margin="10,10,0,0" VerticalAlignment="Top" Width="161"/>
<Button x:Name="button" Content="パスワードの取得" HorizontalAlignment="Left" Margin="176,10,0,0" VerticalAlignment="Top" Click="button_Click"/>

PasswordBoxの例

入力されたパスワードを取得するにはPasswordプロパティを使用します。

private void button_Click(object sender, RoutedEventArgs e)
{
    var password = passwordBox.Password;
}

 

 

Please follow and like us:

コメント

タイトルとURLをコピーしました