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 4577634
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:22:24+00:00 2026-05-21T20:22:24+00:00

I implemented a textbox, and this binds to a viewmodel. I fill in the

  • 0

I implemented a textbox, and this binds to a viewmodel. I fill in the textbox default by ‘100’ for example, but if i change this to 10, the property always sets correctly. But when i delete all the numbers, i want that the property is set to null. But it just don’t set the value when nothing is filled in. He just keeps the last value..

this is my code , viewmodel + xaml:

public double MaxTime
{
    get
    {
        return maxTime;
    }
    set
    {
        maxTime = value;
        OnPropertyChanged("MaxTime");
        if (SelectedQuestionDropList != null)
        {
            foreach (QuestionCluster cluster in this.Examination.QuestionClusters)
            {
                if (cluster == SelectedQuestionDropList)
                {
                    cluster.MaxTime = value;
                }
            }
        }
    }
}


<TextBox Height="23" 
         Visibility="{Binding Path=VisibleClusterDetails, Converter={StaticResource boolToVis},UpdateSourceTrigger=PropertyChanged}"  
         Text="{Binding Path=MaxTime,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"
         HorizontalAlignment="Right" Margin="0,511,601,0" Name="textBox2" 
         VerticalAlignment="Top" Width="120" /> 
  • 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-21T20:22:25+00:00Added an answer on May 21, 2026 at 8:22 pm

    Your property is a double so it won’t support null or empty values.

    Instead of using a double here I would expose the property as a string and convert between string and double in my property getter and setter. In the setter I could handle null or empty values as I wanted, and I could easily handle any special formatting that was needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a TextBox Binded to a dependancy property, I have implemented a PropertyChangedCallBack
I have a TextBox bound to some property. I have implemented IDataErrorInfo for performing
<asp:TextBox CssClass=txt ID=TextBox1 runat=server onkeyup=CountChars(this); Rows=20 Columns=35 TextMode=MultiLine Wrap=true> </asp:TextBox> I need to implement
I'm trying to implement autocomplete for a textbox using the following code, but it's
I have a TextBox bound to a property of an object which implements IDataErrorInfo
Implemented a generic repository with several Methods. One of those is this: public IEnumerable<T>
Using ASP.NET MVC, I've implemented an autocomplete textbox using the approach very similar to
I have implemented IDataErrorInfo interface to validate my entities. <TextBox Text={Binding User.Name, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}
Sorry if this has been answered before; I've looked at similar posts here but
Is it possible to bind a field (textbox) to a Property that doesn't implement

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.