Welcome, Guest
Username: Password: Remember me
Share your code snippets, screen shots etc. here
  • Page:
  • 1

TOPIC: screen 'data input' - masking made easy !?

screen 'data input' - masking made easy !? 2 years 4 months ago #1189

  Phil Hepburn's Avatar Topic Author Phil Hepburn Offline Posts: 742
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, 
Wales, UK.
  • Masking01-...9-22.mp4

Please Log in or Create an account to join the conversation.

screen 'data input' - masking made easy !? 2 years 4 months ago #1190

  Frank Maraite's Avatar Frank Maraite Offline Posts: 173
Hi Phil,

thanks for showing that. I still did not work on this but will do the next weeks.
I found an similar solution but for WinForms. It had a textbox for each position.

I know I have to deal with ValidationRules and ValueConverters. Just working on others things dealing with real big data (640MB zip with compression to 3%).

Will be back data enter soon.


Please Log in or Create an account to join the conversation.

  • Page:
  • 1