代码改变世界

补充部分官方文档里没有的Client Library以及代码提示Schema更新(一)

  Jeffrey Zhao  阅读(1935)  评论(8编辑  收藏  举报
  为了保证Intelligence Schema的正确性,不得不仔细地去挖掘文档上没有描述的特性,最好的方式自然是阅读它的代码,似乎进展还算顺利。新增支持的Tag为validator相关和floatingBehavior,具体如下:

<requiredFieldValidator />
<typeValidator />
<rangeValidator />
<regexValidator />
<customValidator />
<validationErrorLabel />
<validationGroupt />
<floatingBehavior />

Schema已经更新,可以点击这里下载。使用方式可以见我前一篇文章《为VS.NET 2005增加Atlas Scripts的代码提示功能》,那里的Schema下载也以更新。

在研究floatingBehavior之后,发现目前似乎缺少对于其location属性和move事件的介绍,因此另外写了一篇文章《FloatingBehavior补遗:Location属性与move事件》对此作了简单的介绍。

有朋友向我反映说,使用了Schema之后再输入page这个tag时,总是会自动变成<page />,很不方便,这只要设定一下VS即可:选择菜单Tools——Options,在左侧树装菜单中选择Text Editor——HTML——Format,接着在右侧点击Tag Specific Options按钮,如图:


接着在弹出窗口中选择ASP.NET Controls——Page,然后在右侧将“Closing tag”设为“Separate cloasing tag”,如图:


这样,再次输入page时,就会出现<page></page>而不是<page />了。


以下是自制的Class Library,为了方便自己和需要的朋友作为参考。其中可以发现继承于Sys.Component的类都会有id和dataContext两个属性,我也如官方Class Library一般列出,虽然可能不会用到。

另外,如果有朋友发现问题请及时指出:



RequiredFieldValidator Class


The validator class which fires an error if the field on which the validator is configured is empty.

Syntax

Javascript

new Sys.UI.RequiredFieldValidator();

Declarative

<requiredFieldValidator
    dataContext
="source for data binding operations"
    
errorMessage="the error message"
    id="identifier for looking up the component by name"
    propertyChanged="event handler"

>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</requiredFieldValidator>

Script components:  required

Inherits:  Sys.UI.Validator




TypeValidator Class

The validator class which fires an error if the field on witch the validator is configured is not in the specific type.

Syntax

Javascript

new Sys.UI.TypeValidator();

Declarative

<typeValidator
    dataContext
="source for data binding operations"
    
errorMessage="the error message"
    id="identifier for looking up the component by name"
    propertyChanged="event handler"
    type
="Number|String|Boolean"
>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</typeValidator>

Script components:  required

Inherits:  Sys.UI.Validator




RangeValidator Class

The validator class which fires an error if the field on witch the validator is configured is not in the specific range.

Syntax

Javascript


new Sys.UI.RangeValidator();

Declarative

<rangeValidator
    dataContext
="source for data binding operations"
    
errorMessage="the error message"
    id="identifier for looking up the component by name"

    lowerBound
="the lower bound"
    propertyChanged="event handler"
    upperBound
="the upper bound"
>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</rangeValidator>

Script components:  required

Inherits:  Sys.UI.Validator




RegexValidator Class

The validator class which fires an error if the field on witch the validator is configured is not match the regular expresstion.

Syntax

Javascript


new Sys.UI.RegexValidator();

Declarative

<regexValidator
    dataContext
="source for data binding operations"
    
errorMessage="the error message"
    id="identifier for looking up the component by name"
    propertyChanged="event handler"
    regex
="the regular expression"
>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</regexValidator>

Script components:  required

Inherits:  Sys.UI.Validator




CustomValidator Class

The validator class which fires an error if the field on witch the validator is configured is not pass the validation events.

Syntax

Javascript


new Sys.UI.CustomValidator();

Declarative

<rangeValidator
    dataContext
="source for data binding operations"
    
errorMessage="the error message"
    id="identifier for looking up the component by name"
    propertyChanged="event handler"
    validateValue
="validation event handler"
>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</customValidator>

Script components:  required

Inherits:  Sys.UI.Validator




ValidationErrorLabel Class

The label to show the error message of a control which is being validated.

Syntax

Javascript


= new Sys.UI.ValidationErrorLabel(associatedElement)
    .
    .
c.initialize();

Declarative

<validationErrorLabel
    
accessKey="accelerator key"
    associatedControl
="the associated control being validated"

    cssClass
="CSS class"
    dataContext
="source for data binding operations"
    enabled
="true|false"
    htmlEncode
="false|true"
    id
="identifier for looking up the component by name"
    propertyChanged
="event handler"
    tabIndex
="element's tab index"
    text
="control value"
    visibilityMode
="Hidden|Collapse"
    visible
="true|false"
>
    
<behaviors>
        
<!-- behaviors -->
    
</behaviors>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</validationErrorLabel>

Script components:  required

Inherits:  Sys.UI.Label




ValidationGroup Class

The control group the controls which are being validated.

Syntax

Javascript


= new Sys.UI.ValidationGroup();
    .
    .
c.initialize();

Declarative

<validationGroup
    dataContext
="source for data binding operations"
    
id="identifier for looking up the component by name"
    propertyChanged="event handler"
>
    
<associatedControls>
        
<reference component="the control which is being validated" />
        
<!-- other references -->
    
</associatedControls>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>

</validationGroup>

Script components:  required

Inherits:  Sys.UI.Component




FloatingBehavior Class

Make a control float on the page.

Syntax

Javascript


new Sys.UI.FloatingBehavior();

Declarative

<floatingBehavior
    dataContext
="source for data binding operations"
    
handle="the handle to move the floating control"
    id="identifier for looking up the component by name"

    location
="a string like 'x,y' to indicate the position"
    move="event handler"
    propertyChanged="event handler"
>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<move>
        
<!-- actions -->
    
</move>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</floatingBehavior>

Script components:  required

Inherits:  Sys.UI.Behavior


编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· [AI/GPT/综述] AI Agent的设计模式综述
点击右上角即可分享
微信分享提示