Redigera

Dela via


WorkflowMarkupSerializer.XCodeProperty Field

Definition

Represents a code example, embedded into XAML x:Code element.

public: static initonly System::Workflow::ComponentModel::DependencyProperty ^ XCodeProperty;
public static readonly System.Workflow.ComponentModel.DependencyProperty XCodeProperty;
 staticval mutable XCodeProperty : System.Workflow.ComponentModel.DependencyProperty
Public Shared ReadOnly XCodeProperty As DependencyProperty 

Field Value

Examples

The following example is XAML code that contains a code example that would be compiled during workflow compilation.

<CodeActivity x:Name="codeActivity1" ExecuteCode="methodName1">  
  <x:Code><![CDATA[  
      void methodName1(object sender, EventArgs e)   
      {  
      }  
  ]]></x:Code>  
</CodeActivity>  

The following example shows how to set the same value for the XCodeProperty dependency property programmatically.

CodeActivity code1 = new CodeActivity();  

code1.SetValue(WorkflowMarkupSerializer.XCodeProperty,   
                    new CodeTypeMemberCollection(  
                        new CodeTypeMember[] {  
                            new CodeSnippetTypeMember("void methodName1(object sender, EventArgs e) { }")  
                        }));  

Remarks

This property is used only at design time, while programmatically emitting a workflow using the object model. The property contains a CodeTypeMemberCollection collection filled with CodeSnippetTypeMember elements. After compilation, the code is compiled as a part of the generated type.

You indirectly access each public property and event of this type by the resolution of a corresponding dependency property. This dependency property is the public static field named XProperty or XEvent, where X is the corresponding property.

Applies to