Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3313816
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:09:34+00:00 2026-05-17T22:09:34+00:00

I will like to validate user entry to ensure they are integers. How can

  • 0

I will like to validate user entry to ensure they are integers. How can I do it? I thought of using IDataErrorInfo which seems like the “correct” way to do validation in WPF. So I tried implementing it, in my ViewModel.

But the thing is my text box is bound to an integer field, and there isn’t any need to validate if an int is an int. I noticed that WPF automatically adds a red border around the textbox to notify the user of the error. The underlying property doesn’t change to an invalid value. But I would like to notify the user of this. How can I do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:09:35+00:00Added an answer on May 17, 2026 at 10:09 pm

    The red border you’ve seen is actually a ValidationTemplate, which you can extend and add a info for the user. See this example:

        <UserControl.Resources>
            <ControlTemplate x:Key="validationTemplate">
                <Grid>
                    <Label Foreground="Red" HorizontalAlignment="Right" VerticalAlignment="Center">Please insert a integer</Label>
                    <Border BorderThickness="1" BorderBrush="Red">
                        <AdornedElementPlaceholder />
                    </Border>
                </Grid>
            </ControlTemplate>
        </UserControl.Resources>
    
    <TextBox Name="tbValue" Validation.ErrorTemplate="{StaticResource validationTemplate}">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written in my code like this... $this->User->saveAll($this->data, array('validate'=>'first')); $this->User->saveAll($this->data, array('validate'=>false)); 'validate'=>false will
It seems like I will be needing transaction with MySQL and I have no
I am just getting started with MVC, and it seems like it will be
I'm using this two plug-ins jquery.validate and jquery.form separately, but I would like to
I want to write a function validate() which will take some pattern or regular
Will a query like this on a recordset work rs.open select * from table
So the final menu will look something like this: Item B Item B-1 Item
The rich presentational capabilities of WPF and Silverlight mean developers like me will be
Rules like A parent object will have up to 2 children could be enforced
I'd like to write a script/batch that will bunch up my daily IIS logs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.