DependencyObject.SetValue Method
Assembly: System.Workflow.ComponentModel (in system.workflow.componentmodel.dll)
'Declaration Public Sub SetValue ( _ dependencyProperty As DependencyProperty, _ value As Object _ ) 'Usage Dim instance As DependencyObject Dim dependencyProperty As DependencyProperty Dim value As Object instance.SetValue(dependencyProperty, value)
public void SetValue ( DependencyProperty dependencyProperty, Object value )
public function SetValue ( dependencyProperty : DependencyProperty, value : Object )
Not applicable.
Parameters
- dependencyProperty
The DependencyProperty to be set.
- value
The Object to set the value to.
SetBinding sets a binding for the dependency property.
SetValue sets a value directly to the DependencyProperty (similarly AddHandler adds a handler directly to properties of type event).
These methods are exclusive when they are called for the same property. If SetBinding is called, then the values previously set using SetValue (AddHandler in events) are disregarded. The same is true the other way around: SetValue (AddHandler) resets the binding assigned with SetBinding.
The following code shows how a dependency property is set within a dependency object using SetValue.
public string To { get { return ((string)(base.GetValue(SendEmailActivity.ToProperty))); } set { base.SetValue(SendEmailActivity.ToProperty, value); } } [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)] [BrowsableAttribute(true)] [DescriptionAttribute("The Subject property is used to specify the subject of the Email message.")] [CategoryAttribute(MessagePropertiesCategory)] public string Subject { get { return ((string)(base.GetValue(SendEmailActivity.SubjectProperty))); } set { base.SetValue(SendEmailActivity.SubjectProperty, value); } } [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)] [BrowsableAttribute(true)] [DescriptionAttribute("The From property is used to specify the From (Sender's) address for the email mesage.")] [CategoryAttribute(MessagePropertiesCategory)] public string From { get { return ((string)(base.GetValue(SendEmailActivity.FromProperty))); } set { base.SetValue(SendEmailActivity.FromProperty, value); } }
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.