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!
I see a few more problems. First, the template isn't being applied to the ControlHostEditor. That is because another attribute seems to have been lost when you converted/updated the project - the ThemeInfo.
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
Another issue is that you are using an UnboundField but that requires then that you set the Binding or BindingPath. Since Text is a property of your data item you should just use Field.
Lastly, your PwnHelper assumes that order of the Binding/Bind properties is such that Bind would be set first and then Binding. However WPF is not doing that (at least when I run it); when Binding is changed the Bind is still false so you don't set the Password of the PasswordBox. When the Bind is subsequently set to true you only hook/unhook the events but you don't actually update the Password of the PasswordBox.
I'm not that familiar with WPF yet, so I'm not sure if I understand your last answer.
Is it possible that you could modify my sample for me?
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.
Any updates to this issue?
It is quite important that I use the XamDataGrid in my application instead of the native WPF DataGrid...
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.
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?