Is there an easy way to have XamMaskedInput validate and set the Validation.HasErrors and related attached properties like other WPF controls?
I realize that the mask is supposed to prevent bad data in the first place. But if the user initiates a save operation and the value is still focused and is still invalid (has InvalidValueErrorInfo) then ideally we would be able to programmatically detect the invalid data with program logic that is generic (ie. Validation.HasErrors). Its kind of a pain to create special-purpose code for ValueInput-derived controls.
Hello David,
I am just checking if you have any further questions on this matter. Please do not hesitate to let me know if you do.
Thank you for the feedback. I am glad that you have found a solution to your issue.
Also if you want the inputs to have a built-in features for the API, that you have mentioned, you can suggest a new Product Idea for future versions (or vote for existing ones) at http://ideas.infragistics.com.
Steps to create your idea:
1. Log into the Infragistics Product Ideas site at http://ideas.infragistics.com (creating a new login if needed).
2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)
3. Add your product idea and be sure to be specific and provide as much detail as possible.
• Explain the context in which a feature would be used, why it is needed, why it can’t be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing!
• [CASE: “Reference case [case number], FORUMS: “Include a link to this thread”] in your idea so product management will be able to look back at this case.
The benefits of submitting the product idea yourself include:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
Additional benefits of the Product Idea system include:
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
The product ideas site allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Thank you for contacting Infragistics.
Gergana,
Thanks for your help with this sample.
I probably wasn't clear enough in my original post but I was looking for the XamMaskedInput to interact with the standard API for "System.Windows.Controls.Validation". (eg. equivalent to manually executing MarkInvalid and ClearInvalid). It doesn't seem like the input control has any built-in features for this like the standard TextBox and other types of WPF System.Windows.Controls.
Using the events you've pointed me to, I am able to manually attach error information at will and clear it out again. Styling is then based on the attached property. That should be good enough for most purposes, although it could become repetitive to put this in place with every use of the XamMaskedInput.
I do appreciate your help. Hopefully some day in the future your input controls will conform to the API for "System.Windows.Controls.Validation".
Thanks, David
Hello dbeavon,
Thank you for the provided information.
After further researching your issue I have created a small sample application for you.
In the sample application I have a simple XamMaskedInput. I also create two styles - one when there is an invalid value and one when the value is valid.
Then I have handled the ValidationError event of the XamMaskedInput. This event fires when the user leaves the input with an error in it. In the handler of the event I assign the error style for the XamMaskedInput.
The other event, that I have handled is the ValueChanged event. In the handler of this event I check if the IsValueValid property is true. If it is I change the style for the XamMaskedInput.
More about the events, that I have used you can find on the following link from our documentation: http://help.infragistics.com/doc/WPF/2014.2/CLR4.0/?page=InfragisticsWPF4.Controls.Editors.XamMaskedInput.v14.2~Infragistics.Controls.Editors.XamMaskedInput_members.html.
Please find the attached sample application and feel free to let me know if you have any further questions on this matter.
It is stand-alone on a user control. (In the case of grids, I noticed a separate set of controls (Windows.Editors) for xamDataGrid.)
BTW, are there docs that compare those two namespaces? I get the feeling that one predates the other by many years.