コード例 #1
0
ファイル: PasswordBox.cs プロジェクト: xiongzhaoxu/CSHTML5
        static void Password_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var passwordBox = (PasswordBox)d;

            if (!passwordBox._isUserChangingPassword)
            {
                passwordBox._isCodeProgrammaticallyChangingPassword = true; // So that when the c# caller sets the password programmatically, it does not get set multiple times.
                string newPassword = e.NewValue as string ?? string.Empty;
                if (INTERNAL_VisualTreeManager.IsElementInVisualTree(passwordBox))
                {
                    INTERNAL_HtmlDomManager.SetUIElementContentString(passwordBox, newPassword);
                }
                passwordBox._isCodeProgrammaticallyChangingPassword = false;
            }
        }