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

  • SEARCH
  • Home
  • 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 6666379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:49:21+00:00 2026-05-26T02:49:21+00:00

How do I get the value from the IntergerUpDown control? I’am using this :

  • 0

How do I get the value from the IntergerUpDown control?
I’am using this : http://wpftoolkit.codeplex.com/wikipage?title=NumericUpDown
Here is the code from MainWindow.xaml

 <extToolkit:IntegerUpDown Value="{Binding Mode=TwoWay, Path=CurrentCount}" HorizontalAlignment="Left" Margin="119,111,0,148" Increment="1" Maximum="10" Minimum="1" Width="100"/>

Here is the code from MainWindow.xaml.cs

 public int CurrentCount { get; set; }
 private void button1_Click(object sender, RoutedEventArgs e)
    {
        CurrentCount = 10;
         int len = Talker.BlahBlahBlah(textBox1.Text, CurrentCount);
    }

So basically I want to pass the value chosen by the user as an int into the method BlahBlahBlah. Do I need to create a View Model and bind it to a CurrentValue property? Can you please provide me with sample code which gets the value from the UI?

So here is my Talker Class:

 class Talker
{
    public static int BlahBlahBlah(string thingToSay, int numberOfTimes)
    {
        string finalString = "";
        for (int i = 0; i < numberOfTimes; i++)
        {
            finalString = finalString + thingToSay + "\n";
        }

        MessageBox.Show(finalString);
        return finalString.Length;
    }
}

This is the method inside ViewModelBase:

    public virtual int CurrentCount
    {
        get { return _CurrentCount; }
        set
        {
            _CurrentCount = value;
            OnPropertyChanged("CurrentCount");
        }
    }

Question is how do I link it together??

Peace

Andrew

  • 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-26T02:49:21+00:00Added an answer on May 26, 2026 at 2:49 am

    The proper, MVVM-correct way of doing this is to bind the Value to a property on your ViewModel.

    public int CurrentCount
    {
        get { return _CurrentCount; }
        set
        {
            _CurrentCount = value;
    
        }
    }
    

    I recommend Josh Smith’s excellent article on MVVM.

    One thing you might want to do later is update the CurrentCount from code and have it reflect correctly in the IntegerUpDown control. To do this, you’ll have to inherit from the INotifyPropertyChanged interface. You can use his ViewModelBase class which does just that. Then, your ViewModel inherits from ViewModelBase and can call OnPropertyChanged to send property changed notifications:

    public int CurrentCount
    {
        get { return _CurrentCount; }
        set
        {
            _CurrentCount = value;
            base.OnPropertyChanged("CurrentCount");            
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get a value from another page. But I get this error
Is it possible to get the value from a JavaScript variable and use this
How can I get the value from the following tags: {desc=1} This is a
I want to get variable value from an objective-c class, using reflection. company.h looks
Given a SharePoint page URL (http://server:8000/Pages/Default.aspx), how can I get value from the fields
I want to get value from NSDictionary . I want to control Code key
I wonder why I can't get value from FCKEditor with this javascript? I work
I'm using jquery to get value from a select box so I can than
I had Accordion (Ajax Control) and I did it to get value from data
I face a problem when I try to get value from primary table in

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.