atlas运用behavior
1
<%@ Page Language="C#" %>
2![](/Images/OutliningIndicators/None.gif)
3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4![](/Images/OutliningIndicators/None.gif)
5
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
<head id="Head1" runat="server">
7
<style type="text/css">
8
.start{background-color:yellow;border:dashed 2px black;}
9
.hover{font-size:40pt;background-color:yellow;border:dashed 2px black;}
10
</style>
11
<title>ASP.NET "Atlas" Demo: Sys.Control Behaviors</title>
12
<link href="intro.css" type="text/css" rel="Stylesheet" />
13
</head>
14![](/Images/OutliningIndicators/None.gif)
15
<body>
16
<form id="form1" runat="server">
17
<div>
18
<atlas:ScriptManager runat="server" ID="ScriptManager1">
19
<Scripts>
20
<atlas:ScriptReference ScriptName="AtlasUIDragDrop" />
21
</Scripts>
22
</atlas:ScriptManager>
23
<div id="Div1" class="title">
24
<h2>ASP.NET "Atlas" Demo: Sys.Control: Behaviors</h2>
25
Behaviors are simply defined as components that you can add to an ASP.NET
26
"Atlas" client-side control that defines some functionality. The behavior
27
is associated to some event on the associated element to which the behavior
28
is attached. The click event that you have seen previously for example is
29
a simple behavior that is exposed as a top-level event on the control.
30
Typically behaviors define some more complex UI actions and functionality.
31
<p></p>
32
There are a number of in-built, basic behaviors in the ASP.NET "Atlas"
33
framework. For example:
34
<ol>
35
<li>Click behavior: provides simple click behavior handling;</li>
36
<li>Floating behavior: provides drag and drop;</li>
37
<li>Hover behavior; provides the typical DHTML events, onmouseover, onmouseout, onfocus and onblur
38
handling;</li>
39
<li>Auto-complete behavior; a specialized behavior that provides the means
40
to complete entries added to text boxes for example. The behavior requires handlers to
41
provide the auto-complete results.</li>
42
</ol>
43
</div>
44
<div class="description">
45
<hr />
46
47
<h3 style="text-decoration:underline">Example 1: Floating and drag-drop behavior</h3>
48
<div id="DescriptionDrag" style="width:200px;height:200px;">
49
<div id="Handle" class="draghandle">Drag by clicking on this element</div>
50
<div style="text-align:center;font-weight:bold;">Word (n)</div>
51
A sound or a combination of sounds.
52
</div>
53
<div style="width:200px;height:200px;"></div>
54
55
<hr />
56
<h3 style="text-decoration:underline">Example 2: Click behavior</h3>
57
<div id="panel">The clickBehavior of the following elements affect this element.</div>
58
<br />
59
<span id="hideLabel" class="buttonstyle2">Hide</span>
60
<span id="showLabel" class="buttonstyle2">Show</span>
61![](/Images/OutliningIndicators/None.gif)
62
63
<hr />
64
<h3 style="text-decoration:underline">Example 3: Hover behavior</h3>
65
<div id="panel2">This element is associated to the hoverBehavior.</div>
66
<br />
67
</div>
68![](/Images/OutliningIndicators/None.gif)
69
<script type="text/xml-script">
70
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
71
<components>
72
<control id="panel" cssClass="start" />
73
<label id="hideLabel">
74
<behaviors>
75
<clickBehavior>
76
<click>
77
<setProperty target="panel" property="visible" value="false" />
78
</click>
79
</clickBehavior>
80
</behaviors>
81
</label>
82
<label id="showLabel">
83
<behaviors>
84
<clickBehavior>
85
<click>
86
<setProperty target="panel" property="visible" value="true" />
87
</click>
88
</clickBehavior>
89
</behaviors>
90
</label>
91
92
<control id="panel2" cssClass="start">
93
<behaviors>
94
<hoverBehavior unhoverDelay="500">
95
<hover>
96
<setProperty target="panel2" property="cssClass" value="hover"/>
97
</hover>
98
<unhover>
99
<setProperty target="panel2" property="cssClass" value="start"/>
100
</unhover>
101
</hoverBehavior>
102
</behaviors>
103
</control>
104
105
<control id="DescriptionDrag" cssClass="floatwindow">
106
<behaviors>
107
<floatingBehavior handle="DescriptionDrag">
108
</floatingBehavior>
109
</behaviors>
110
</control>
111
112
</components>
113
</page>
114
</script>
115
</div>
116
</form>
117
</body>
118
</html>
119![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
9
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/None.gif)
14
![](/Images/OutliningIndicators/None.gif)
15
![](/Images/OutliningIndicators/None.gif)
16
![](/Images/OutliningIndicators/None.gif)
17
![](/Images/OutliningIndicators/None.gif)
18
![](/Images/OutliningIndicators/None.gif)
19
![](/Images/OutliningIndicators/None.gif)
20
![](/Images/OutliningIndicators/None.gif)
21
![](/Images/OutliningIndicators/None.gif)
22
![](/Images/OutliningIndicators/None.gif)
23
![](/Images/OutliningIndicators/None.gif)
24
![](/Images/OutliningIndicators/None.gif)
25
![](/Images/OutliningIndicators/None.gif)
26
![](/Images/OutliningIndicators/None.gif)
27
![](/Images/OutliningIndicators/None.gif)
28
![](/Images/OutliningIndicators/None.gif)
29
![](/Images/OutliningIndicators/None.gif)
30
![](/Images/OutliningIndicators/None.gif)
31
![](/Images/OutliningIndicators/None.gif)
32
![](/Images/OutliningIndicators/None.gif)
33
![](/Images/OutliningIndicators/None.gif)
34
![](/Images/OutliningIndicators/None.gif)
35
![](/Images/OutliningIndicators/None.gif)
36
![](/Images/OutliningIndicators/None.gif)
37
![](/Images/OutliningIndicators/None.gif)
38
![](/Images/OutliningIndicators/None.gif)
39
![](/Images/OutliningIndicators/None.gif)
40
![](/Images/OutliningIndicators/None.gif)
41
![](/Images/OutliningIndicators/None.gif)
42
![](/Images/OutliningIndicators/None.gif)
43
![](/Images/OutliningIndicators/None.gif)
44
![](/Images/OutliningIndicators/None.gif)
45
![](/Images/OutliningIndicators/None.gif)
46
![](/Images/OutliningIndicators/None.gif)
47
![](/Images/OutliningIndicators/None.gif)
48
![](/Images/OutliningIndicators/None.gif)
49
![](/Images/OutliningIndicators/None.gif)
50
![](/Images/OutliningIndicators/None.gif)
51
![](/Images/OutliningIndicators/None.gif)
52
![](/Images/OutliningIndicators/None.gif)
53
![](/Images/OutliningIndicators/None.gif)
54
![](/Images/OutliningIndicators/None.gif)
55
![](/Images/OutliningIndicators/None.gif)
56
![](/Images/OutliningIndicators/None.gif)
57
![](/Images/OutliningIndicators/None.gif)
58
![](/Images/OutliningIndicators/None.gif)
59
![](/Images/OutliningIndicators/None.gif)
60
![](/Images/OutliningIndicators/None.gif)
61
![](/Images/OutliningIndicators/None.gif)
62
![](/Images/OutliningIndicators/None.gif)
63
![](/Images/OutliningIndicators/None.gif)
64
![](/Images/OutliningIndicators/None.gif)
65
![](/Images/OutliningIndicators/None.gif)
66
![](/Images/OutliningIndicators/None.gif)
67
![](/Images/OutliningIndicators/None.gif)
68
![](/Images/OutliningIndicators/None.gif)
69
![](/Images/OutliningIndicators/None.gif)
70
![](/Images/OutliningIndicators/None.gif)
71
![](/Images/OutliningIndicators/None.gif)
72
![](/Images/OutliningIndicators/None.gif)
73
![](/Images/OutliningIndicators/None.gif)
74
![](/Images/OutliningIndicators/None.gif)
75
![](/Images/OutliningIndicators/None.gif)
76
![](/Images/OutliningIndicators/None.gif)
77
![](/Images/OutliningIndicators/None.gif)
78
![](/Images/OutliningIndicators/None.gif)
79
![](/Images/OutliningIndicators/None.gif)
80
![](/Images/OutliningIndicators/None.gif)
81
![](/Images/OutliningIndicators/None.gif)
82
![](/Images/OutliningIndicators/None.gif)
83
![](/Images/OutliningIndicators/None.gif)
84
![](/Images/OutliningIndicators/None.gif)
85
![](/Images/OutliningIndicators/None.gif)
86
![](/Images/OutliningIndicators/None.gif)
87
![](/Images/OutliningIndicators/None.gif)
88
![](/Images/OutliningIndicators/None.gif)
89
![](/Images/OutliningIndicators/None.gif)
90
![](/Images/OutliningIndicators/None.gif)
91
![](/Images/OutliningIndicators/None.gif)
92
![](/Images/OutliningIndicators/None.gif)
93
![](/Images/OutliningIndicators/None.gif)
94
![](/Images/OutliningIndicators/None.gif)
95
![](/Images/OutliningIndicators/None.gif)
96
![](/Images/OutliningIndicators/None.gif)
97
![](/Images/OutliningIndicators/None.gif)
98
![](/Images/OutliningIndicators/None.gif)
99
![](/Images/OutliningIndicators/None.gif)
100
![](/Images/OutliningIndicators/None.gif)
101
![](/Images/OutliningIndicators/None.gif)
102
![](/Images/OutliningIndicators/None.gif)
103
![](/Images/OutliningIndicators/None.gif)
104
![](/Images/OutliningIndicators/None.gif)
105
![](/Images/OutliningIndicators/None.gif)
106
![](/Images/OutliningIndicators/None.gif)
107
![](/Images/OutliningIndicators/None.gif)
108
![](/Images/OutliningIndicators/None.gif)
109
![](/Images/OutliningIndicators/None.gif)
110
![](/Images/OutliningIndicators/None.gif)
111
![](/Images/OutliningIndicators/None.gif)
112
![](/Images/OutliningIndicators/None.gif)
113
![](/Images/OutliningIndicators/None.gif)
114
![](/Images/OutliningIndicators/None.gif)
115
![](/Images/OutliningIndicators/None.gif)
116
![](/Images/OutliningIndicators/None.gif)
117
![](/Images/OutliningIndicators/None.gif)
118
![](/Images/OutliningIndicators/None.gif)
119
![](/Images/OutliningIndicators/None.gif)