tag:blogger.com,1999:blog-7577421612120825312.post7031000487453171988..comments2023-10-03T10:41:13.944+01:00Comments on Functional Fun: WPF PasswordBox and Data bindingAnonymoushttp://www.blogger.com/profile/01345100698738870730noreply@blogger.comBlogger103125tag:blogger.com,1999:blog-7577421612120825312.post-19798124073271829462013-11-16T16:05:14.545+00:002013-11-16T16:05:14.545+00:00look at this:http://seesharpdeveloper.blogspot.com...look at this:http://seesharpdeveloper.blogspot.com/2013/03/binding-to-passwordbox-in-wpf-using-mvvm.htmlABSnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-4078136090226393582013-11-16T16:04:00.854+00:002013-11-16T16:04:00.854+00:00greate article.thank you!!greate article.thank you!!ABSnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-47632245248756591522013-10-25T12:50:52.776+01:002013-10-25T12:50:52.776+01:00so many thanks, you saved my lots of timeso many thanks, you saved my lots of timeJasraj Bishnoinoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-27468381013255699122013-09-17T21:23:20.099+01:002013-09-17T21:23:20.099+01:00Wow, saved my day. thanks man. Brilliant work.Wow, saved my day. thanks man. Brilliant work.Arlvinnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-54269916366547336562013-09-10T10:22:40.394+01:002013-09-10T10:22:40.394+01:00how to access the password value in viewmodelhow to access the password value in viewmodelsravannoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-18392950057752289572013-06-03T14:15:11.442+01:002013-06-03T14:15:11.442+01:00Awsome code. Passing on my thanksAwsome code. Passing on my thanksKevin Maguirenoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-56976934833811406722013-04-02T10:00:19.975+01:002013-04-02T10:00:19.975+01:00Awesome :)
Thank you for this article . Works as ...Awesome :)<br /><br />Thank you for this article . Works as needed !!Prashanthnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-16910210856788730952012-11-14T23:56:35.095+00:002012-11-14T23:56:35.095+00:00Nice code.. work elegantly.Nice code.. work elegantly.James Campbellnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-30636825325235065972012-10-19T09:41:40.676+01:002012-10-19T09:41:40.676+01:00Hi,
That's really a very helpful piece of code...Hi,<br />That's really a very helpful piece of code.<br />I suggest a small modification to HandlePasswordChanged handler to cope with navigation. The problem with your code is that PasswordBox clears the password on navigating to other pages, so that the password should only be update when the PasswordBox has the focus.<br /><br /> private static void HandlePasswordChanged(object sender, RoutedEventArgs e) { PasswordBox box = sender as PasswordBox;<br /> if ((box != null) && box.IsFocused) { // set a flag to indicate that we're updating the password SetUpdatingPassword(box, true); // push the new password into the BoundPassword property SetBoundPassword(box, box.Password); SetUpdatingPassword(box, false); } }Joenoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-41313105603584336602012-09-24T11:49:10.481+01:002012-09-24T11:49:10.481+01:00You might want to try one of the many online C# to...You might want to try one of the many online C# to VB.Net converters, like <br />http://converter.telerik.com/Samuel Jackhttp://blog.functionalfun.netnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-83390544713894960522012-09-24T11:47:57.360+01:002012-09-24T11:47:57.360+01:00I'd suggest you try one of the many online C# ...I'd suggest you try one of the many online C# to VB.Net converters, like <br />http://converter.telerik.com/Samuel Jackhttp://blog.functionalfun.netnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-27681002820142769912012-09-24T08:11:21.201+01:002012-09-24T08:11:21.201+01:00thanks..for the code thanks..for the code rooma roopchandaninoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-53542090176871747842012-09-23T12:01:18.235+01:002012-09-23T12:01:18.235+01:00Hi, I just wonder you may have the above code in V...Hi, I just wonder you may have the above code in VB. As my project required me to built in VB and I 've problem to do the translation from C# to VB. Thanksyuennoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-61295659151307803842012-09-05T12:57:54.344+01:002012-09-05T12:57:54.344+01:00Thanks. You may want to change "d" to &q...Thanks. You may want to change "d" to "box" in this line for the check to have the described effect:<br />if (d == null || !GetBindPassword(d))Yves Goergennoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-29121431615856838232012-06-14T22:37:22.670+01:002012-06-14T22:37:22.670+01:00Hi,
When I bind the Property to my Player-object ...Hi,<br /><br />When I bind the Property to my Player-object the Passwordfield is still null in my ViewModel, do you have any suggestions?Thanks in advance!Tom Kerkhovenoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-34220796353309008732012-03-20T23:55:35.277+00:002012-03-20T23:55:35.277+00:00Hi Sam, I'm a little confused on how to access...Hi Sam, I'm a little confused on how to access this from my viewmodel in WPF. If you could get back to me via email at reeceengle(at)gmail I would really appreciate itReece Englenoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-81017925302967439352012-01-28T23:24:30.996+00:002012-01-28T23:24:30.996+00:00Thanks very much for this excellent post (realizin...Thanks very much for this excellent post (realizing that it's 3.5 years old... the Internets that keep on giving), this was exactly what I needed.RickEnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-43432610481524877362011-12-03T14:25:47.581+00:002011-12-03T14:25:47.581+00:00Hi,
Thank you for this usefull piece of code.
Bo...Hi,<br /><br />Thank you for this usefull piece of code.<br /><br />BoundPassword, BindPassword and UpdatingPassword should be respectilvly named BoundPasswordProperty, BindPasswordProperty and UpdatingPasswordProperty to avoid the "dependency property missing" problem in xaml.Filimindjinoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-13931732547538654992011-11-03T15:15:35.358+00:002011-11-03T15:15:35.358+00:00That was an excellent solution!That was an excellent solution!Reckfacenoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-72634386814914594622011-10-24T10:27:08.604+01:002011-10-24T10:27:08.604+01:00My comment that "I've corrected it" ...My comment that "I've corrected it" was aimed at Ross, not Jared :-)<br /><br />So, I've not made any changes to the way PasswordBox works with the NavigationService. If I understand Jared correctly, he solved his problem by stashing the value of the passsword box away before the NavigationService was invoked, and then restored it when his ViewModel was reloaded.Samuel Jackhttp://blog.functionalfun.netnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-4465163736334357512011-10-24T10:12:06.924+01:002011-10-24T10:12:06.924+01:00Hi! Great solution. I like it very much. Is there ...Hi! Great solution. I like it very much. Is there any way to also add some Binding.ValidationRules to it?Florin Bnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-88494257042994184052011-10-22T07:12:53.755+01:002011-10-22T07:12:53.755+01:00Were you advised not to reference System.Windows.C...Were you advised not to reference System.Windows.Controls in the ViewModel itself? That is a good principle to try and follow in general. You will, of course need to make use of those controls in your View (in Xaml). But your ViewModel should only concern itself with behaviour, not with how things look. It should communicate with the View almost exclusively using data binding and ICommands.Samuel Jackhttp://blog.functionalfun.netnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-51903402258920066182011-10-21T22:04:45.324+01:002011-10-21T22:04:45.324+01:00I have been advised not to use System.Windows.Cont...I have been advised not to use System.Windows.Controls when you are trying to follow MVVM pattern. Do you agree with this statement? Since I am still learning MVVM pattern, I don’t know why.Shainoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-73725657606061176432011-10-18T13:29:57.354+01:002011-10-18T13:29:57.354+01:00hi,
awsome article, but where and how is this cor...hi, <br />awsome article, but where and how is this corrected? i just copied your code and the NavigationService still blanks my password.Or Galnoreply@blogger.comtag:blogger.com,1999:blog-7577421612120825312.post-50638309189691376242011-08-10T16:35:12.240+01:002011-08-10T16:35:12.240+01:00Good stuff. One small change though, in your OnBou...Good stuff. One small change though, in your OnBoundPasswordChanged method, you should be null-checking "box" and checking if GetBindPassword of box is true.Jakubnoreply@blogger.com