入力条件付き Passwordbox
#wpdev_jp #win8dev_jp
雑記
XAML
<PasswordBox x:Name="pbox" Width="200" Height="20" KeyDown="PasswordBox_KeyDown" />
C#
private void PasswordBox_KeyDown(object sender, KeyRoutedEventArgs e)
{
//文字のみ7文字まで
if ((pbox.Password.Length > 7) ||
(e.Key.CompareTo(VirtualKey.Number0) < 0) ||
(e.Key.CompareTo(VirtualKey.Number9) > 0))
e.Handled = true;
}