Windows Phone scrolling data entry form

by 15. January 2011 22:47

 

The Use Case for the DataInputForm was to provide an easy means to configure numerous controls for data entry.  Since the fields could extend beyond the bottom of the view it required the ability to scroll. The image below (bottom right panel) shows the XAML configuration required to utilize the DataInputForm - it simply needs to point to a ViewModel

The DataInputForm is designed to work with the MvpVmViewModelBase which provides a DataFields property of type List<object>.   This list will contain a list of  DataInputFieldAttribute instances that contain the property name and label; if a label is not provided the property name is used.   You can also use the DataInputField attribute (left panel below on lines 40 and 55).  If both the DataInputField attribute and DataFields are used for the same property the DataFields value will be used.   Both the DataInputFieldsAttribute and DataFields property are optional - you can use either one or both.

The significance of the DataFields property is that it permits you to sort the properties as well as identify properties to be used that reside in a baseclass; in the left panel below we see that our SecurityProfileViewModel is reusing (derived from) the UserProfileViewModel; we want to display all of the available properties in the baseclass with the exception of Id and SocialSecurityNumberVisibility.

The DataInputForm utilizes the Silverlight for Windows Phone Toolkit ToggleSwitch and DatePicker controls for Boolean and DateTime properties respectively.

CLICK HERE to see more on DataInputForm control  and to get source code

 

Notice

Blog videos and references to CodePlex projects are no longer valid