We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Data binding the sfMaskedEdit control using Caliburn.Micro

Does anyone have experience / examples for binding the sfMaskedEdit  control to a property in a bindablecollectioin? I can bind Microsoft controls without issue but not the sfMaskedEdit. I want to keep following the Caliburn model within MVVM. The property is in the viewmodel, the control is in the view. With Caliburn.Micro you just assign the control the name x:Name="BindableCollection_PropertyName". This doesn't work with sfMaskedEdit 

thanks for any help you can provide.

Charlie

6 Replies

NK Niranjan Kumar Gopalan Syncfusion Team January 20, 2020 08:35 AM

Hi Charles, 
 

We are currently checking your queryNeed a sample to bind the sfMaskedEdit  control to a property in a bindablecollection” and we will update you on 22nd January 2020.

 
Regards, 
Niranjan Kumar 



NK Niranjan Kumar Gopalan Syncfusion Team January 21, 2020 07:17 AM

Hi Charles , 
 
Thanks for your patience. 
 
We are not familiar with Caliburn.Micro. If you can provide us a demo sample comparing the binding of MS control and SfMaskedEdit control we will be able to analyze and proceed further and provide solution without delay. 
 
Regards, 
Niranjan Kumar 



CI Charles Ihle January 21, 2020 10:56 AM

Hi Niranjan,
Thanks for taking a look at this. Caliburn.Micro is a framework that utilizes MVVM. Naming conventions are important. I did make an error in my original query, for this form, the bindable collection isn't necessary. I've attached three files for your review. The form I'm working on is a customer modification form so for this, I've already selected the customer I want to modify from a list on a different form and passed the customer id to the ModifyCustomerView form via the ModifyCustomerViewModel. I retrieve the customer record and load it into a property of type CustomerModel named SelectedCustomer. I then have full properties for each of the fields in the model. The names and datatypes match those in the model.

The view is built when a control will display the desired field value, for instance there  is a TexBox for address line 1. Once the customer record has been retrieved I get it display address line one with the following XAML code
<TextBox x:Name="SelectedCustomer_CustAddr1" HorizontalAlignment="Left"  MinWidth="60" Margin="0 0 0 0"></TextBox>
Caliburn.Micro uses x:Name to identify what is being displayed. The first half of the name is the property holding the customer record followed by an underscore and then the field name that exactly matches the corresponding property in the view model and model. 

I can get the phone number to display with a TextBox or your sfMaskedEdit but I cannot format the information. 

I had the phone numbers defined as string originally but yesterday I changed the type to int. 

I've attached the three class files just discussed, let me now if this helps or if you need more information. This is really driving me nuts.

Charlie

Attachment: Syncfusion_7dfb3dbc.zip


NK Niranjan Kumar Gopalan Syncfusion Team January 22, 2020 08:56 AM

Hi Charles,  
  
We are currently checking this query and we will update you on 24th  January 2020. 
  
Regards,  
Niranjan Kumar  
 



KP Kanniyappan Panneer Selvam Syncfusion Team January 24, 2020 10:46 PM

Hi Charles, 
 
Thanks for your patience. 
 
We have worked on your query and prepared the sample to meet your requirements. In our sample, we have displayed phone number to the Value of SfMaskedEdit with integer type. Please find the sample, screenshot and sample for the same.  
 
Code Snippet: 
 
<syncfusion:SfMaskedEdit Value="{Binding Path=MobileNumber,Mode=OneWay}" Height="30" Width="170" MaskType="Simple" Mask="(000) 000-0000" /> 
 
 
Screenshot: 
 
 
 
 
Please get back to us with more details if we have misunderstood your query. 
 
Regards, 
Kanniyappan P 
 
 



NK Niranjan Kumar Gopalan Syncfusion Team January 27, 2020 08:55 AM

Hi Charles, 

Thanks for your patience. 

We have worked on your query and prepared sample to meet your requirement. SfMaskedEdit can have only string type value, so we have used converter to convert the string value from SfMaskedEdit control to double value for TextBox (mobile number should be of double type by size). Please refer the below sample foe same. 


Regards, 
Niranjan Kumar 


Loader.
Live Chat Icon For mobile
Up arrow icon