screen 'data input' - masking made easy !?
Posted: Mon Feb 13, 2017 12:48 pm
Hi guys,
Frank this is particularly for you, as you posted a little while ago about going over to new formatted screens, and hence input of data.
Well, I have just gotten my Cologne app on data validation in WPF/XAML to three quarters run in X#, the app I supplied to the conference last year was completely in C#. So lots of hand translating been going on in Wales, UK, these last couple of days.
One little part of the code and app made me think of you and your task, as well as all the post over the years crying over the lost VO facilities for screen input - it not being there any more, etc., etc., ...
Well, we do have some FREE and useful tools in WPF, free as we can code them ourselves, once we know how.
Let me give you a small taster (example) of a simple 'mask' which allows three alphabetic characters and after a 'dot' or point, three digits.
Between the Validation Rule approach, we also have 'Converters' that we can code and customise, as well as 'data binding' where different parts of what looks like the same input 'box' are in fact bound to different properties of the ViewModel.
Simpler things first - lets first of all see how simple this test code is :-
And then the single line of XAML script to associate the Validation Rule with the 'TextBox' control :-
Don't worry about the test code/script, I do realise that I am using the email box for testing the mask out ;-0)
Now then - how about a video clip to show you this simple mask in action ? Check this out :-
Now then folks, I hear Karl and others saying that the dot (or point) should be fixed and not have to be typed in - well that comes later with some splitting up of the mask into three parts (visually the user will not know of this) the parts will be a text input box for the three characters, a fixed text block with the point, and then another text input box for the three digits. All together looking as one!
The bindings are on the input boxes - public properties of the ViewModel bound to the first and third boxes.
In fact, while we are having fun, I can make a test app for us where we can change the RegEx masking string in 'real time', from a combo box. SO we can switch on different masks, like magic.
This is just to show you that we can control and validate input to be almost anything we care to choose - we just have to do it a different way, that all. New, different.
I will get on with designing a more complex and flexible masking sample.
Regards for now,
Phil.
Wales, UK.
Frank this is particularly for you, as you posted a little while ago about going over to new formatted screens, and hence input of data.
Well, I have just gotten my Cologne app on data validation in WPF/XAML to three quarters run in X#, the app I supplied to the conference last year was completely in C#. So lots of hand translating been going on in Wales, UK, these last couple of days.
One little part of the code and app made me think of you and your task, as well as all the post over the years crying over the lost VO facilities for screen input - it not being there any more, etc., etc., ...
Well, we do have some FREE and useful tools in WPF, free as we can code them ourselves, once we know how.
Let me give you a small taster (example) of a simple 'mask' which allows three alphabetic characters and after a 'dot' or point, three digits.
Between the Validation Rule approach, we also have 'Converters' that we can code and customise, as well as 'data binding' where different parts of what looks like the same input 'box' are in fact bound to different properties of the ViewModel.
Simpler things first - lets first of all see how simple this test code is :-
And then the single line of XAML script to associate the Validation Rule with the 'TextBox' control :-
Don't worry about the test code/script, I do realise that I am using the email box for testing the mask out ;-0)
Now then - how about a video clip to show you this simple mask in action ? Check this out :-
Now then folks, I hear Karl and others saying that the dot (or point) should be fixed and not have to be typed in - well that comes later with some splitting up of the mask into three parts (visually the user will not know of this) the parts will be a text input box for the three characters, a fixed text block with the point, and then another text input box for the three digits. All together looking as one!
The bindings are on the input boxes - public properties of the ViewModel bound to the first and third boxes.
In fact, while we are having fun, I can make a test app for us where we can change the RegEx masking string in 'real time', from a combo box. SO we can switch on different masks, like magic.
This is just to show you that we can control and validate input to be almost anything we care to choose - we just have to do it a different way, that all. New, different.
I will get on with designing a more complex and flexible masking sample.
Regards for now,
Phil.
Wales, UK.