Problem with the Clear button and bound to an int

2 posts, 1 answers
  1. Scott
    Scott avatar
    1 posts
    Member since:
    Feb 2012

    Posted 05 Dec 2013 Link to this post

    I have several RadTextbox's all bound using two way binding.  In my model and view model, everything implements INotifyPropertyChange.

    I have one textbox that is mapped to a string and if I press the clear button on the textbox (and after binding.Updatesource on the textbox binding is executed), the setter of the bound field executes.



    However, I have one textbox that is mapped to an integer and if I press the clear button that textbox (and after binding.UpdateSource on the textbox is executed), the setter of the bound field does not execute.  It will execute just fine if I change the value of the textbox with another integer.



    How come or what does the X Clear button do when bound to an integer to not change the value of the bound field?



    The clear button works on the Publisher textbox but does not on the Page Count textbox



    <telerikPrimitives:RadTextBox x:Name="publisherTextBox" Header="Publisher"

    HeaderStyle="{StaticResource HeaderAccentStyle}"

    Text="{Binding Publisher, Mode=TwoWay}" Grid.Row ="3"/>

                       

    <telerikPrimitives:RadTextBox x:Name="pageCountTextBox" Header="Page Count"

    HeaderStyle="{StaticResource HeaderAccentStyle}"

    InputScope="Number"

    Text="{Binding NoOfPages, Mode=TwoWay}" Grid.Row ="5" />



    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_NoOfPages", DbType = "Int", UpdateCheck = UpdateCheck.Never)]

    public int NoOfPages

    {

    get

    {

    return this._NoOfPages;

    }

    set

    {

    if ((this._NoOfPages != value))

    {

    this.OnNoOfPagesChanging(value);

    this.SendPropertyChanging();

    this._NoOfPages = value;

    this.SendPropertyChanged("NoOfPages");

    this.OnNoOfPagesChanged();

    }

    }

    }



    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Publisher", DbType = "NVarChar(50)", UpdateCheck = UpdateCheck.Never)]

    public string Publisher

    {

    get

    {

    return this._Publisher;

    }

    set

    {

    if ((this._Publisher != value))

    {

    this.OnPublisherChanging(value);

    this.SendPropertyChanging();

    this._Publisher = value;

    this.SendPropertyChanged("Publisher");

    this.OnPublisherChanged();

    }

    }

    }




  2. Answer
    Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 06 Dec 2013 Link to this post

    Hi Scott,

    from what you described and from the code you send us we can not find a reason why it is not working.

    Please open a support ticket and send us the sample project where we can see the behavior.

    Regards,
    Valentin.Stoychev
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
Back to Top