WorkflowMarkupSerializer.XCodeProperty Field

 

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

Namespace:   System.Workflow.ComponentModel.Serialization
Assembly:  System.Workflow.ComponentModel (in System.Workflow.ComponentModel.dll)

public static readonly DependencyProperty XCodeProperty

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.

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) { }")
                        }));

.NET Framework
Available since 3.0
Return to top
Show: