當前位置: 首頁>>代碼示例>>C#>>正文


C# Controls.PasswordBox類代碼示例

本文整理匯總了C#中System.Windows.Controls.PasswordBox的典型用法代碼示例。如果您正苦於以下問題:C# PasswordBox類的具體用法?C# PasswordBox怎麽用?C# PasswordBox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PasswordBox類屬於System.Windows.Controls命名空間,在下文中一共展示了PasswordBox類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.PassWord = ((System.Windows.Controls.PasswordBox)(target));
     return;
     case 2:
     
     #line 12 "..\..\..\Password.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);
     
     #line default
     #line hidden
     return;
     case 3:
     
     #line 13 "..\..\..\Password.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
開發者ID:dave07747,項目名稱:TowerSearch,代碼行數:25,代碼來源:Password.g.i.cs

示例2: AddPasswordBox

 private static void AddPasswordBox(
     UIElementCollection labelCollection, UIElementCollection inputCollection,
     UIElementCollection checkBoxCollection,
     string content, object dataContext, string key, int index)
 {
     var viewModel = (INotifyPropertyChanged)dataContext;
     labelCollection.Add(new Label() { Content = content });
     var control = new PasswordBox() { DataContext = dataContext, TabIndex = index };
     var parameters = (IDictionary<string, string>)((dynamic)dataContext).Dictionary;
     control.Password = parameters[key];
     PropertyChangedEventHandler onSourceChanged = (sender, e) =>
     {
         if (e.PropertyName != key)
         {
             return;
         }
         if (control.Password == parameters[key])
         {
             return;
         }
         control.Password = parameters[key];
     };
     viewModel.PropertyChanged += onSourceChanged;
     control.PasswordChanged += (sender, e) =>
     {
         if (parameters[key] != control.Password)
         {
             parameters[key] = control.Password;
         }
     };
     control.Unloaded += (sender, e) => viewModel.PropertyChanged -= onSourceChanged;
     inputCollection.Add(new UserControl() { Content = control });
     checkBoxCollection.Add(new FrameworkElement());
 }
開發者ID:gitter-badger,項目名稱:pecastarter5,代碼行數:34,代碼來源:ComponentFactory.cs

示例3: SetEnabledForPasswordBox

 private static void SetEnabledForPasswordBox(PasswordBox passwordBox, bool enabled)
 {
     if (enabled)
         passwordBox.PasswordChanged += OnPasswordChanged;
     else
         passwordBox.PasswordChanged -= OnPasswordChanged;
 }
開發者ID:JohnDMathis,項目名稱:Pippin,代碼行數:7,代碼來源:UpdateOnChange.cs

示例4: SetPasswordBoxSelection

        private static void SetPasswordBoxSelection(PasswordBox passwordBox, int start, int length)
        {
            var select = passwordBox.GetType().GetMethod("Select",
                            BindingFlags.Instance | BindingFlags.NonPublic);

            select.Invoke(passwordBox, new object[] { start, length });
        }
開發者ID:div8ivb,項目名稱:Citadels151010,代碼行數:7,代碼來源:SignV.xaml.cs

示例5: MessageBoxEvent

 static void MessageBoxEvent(PasswordBox password)
 {
     password.PasswordChanged += delegate
     {
         MessageBox.Show("");
     };
 }
開發者ID:Roommetro,項目名稱:Friendly.WPFStandardControls,代碼行數:7,代碼來源:WPFPasswordBoxTest.cs

示例6: RegisterForm_AutoGeneratingField

        /// <summary>
        /// Wire up the Password and PasswordConfirmation accessors as the fields get generated.
        /// Also bind the Question field to a ComboBox full of security questions, and handle the LostFocus event for the UserName TextBox.
        /// </summary>
        private void RegisterForm_AutoGeneratingField(object dataForm, DataFormAutoGeneratingFieldEventArgs e)
        {
            // Put all the fields in adding mode
            e.Field.Mode = DataFieldMode.AddNew;

            if (e.PropertyName == "UserName")
            {
                this.userNameTextBox = (TextBox)e.Field.Content;
                this.userNameTextBox.LostFocus += this.UserNameLostFocus;
            }
            else if (e.PropertyName == "Password")
            {
                PasswordBox passwordBox = new PasswordBox();
                e.Field.ReplaceTextBox(passwordBox, PasswordBox.PasswordProperty);
                this.registrationData.PasswordAccessor = () => passwordBox.Password;
            }
            else if (e.PropertyName == "PasswordConfirmation")
            {
                PasswordBox passwordConfirmationBox = new PasswordBox();
                e.Field.ReplaceTextBox(passwordConfirmationBox, PasswordBox.PasswordProperty);
                this.registrationData.PasswordConfirmationAccessor = () => passwordConfirmationBox.Password;
            }
            else if (e.PropertyName == "Question")
            {
                ComboBox questionComboBox = new ComboBox();
                questionComboBox.ItemsSource = RegistrationForm.GetSecurityQuestions();
                e.Field.ReplaceTextBox(questionComboBox, ComboBox.SelectedItemProperty, binding => binding.Converter = new TargetNullValueConverter());
            }
        }
開發者ID:fr4nky80,項目名稱:LearnCSharp,代碼行數:33,代碼來源:RegistrationForm.xaml.cs

示例7: initTextinput

 public void initTextinput(int maxLen, int inputMode)
 {
     if (m_inputFlag == 0)
     {
         // kEditBoxInputFlagPassword
         PasswordBox pwdBox = new PasswordBox();
         pwdBox.MaxLength = maxLen < 0 ? 0 : maxLen;
         pwdBox.Password = m_strText;
         pwdBox.GotFocus += pwdBox_GotFocus;
         m_textinput = pwdBox;
     }
     else
     {
         TextBox textbox = new TextBox();
         textbox.MaxLength = maxLen < 0 ? 0 : maxLen;
         SetInputScope(textbox, inputMode);
         textbox.TextChanged += textinput_TextChanged;
         textbox.GotFocus += textinput_GotFocus;
         textbox.LostFocus += textinput_LostFocus;
         m_textinput = textbox;
     }
     m_textinput.Margin = new System.Windows.Thickness(0, 0, 220, 0);
     m_textinput.Height = 72.0;
     m_textinput.TabIndex = 0;
     m_textinput.VerticalAlignment = VerticalAlignment.Top;
     m_textinput.KeyDown += OnKeyDownHandler;
     this.LayoutRoot.Children.Add(m_textinput);
 }
開發者ID:namkazt,項目名稱:cocos2d-x,代碼行數:28,代碼來源:EditBox.xaml.cs

示例8: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            PasswordBox = (PasswordBox)GetTemplateChild("PART_PasswordBox");
            PasswordBox.PasswordChanged += PasswordBox_PasswordChanged;
        }
開發者ID:alexyjian,項目名稱:ComBoost,代碼行數:7,代碼來源:PasswordEditor.cs

示例9: CreateControl

        public override FrameworkElement CreateControl(FormItemContext context)
        {
            PasswordBox tb = new PasswordBox();

            CustomValidation.SetValidationCallback(tb, () =>
            {
                string errMsg = null;
                if (tb.Password == null ||
                    tb.Password.Length < 6)
                {
                    errMsg = "密碼強度不夠";
                }
                CustomValidation.SetValidationError(tb, errMsg);
                return errMsg;
            });

            tb.PasswordChanged += (s, e) =>
            {
                CustomValidation.ForceValidation(tb);
                context.SetValueToBindedProperty(tb.Password);
            };

            StyleHelper.ApplyStyle(tb, "editctl_pwd");
            return tb;
        }
開發者ID:mogliang,項目名稱:Generic-WPF-Form-Controls,代碼行數:25,代碼來源:PasswordSink.cs

示例10: BindablePasswordBox

        public BindablePasswordBox() {
            savedCallback = HandlePasswordChanged;

            var passwordBox = new PasswordBox();
            passwordBox.PasswordChanged += savedCallback;
            Child = passwordBox;
        }
開發者ID:SIXNetworks,項目名稱:withSIX.Desktop,代碼行數:7,代碼來源:BindablePasswordBox.cs

示例11: GetHash

 private static byte[] GetHash(PasswordBox pwb)
 {
     MD5 md5 = System.Security.Cryptography.MD5.Create();
     byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(pwb.Password.ToString());
     byte[] hash = md5.ComputeHash(inputBytes);
     return hash;
 }
開發者ID:apazureck,項目名稱:bierstrichler,代碼行數:7,代碼來源:PayInWindow.xaml.cs

示例12: MainCasePasswordBoxTest

 public void MainCasePasswordBoxTest() {
     var propertyChangedViewModel = new PropertyChangedViewModel();
     var passwordBox = new PasswordBox() { DataContext = propertyChangedViewModel };
     ShowWindow(passwordBox);
     var behavior = new DependencyPropertyBehavior();
     behavior.EventName = "PasswordChanged";
     behavior.PropertyName = "Password";
     Interaction.GetBehaviors(passwordBox).Add(behavior);
     BindingOperations.SetBinding(behavior, DependencyPropertyBehavior.BindingProperty, new Binding("Text") { Mode = BindingMode.TwoWay });
     Assert.AreEqual(0, propertyChangedViewModel.TextChangedCounter);
     EnqueueShowWindow();
     EnqueueCallback(() => {
         passwordBox.Password = "123456";
     });
     EnqueueWindowUpdateLayout();
     EnqueueCallback(() => {
         Assert.AreEqual(1, propertyChangedViewModel.TextChangedCounter);
         Assert.AreEqual("123456", propertyChangedViewModel.Text);
         passwordBox.Password = "";
     });
     EnqueueWindowUpdateLayout();
     EnqueueCallback(() => {
         Assert.AreEqual(2, propertyChangedViewModel.TextChangedCounter);
         propertyChangedViewModel.Text = "654321";
     });
     EnqueueWindowUpdateLayout();
     EnqueueCallback(() => {
         Assert.AreEqual("654321", passwordBox.Password);
     });
     EnqueueTestComplete();
 }
開發者ID:ruisebastiao,項目名稱:DevExpress.Mvvm.Free,代碼行數:31,代碼來源:DependencyPropertyBehaviorTests.cs

示例13: PasswordBoxEx

        /// <summary>
        /// Saves the password changed callback and sets the child element to the password box.
        /// </summary>
        public PasswordBoxEx()
        {
            savedCallback = HandlePasswordChanged;

            PasswordBox passwordBox = new PasswordBox();
            passwordBox.PasswordChanged += savedCallback;
            Child = passwordBox;
        }
開發者ID:sreenandini,項目名稱:test_buildscripts,代碼行數:11,代碼來源:PasswordBoxEx.cs

示例14: BindablePasswordBox

        /// <summary>
        /// Saves the password changed callback and sets the child element to the password box.
        /// </summary>
        public BindablePasswordBox()
        {
            _savedCallback = HandlePasswordChanged;

            var passwordBox = new PasswordBox();
            passwordBox.Style = Application.Current.Resources["CommonPasswordBoxStyle"] as Style;
            passwordBox.PasswordChanged += _savedCallback;
            Child = passwordBox;
        }
開發者ID:justdude,項目名稱:meridian,代碼行數:12,代碼來源:BindablePasswordBox.cs

示例15: PasswordBoxControl

		public PasswordBoxControl()
		{
			savedCallback = HandlePasswordChanged;

			var passwordBox = new PasswordBox();
			passwordBox.ContextMenu = null;
			passwordBox.PasswordChanged += savedCallback;
			Child = passwordBox;
		}
開發者ID:xbadcode,項目名稱:Rubezh,代碼行數:9,代碼來源:PasswordBoxControl.cs


注:本文中的System.Windows.Controls.PasswordBox類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。