当前位置: 首页>>代码示例>>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;未经允许,请勿转载。