Implementing masked Textboxes - wpf

I am creating a WPF application and I am having difficulties implementing masked input onto text boxes.
For example:
User enters 0830, but it is automatically changed to 08:30
Another example:
Entering a contact number like 0895541026 is automatically changed to (089) 554 1026
If entering a currency value then to have a decimal point after the last 2 digits.
Is there a simple way to accomplish this?

Related

Restrict the number of digits in NumericUpDown Control

I am using a NumericUpDown in WinForms and I'm wondering if it is possible to restrict the number of digits. So my max value is set to 9999.99 but you can enter values larger than this. you shouldn't be able to enter more than 4 digits to the left of the decimal and you shouldn't be able to enter more than 2 digits to the right of the decimal. There is another component called DoubleTextBox which uses the NumberFormatInfo.NumberDecimalDigits property to achieve this, but i was wondering if there is something similar for NumericUpDown. I've tried using the KeyDown event to stop the keyboard press but it doesn't work as perfectly. Any help would be great !

Auto-fill program registration form

We use a program called vspace created by ncomputing. This allows for example 4 stations on a single host machine. So, each time this is installed we have to fill out the registration form which pops up when finalizing the installation. It only takes roughly 20 seconds or so to fill out, but that's 20 seconds for a couple hundred computers, so I am trying to find something that will take the information and fill it in.
I have no idea how to accomplish this. One thing it could do, is when I fill it out manually, I "tab" to the next block. If it could say, fill, tab, fill, tab and so forth with the pre-programmed data starting at whatever the currently selected field was, I think that might be easiest.
Here's a photo of the registration screen. It defaults the cursor to the first block "name" and none of the drop boxes have to be edited.

cursor control for a text block while entering data via keyboard

I have a text block which I have binded to a data field in my c# code which has a setter and getter.
I can enter numbers fine into the text block via the keyboard
The c# code can also set the text value.
I have seen this weird problem where I starting typing a number and I think at the same time the text field is being set by the setter. This causes the cursor to jump from the right where I'm typing to the left, so while I'm typing the number the what I type is not what is seen in the text block. This is because the cursor jumped locations in the middle of me typing. Is there any way to control the cursor so it's always at the right???
Here is an example.
I want to type 1234
I'll type 12 (cursor at right)
I think at this point another of the code will echo the same value 12 and set it.
Then the cursor will jump to the left
then I will finish typing 34
The final value will be 3412
Thank you very much for any ideas!!
try to set UpdateSourceTrigger=LostFocus, to prevent updating the source too often.
check your Property-Setter if RaisePropertyChanged is only called when the new value differs from the old property-value.

Find a better control

It is necessary to implement the following functionality:
There is a rectangle "field", its size is 150x100 pixels. Field is split to locations, each location is 10x10 (totally 15x10 locations on the field).
There are few "coins" (5, for example), each of them can be dropped into any location.
The list of text messages should be displayed in the drop-down list if any coin is clicked (when any message is clicked, drop-down list should be hidden and coin should display the number of selected message from 0 to 9, for example).
That should be done with Silverlight 4.0
I am going to implement custom control "Coin", it will have a view (with a circle), it will display some kind of popup-window (please advise, which one), focus will be set to this window. On "FocusLost" window will be closed (without changing message number), if any message from the list will be clicked then its number will be stored inside of coin.
Question 1: is there any control that already has required functionality?
Question 2: how to implement "drag-and-drop" of coins to the "field" (lets assume, they will be close to the field)?
Any thought or ideas will be helpful. Thanks.
You should not place multiple questions in one 'question'.
AutoCompleteBox is in the Silverlight SDK, in the System.Windows.Controls.Input.dll assembly, and may be of help for the auto completion.

WPF Application Typing in Custom TextBox CPU Jumping from 3 to 80 percent

I have created a RichTextBox called SharpTextBox which indicates and limits the number of characters that can be typed in it. The implementation is shown in the following link:
http://www.highoncoding.com/Articles/673_Creating_SharpRichTextBox_for_Live_Character_Count_in_WPF.aspx
Anyway when I start typing in the TextBox it goes from 3% to 78%. The TextBox updates the Label control which shows the number of characters remaining for the count.
How can I increase the performance of the textbox?
UPDATE:
I read there seems to be some problem with the TextRange.Text property which kills performance.

Resources