/
SupportsPreviewControlAttribute.xml
275 lines (245 loc) · 21.8 KB
/
SupportsPreviewControlAttribute.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<Type Name="SupportsPreviewControlAttribute" FullName="System.Web.UI.Design.SupportsPreviewControlAttribute">
<TypeSignature Language="C#" Value="public sealed class SupportsPreviewControlAttribute : Attribute" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit SupportsPreviewControlAttribute extends System.Attribute" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.Design.SupportsPreviewControlAttribute" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class SupportsPreviewControlAttribute
Inherits Attribute" />
<TypeSignature Language="F#" Value="type SupportsPreviewControlAttribute = class
 inherit Attribute" />
<TypeSignature Language="C++ CLI" Value="public ref class SupportsPreviewControlAttribute sealed : Attribute" />
<AssemblyInfo>
<AssemblyName>System.Design</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Attribute</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.AttributeUsage(System.AttributeTargets.Class)]</AttributeName>
<AttributeName Language="F#">[<System.AttributeUsage(System.AttributeTargets.Class)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Indicates whether a control designer requires a preview instance of the control at design time. This class cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Apply the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> attribute to a control designer class to indicate the type of preview control that is supported by the control designer. Use this attribute to change a preview control for design-time rendering without affecting the actual persisted instance of the associated control.
Typically, you specify the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> when declaring a custom designer class that is derived from the <xref:System.Web.UI.Design.ControlDesigner> class. The value of the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> property for the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> attribute determines the behavior for the <xref:System.Web.UI.Design.ControlDesigner.UsePreviewControl%2A> and <xref:System.Web.UI.Design.ControlDesigner.ViewControl%2A> members in the base <xref:System.Web.UI.Design.ControlDesigner> class.
Set the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> property to `true` to indicate that the designer uses a temporary copy of the associated control to generate the design-time HTML. Changes to the temporary control are not persisted.
Set the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> property to `false` to indicate that the designer returns the control instance, specifically the <xref:System.ComponentModel.Design.ComponentDesigner.Component%2A> property, from the <xref:System.Web.UI.Design.ControlDesigner.ViewControl%2A> method. Changes to the control object are persisted.
For example, the <xref:System.Web.UI.Design.WebControls.CalendarDesigner> class is marked with the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> set to `true`. The designer uses the preview control with the automatic style formatting task, which allows the user to preview various autoformat stylesthat can be applied to the calendar. As the user selects different autoformat styles in the user interface, the selected style scheme is applied to the preview control. Applying a new style to the preview control does not change the scheme that is applied to the instance of the <xref:System.Web.UI.WebControls.Calendar> control in the designer.
If the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> is not specified in the control designer declaration, the <xref:System.Web.UI.Design.ControlDesigner> behavior is equivalent to specifying the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> as `false`.
> [!NOTE]
> Designer classes derived from the <xref:System.Web.UI.Design.ControlDesigner> class can override the <xref:System.Web.UI.Design.ControlDesigner.UsePreviewControl%2A> and <xref:System.Web.UI.Design.ControlDesigner.ViewControl%2A> members, and ignore the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> attribute. To determine the expected behavior for <xref:System.Web.UI.Design.ControlDesigner.ViewControl%2A> and <xref:System.Web.UI.Design.ControlDesigner.UsePreviewControl%2A>, see the reference documentation for the derived control designer class.
For general information about using attributes, see [Attributes Overview](https://msdn.microsoft.com/library/a4daf212-2410-423d-a800-7a08864e9bff) and [Attributes](/dotnet/standard/attributes/). For more information about design-time attributes, see [Attributes and Design-Time Support](https://msdn.microsoft.com/library/7aed9eb4-124b-4a15-a0a3-458f37ac9ef7).
## Examples
The following code example demonstrates how to mark a control designer with the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> attribute. The code example derives an ASP.NET server control from the <xref:System.Web.UI.WebControls.Label> class and associates the ASP.NET server control with a custom control designer implementation. The control designer class declaration is marked with the `SupportsPreviewControl` attribute set to `true`. The control designer overrides the <xref:System.Web.UI.Design.ControlDesigner.GetDesignTimeHtml%2A> method and encloses the design-time HTML for the control in italic tags.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.Design.SupportsPreviewControlAttribute/CS/supportspreviewdesigner.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.Design.SupportsPreviewControlAttribute/VB/supportspreviewdesigner.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.Design.ControlDesigner.UsePreviewControl" />
<altmember cref="P:System.Web.UI.Design.ControlDesigner.ViewControl" />
<altmember cref="T:System.Web.UI.Design.WebControls.PreviewControlDesigner" />
<related type="Article" href="https://msdn.microsoft.com/library/7aed9eb4-124b-4a15-a0a3-458f37ac9ef7">Attributes and Design-Time Support</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SupportsPreviewControlAttribute (bool supportsPreviewControl);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(bool supportsPreviewControl) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.Design.SupportsPreviewControlAttribute.#ctor(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (supportsPreviewControl As Boolean)" />
<MemberSignature Language="F#" Value="new System.Web.UI.Design.SupportsPreviewControlAttribute : bool -> System.Web.UI.Design.SupportsPreviewControlAttribute" Usage="new System.Web.UI.Design.SupportsPreviewControlAttribute supportsPreviewControl" />
<MemberSignature Language="C++ CLI" Value="public:
 SupportsPreviewControlAttribute(bool supportsPreviewControl);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Design</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="supportsPreviewControl" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="supportsPreviewControl">The initial value to assign for <see cref="P:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl" />.</param>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.Design.SupportsPreviewControlAttribute" /> class and sets the initial value of the <see cref="P:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl" /> property.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Typically, you do not need to create an instance of the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> class directly. Apply the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> to the class declaration of the custom control designer in the source code.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Default">
<MemberSignature Language="C#" Value="public static readonly System.Web.UI.Design.SupportsPreviewControlAttribute Default;" />
<MemberSignature Language="ILAsm" Value=".field public static initonly class System.Web.UI.Design.SupportsPreviewControlAttribute Default" />
<MemberSignature Language="DocId" Value="F:System.Web.UI.Design.SupportsPreviewControlAttribute.Default" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Default As SupportsPreviewControlAttribute " />
<MemberSignature Language="F#" Value=" staticval mutable Default : System.Web.UI.Design.SupportsPreviewControlAttribute" Usage="System.Web.UI.Design.SupportsPreviewControlAttribute.Default" />
<MemberSignature Language="C++ CLI" Value="public: static initonly System::Web::UI::Design::SupportsPreviewControlAttribute ^ Default;" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.Design</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.UI.Design.SupportsPreviewControlAttribute</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets an instance of the <see cref="T:System.Web.UI.Design.SupportsPreviewControlAttribute" /> class that is set to the default preview value. This field is read-only.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> property of the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.Default> field is set to `false`.
Use the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.IsDefaultAttribute%2A> method to determine whether the value for the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> property is set to the default preview value.
]]></format>
</remarks>
<altmember cref="M:System.Web.UI.Design.SupportsPreviewControlAttribute.IsDefaultAttribute" />
</Docs>
</Member>
<Member MemberName="Equals">
<MemberSignature Language="C#" Value="public override bool Equals (object obj);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance bool Equals(object obj) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.Design.SupportsPreviewControlAttribute.Equals(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function Equals (obj As Object) As Boolean" />
<MemberSignature Language="F#" Value="override this.Equals : obj -> bool" Usage="supportsPreviewControlAttribute.Equals obj" />
<MemberSignature Language="C++ CLI" Value="public:
 override bool Equals(System::Object ^ obj);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Design</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="obj" Type="System.Object" />
</Parameters>
<Docs>
<param name="obj">The object to compare with the current instance of <see cref="T:System.Web.UI.Design.SupportsPreviewControlAttribute" />.</param>
<summary>Determines whether the specified object represents the same preview attribute setting as the current instance of the <see cref="T:System.Web.UI.Design.SupportsPreviewControlAttribute" /> class.</summary>
<returns>
<see langword="true" /> if <paramref name="obj" /> is a <see cref="T:System.Web.UI.Design.SupportsPreviewControlAttribute" /> attribute and its value is the same as this instance of <see cref="T:System.Web.UI.Design.SupportsPreviewControlAttribute" />; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.Equals%2A> method overrides the <xref:System.Object.Equals%2A?displayProperty=nameWithType> method.
The <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.Equals%2A> method compares two instances based on the value of their <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> properties.
]]></format>
</remarks>
<altmember cref="M:System.Object.Equals(System.Object)" />
</Docs>
</Member>
<Member MemberName="GetHashCode">
<MemberSignature Language="C#" Value="public override int GetHashCode ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance int32 GetHashCode() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.Design.SupportsPreviewControlAttribute.GetHashCode" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function GetHashCode () As Integer" />
<MemberSignature Language="F#" Value="override this.GetHashCode : unit -> int" Usage="supportsPreviewControlAttribute.GetHashCode " />
<MemberSignature Language="C++ CLI" Value="public:
 override int GetHashCode();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Design</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Returns the hash code for this instance of the <see cref="T:System.Web.UI.Design.SupportsPreviewControlAttribute" /> class.</summary>
<returns>A 32-bit signed integer hash code for the current instance of <see cref="T:System.Web.UI.Design.SupportsPreviewControlAttribute" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.GetHashCode%2A> method overrides the <xref:System.Object.GetHashCode%2A?displayProperty=nameWithType> method.
The <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.GetHashCode%2A> method generates the same hash code for two objects that are equal according to the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.Equals%2A> method. The hash code is suitable for use in hashing algorithms and data structures, such as hash tables.
]]></format>
</remarks>
<altmember cref="M:System.Object.GetHashCode" />
<altmember cref="T:System.Collections.Hashtable" />
<altmember cref="M:System.Web.UI.Design.SupportsPreviewControlAttribute.Equals(System.Object)" />
</Docs>
</Member>
<Member MemberName="IsDefaultAttribute">
<MemberSignature Language="C#" Value="public override bool IsDefaultAttribute ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance bool IsDefaultAttribute() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.Design.SupportsPreviewControlAttribute.IsDefaultAttribute" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function IsDefaultAttribute () As Boolean" />
<MemberSignature Language="F#" Value="override this.IsDefaultAttribute : unit -> bool" Usage="supportsPreviewControlAttribute.IsDefaultAttribute " />
<MemberSignature Language="C++ CLI" Value="public:
 override bool IsDefaultAttribute();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Design</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Indicates whether the current instance of the <see cref="T:System.Web.UI.Design.SupportsPreviewControlAttribute" /> class is set to the default preview attribute value.</summary>
<returns>
<see langword="true" /> if the current instance of <see cref="T:System.Web.UI.Design.SupportsPreviewControlAttribute" /> is equal to the default preview attribute value; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.IsDefaultAttribute%2A> method compares the value for the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> property of the current <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> object with the value for the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> property of the static <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.Default> field.
]]></format>
</remarks>
<altmember cref="F:System.Web.UI.Design.SupportsPreviewControlAttribute.Default" />
</Docs>
</Member>
<Member MemberName="SupportsPreviewControl">
<MemberSignature Language="C#" Value="public bool SupportsPreviewControl { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool SupportsPreviewControl" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property SupportsPreviewControl As Boolean" />
<MemberSignature Language="F#" Value="member this.SupportsPreviewControl : bool" Usage="System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool SupportsPreviewControl { bool get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Design</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the control designer requires a temporary preview control at design time.</summary>
<value>
<see langword="true" /> if the designer uses a temporary copy of the associated control for design-time preview; <see langword="false" /> if the designer uses an instance of the <see cref="P:System.ComponentModel.Design.ComponentDesigner.Component" /> control that is contained in the designer.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Typically, you specify a value for the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> property by applying the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> attribute to a custom designer class declaration. The value of the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> property for the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute> attribute determines the behavior for the <xref:System.Web.UI.Design.ControlDesigner.UsePreviewControl%2A> and <xref:System.Web.UI.Design.ControlDesigner.ViewControl%2A> members in the base <xref:System.Web.UI.Design.ControlDesigner> class.
Set the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> property to `true` to indicate that the designer uses a temporary copy of the associated control to generate the design-time HTML. Changes to the temporary control are not persisted.
Set the <xref:System.Web.UI.Design.SupportsPreviewControlAttribute.SupportsPreviewControl%2A> property to `false` to indicate that the designer returns the control instance, specifically the <xref:System.ComponentModel.Design.ComponentDesigner.Component%2A> property, from the <xref:System.Web.UI.Design.ControlDesigner.ViewControl%2A> method. Changes to the control object are persisted.
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.Design.ControlDesigner.UsePreviewControl" />
<altmember cref="P:System.Web.UI.Design.ControlDesigner.ViewControl" />
</Docs>
</Member>
</Members>
</Type>