Hi,
Can i block unwanted characters in my XamTextEditor thru xaml ??
Sandeep
Hello Sandeep,
Yes, you can use the ValueConstraint.Enumeration property, which requires an IEnumerable collection of values that can be validated by the ValueConstraint object. In other words the value being validated by this ValueConstraint object will not be considered valid if the value is not part of this enumeration.
Hope this helps,Alex.
Hi Alex,
Thanks for the response. Tried what u said. But it didnt work.
this is what i did.
IList<String> blockedChars = new List<String>();
blockedChars.Add("'");
xamTextEditor1.ValueConstraint.Enumeration = blockedChars;
Anything missing?
Sandeep,
What are the exact DLL versions that you are using. If it is possible, attach a sample project and describe steps to reproduce the issue.
Alex.
The version of Infragistics3.Wpf.Editors.v8.2 dll is 8.2.20082.200.
Sorry to say that we are denied access for uploading files.
Any way i will giv u the steps which i followed
1. Added a XamTextEditor to a window.
2. Selected the ValueConstraint property of the editor in design mode.
3. Added the following code to the Window_Loaded event.
List<string> chars = new List<string>();
chars.Add("a");
chars.Add("b");
chars.Add("c");
xamTextEditor1.ValueConstraint.ValidateAsType = Infragistics.Windows.Editors.ValidateAsType.Text;
xamTextEditor1.ValueConstraint.Enumeration = chars;
Result: The Editor allows to enter any character
Please verify whether i'm missing anything..
The problem is solved. I was not aware that the validation works when the control loses its focus. My mistake. Sorry..
But instead of specifying the characters to be allowed,
can i tell the chars which i have to block.
any way for this..?
To the best of my knowledge, there is no such way to do this in the xaml. You can also use the regex property of the ValueConstraint and/or handle the keydown/EditModeEnded events.
Thanks Alex. I will try with that.