I have successfully managed to implement a "bindable" PasswordBox in WPF (http://www.wpftutorial.net/PasswordBox.html), and used it in a WPF DataGrid.
I really need this feature in the XamDataGrid as well.
I have found several posts which mentions the XamMaskedEditor (without providing any code). These posts are fairly old, and I was wondering if you had implemented such a feature in the current release of NetAdvantage?
In this blog post I describe one way of hosting any control in the xamDataGrid so you can probably use that to host your bindable PasswordBox.
Hello Andrew,
Your blog post looks very promising!
I updated the sample to VS2010, and added the latest Infragistics WPF-assemblies. The sample runs fine, but I have some trouble implementing the feature in my own application.
I added the ControlHostEditor-class to my solution, copied the sample-xaml and changed it to my customized PasswordBox. When I try to run the program I get the following error
The type reference cannot find a public type named 'ControlHostEditor'. Line 79 Position 94.
The error occurs on the UnboundField and not the DataTemplate, which is quite strange.
Maybe I'm missing a reference, or something?
EDIT: I would just like to add that I also added the namespace-declaration to the xaml. Intellisense doesn't show the class when I type igSamples!
Well if you're embedding the control into your own project and not leaving it in the separate project it was in, which is where the xmlnsprefixattribute and xmlnsdefinitionattribute were defined, then you can't use URI namespace syntax - you have to use clr-namespace syntax. If you still have an issue then please post a sample that demonstrates the issue.
I have attached a sample containing my PasswordBox-control.
Looking forward to hearing from you.
I'm not sure how it happened but the assemblyinfo.cs for the project containing the ControlHostEditor seems to be missing all the xmlns attributes. You can just add the attributes. e.g.
[assembly: XmlnsPrefix("http://infragistics.com/Samples", "igSamples")] [assembly: XmlnsDefinition("http://infragistics.com/Samples", "Infragistics.Windows.Samples")]
[assembly: XmlnsDefinition("http://infragistics.com/Samples", "Infragistics.Windows.Samples")]
I've tried the sample you provided and it works just fine.
I don't know if the xamDataGrid is capable of this, but is it possible to use some kind of display mode/edit mode to imitate the "normal" XamTextEditor used in the grid?
I'm not sure what updates you are referring to. As I mentioned the only remaining issue was with your PwdHelper. If you step through your code you will see that the OnBindingChanged is invoked before the OnBindChanged and only the OnBindingChanged actually sets the Password of the PasswordBox - the OnBindChanged does not. So perhaps you should modify your code to set the Password in the OnBindChanged as well. I've attached a modified version of your sample that has all of the changes mentioned in this thread.
Any updates to this issue?
It is quite important that I use the XamDataGrid in my application instead of the native WPF DataGrid...
Hello again,
Looks like it's my PasswordBox that causes the problems...
Would it be possible to use a "standard WPF" PasswordBox? Maybe this would solve the problem with the binding.
The last part of my answer was simply that there seems to be an issue with your PwdHelper. It assumes that the Bind property is set before the Binding property but when I ran your sample that was not the case. When I ran the sample (after adding the ThemeInfo attribute and after changing the UnboundField to a Field) it still didn't work because the Binding property was set first (i.e your property change callback for the Binding property was executed) but since Bind was false it didn't actually push the value into the PasswordBox. Then when the Bind property was set and its property change callback was executed it doesn't try to push the value into the PasswordBox. I can't modify/debug your helper code. You would likely need to refactor the Binding and Bind property change handlers to both go through a common routine and push the value into the PasswordBox when the Bind is true and the Binding is set.