ArticleDirectory
- Define read-only, add, and edit three modules
- Custom Code Selection control, quick input control
- Field input verification (uniqueness verification)
Silverlight 4 RIA service dataform template, Code Select the control and validate the usage tips
Function
Define read-only, add, and edit three modules
The purpose of defining templates is to better reuse and improve the readability and maintainability of the XAML code, and to work together better. The following is an interface for maintaining the combiner relationship.
The table body consists of multiple table bodies. In order to complete all operations on a single page as much as possible, the table header uses a dataform space, and the table body uses a combination of DataGrid and dataform.
Dataform has three statuses: Read-Only (display is not editable), edit, and Add. Therefore, we need to control the layout and attributes of each control for these three templates. For example, if isreadonly is true for the space in the read-only state, and isreadonly is true for the keyword field in the editing state, other fields can be edited. Use the Selection Control to edit the status to facilitate input. In the new status, you must use bold (default) or other forms to remind you of the key fields and required fields, this must be specified in different templates.
Tip: The layout uses the data filed control system to change the data field editing status based on the status of the dataform control by default.
Is the layout in the editing status.
Template File
XAML code
Custom Code Selection control, quick input control
The most common single-host magnifiers pop up all records and then return to the page or enter a code (item number) in a textbox to automatically bring out the name, unit, unit price, and other information for quick input. If Asp.net is used to write JavaScript code, it is very easy to use Silverlight.
XAML code;
Bind the fields to be taken out to the custom control.
Silverlight code
Property binding code
Value assignment code
To improve code readability, we recommend that you use anonymous methods.
You can use the autocompleted control to easily select a similar simple codevalue.
Below is the implementation code, the implementation of rapid name conversion, display name save code
Defines a converter and a data source of a code group.
The data source inherits an interface to facilitate conversion.
Field input verification (uniqueness verification)
Verify the attributes of the metadata class field generated by domainservice. To better maintain the prompt information for the verification data, you can use the resource file for storage, for example, the validation supports specific attributes and regular expressions, custom Validation
Code
Uniqueness Verification
You need to repeat the information prompted by the user.
Code
Note: you must add a compilation condition here. Otherwise, the compilation will fail.