Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
xamNumericInput not updating data correctly
posted

I have this property bound twoway to the text property of the Numeric Input, where maxQuantity is a value i set somewhere else. I dont want the user to be able to input anything above that maxQuantity value. I found when the user is typing the value in, the property is getting set correctly but it isnt actually changing the textbox and this only happens while the cursor is on the textbox. if i attempt to update this property without the cursor being on the textbox (through some other event) it updates fine. theres only an issue when the cursor is there. any ideas?

public int TransferQuantity
{
get
{
return this.TransferQuantity;
}
set
{
if (this.TransferQuantity != value)
{

if (value <= MaxQuantity && value >= 0)
{
this.TransferQuantity = value;
}
else if (value > MaxQuantity)
{
this.TransferQuantity = MaxQuantity;
}
else
{
this.TransferQuantity = 0;

}

}
OnPropertyChanged("TransferQuantity");
}
}

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and I can suggest you use the XamNumericinput’s ValueConstraint Property instead of checking the value in the Setter of your Property. You can set the Constraints like this:

    <ig:XamNumericInput Name="xamNumericInput1" >
        <ig:XamNumericInput.ValueConstraint>
            <ig:ValueConstraint MaxInclusive="10" MinInclusive="0"/>
        </ig:XamNumericInput.ValueConstraint>
    </ig:XamNumericInput>
    

    This way the user won’t be able to enter values less than 0 and greater than 10. Please let me know if this helps you or you need further assistance on this matter.

     

    Looking forward for your reply.

Children