ScriptableTypeAttribute Class
Indicates that all public properties, methods, and events on a managed type are available to JavaScript code when they are registered by using the RegisterCreateableType method.
Namespace: System.Windows.Browser
Assembly: System.Windows.Browser (in System.Windows.Browser.dll)
The ScriptableTypeAttribute type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | ScriptableTypeAttribute | Initializes a new instance of the ScriptableTypeAttribute class. |
| Name | Description | |
|---|---|---|
![]() | Equals | Infrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Returns the hash code for this instance. (Inherited from Attribute.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | Match | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
The ScriptableTypeAttribute method exposes all properties, methods, and events as scriptable endpoints.
If you want to expose only a subset of properties, methods, and events as scriptable endpoints, do not use a ScriptableTypeAttribute object. Instead, attribute the subset of properties, methods, and events with a ScriptableMemberAttribute object.
The ScriptableMemberAttribute setting overrides the default behavior inherited from ScriptableTypeAttribute.
If a type is attributed with ScriptableTypeAttribute, by default, all members that are used as input parameters or return values can be created by using the createManagedType and createManagedArray helpers.
You can turn off support for obtaining script wrappers for input parameters and return values that are exposed on a scriptable property, method, or event by explicitly attributing individual members with the code ScriptableMember(EnableCreateableTypes := false). The following example shows how to disable a single method and let all other methods remain scriptable.
[ScriptableType]
public class SMT_ScriptableManagedType
{
[ScriptableMember(EnableCreateableTypes = false)] // No access
public string GetString1()
{ return "abcdefg"; }
public string GetString2() // Can be accessed.
{ return "123456"; }
}
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
