iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi
I am using MVVM. I have uxTextbox and a uxListbox.
Aim...
Users scan into the text box and this value is added to the uxListBox then the cursor returns to the uxtext and clearout the the value ready for the next input.
I am struggling to get this to work (and have tried serveral versions of the code below) - it adds to the list box ok, but does not clear out the uxtext box.
The cursor does remain in the Barcode control but does not clear out.
public string BarCode { get { return _BarCode; } set { if (_BarCode != value) { _BarCode = value; OnPropertyChanged("BarCode"); if (!string.IsNullOrWhiteSpace(_BarCode)) AddBarCode(_BarCode); } } } private void AddBarCode(string barcode) { if (!string.IsNullOrWhiteSpace(barcode)) { BarCodeList.Add(barcode); BarCode = string.Empty; SetFocusBarcode(); // OnPropertyChanged("BarCodeCount"); } } private void SetFocusBarcode() { ISFocusManager.SetFocus("EnterBarCode"); }
Thanks
UXTextBox is a fundamental input control generally used to obtain input data from users through input devices such as keyboard. Similar to native text box control (assume that the Text property is bound to a property in View Model – let’s name it as BarCode property), the set accessor of the property will be invoked when user tabs out of UXTextBox or press Enter key.
This default behavior matches with your requirement, to update the list when the user tabs off the textbox (and/or when 4 characters have been entered). Please try to use following snippet code in your View Model.
public string BarCode { get { return _barCode; } set { if (_barCode != value) { _barCode = value; OnPropertyChanged("BarCode"); if (!string.IsNullOrEmpty(value)) AddBarCode(); } } } private void AddBarCode() { if (!string.IsNullOrEmpty(BarCode) && BarCode.Length == 4) { ContactsData.Add(new Contact { Id = BarCode.GetHashCode().ToString(), Name = BarCode }); SetFocusBarcode(); } else MessageBox.Show("Please enter valid BarCode character (4 characters)"); Utility.ExecuteTimeOut(0.1, () => { this.BarCode = string.Empty; }); } private void SetFocusBarcode() { ISFocusManager.SetFocus("EnterBarCode"); }
This should help.
I created a simple Silverlight project based on the provided description and snippet code. However, I was unable to reproduce the reported problem in my local end (as shown in the attached video). It adds to the list box and clear out the UXTextBox.
Please have the attached SL project evaluated on your end and let us hear your feedback.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname