Louis Rhys
Louis Rhys

Reputation: 35637

Numeric edit field in WPF?

Is an edit field that accept only numeric value (for example, to edit numeric parameters) supported natively (using .NET libraries)?

It's weird that one has to use third party tools for this simple functionality

Upvotes: 4

Views: 2967

Answers (3)

blindmeis
blindmeis

Reputation: 22445

another way to achieve your numeric TextBox is to create a AttachedProperty or Behavior. there are a lot of sample code around.

i create a maskedTextBox behavior for specific input. maybe this can put you in the right direction.

Upvotes: 0

slugster
slugster

Reputation: 49985

Not directly. You have a few options though:

  • use the Extended WPF toolkit, it has some already prepackagaed for you (and it's FREE)
  • extend the TextBox control and override the OnPreviewKeyDown function to intercept keypresses you are not interested in

Upvotes: 3

Related Questions