ReadWriteControlDesigner.MapPropertyToStyle Method
Maps a property, including description and value, to an intrinsic HTML style.
[Visual Basic] Protected Overridable Sub MapPropertyToStyle( _ ByVal propName As String, _ ByVal varPropValue As Object _ ) [C#] protected virtual void MapPropertyToStyle( string propName, object varPropValue ); [C++] protected: virtual void MapPropertyToStyle( String* propName, Object* varPropValue ); [JScript] protected function MapPropertyToStyle( propName : String, varPropValue : Object );
Parameters
- propName
- The property to convert to an HTML style attribute.
- varPropValue
- The value of the property to convert.
Remarks
Notes to Inheritors[note] This method must be overridden in a derived class to implement the designer.
Example
[Visual Basic] The following code example checks the property name and value of a custom Panel class. If the property name is Wrap, the code maps the property to the NoWrap HTML attribute.
[Visual Basic]
' Override the MapPropertyToStyle method to set the
' Panel.Wrap property to the NoWrap HTML attribute.
Overrides Protected Sub MapPropertyToStyle(propName As String, varPropValue As Object)
' Display messages when debugging.
Debug.Assert(Not (propName = Nothing Or propName.Length <> 0), "Invalid property name passed in.")
Debug.Assert(Not (varPropValue = Nothing), "Invalid property value passed in.")
' If the parameters passed to the method are null,
' return nothing.
If ((propName Is Nothing) And (varPropValue Is Nothing)) Then
Return
End If
' If the second parameter is not a null
' value, check whether the property name is Wrap.
If Not (varPropValue Is Nothing) Then
Try
' If property name is wrap, convert
' it to the HTML NoWrap attribute.
If (propName.Equals("Wrap")) Then
Dim strValue As String = String.Empty
If (CType(varPropValue, Boolean)) Then
Behavior.SetStyleAttribute("NoWrap", True, strValue, True)
End If
Else
MyBase.MapPropertyToStyle(propName, varPropValue)
End If
Catch ex As Exception
Debug.Fail(ex.ToString())
End Try
End If
End Sub 'MapPropertyToStyle
[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
.NET Framework Security:
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code
See Also
ReadWriteControlDesigner Class | ReadWriteControlDesigner Members | System.Web.UI.Design Namespace