Silverlight 4 RIA service dataform template, code Selection control, validate verification tips

Source: Internet
Author: User
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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.