Share via


ExpressionTextBox Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Describes a control that enables the user to edit an expression in an activity designer.

Namespace:  System.Activities.Design.View
Assembly:  System.Activities.Design (in System.Activities.Design.dll)

Syntax

'Declaration
Public NotInheritable Class ExpressionTextBox _
    Inherits ContentControl _
    Implements IComponentConnector, IStyleConnector
'Usage
Dim instance As ExpressionTextBox
public sealed class ExpressionTextBox : ContentControl, 
    IComponentConnector, IStyleConnector
public ref class ExpressionTextBox sealed : public ContentControl, 
    IComponentConnector, IStyleConnector
public final class ExpressionTextBox extends ContentControl implements IComponentConnector, IStyleConnector
[<SealedAttribute>]
type ExpressionTextBox =  
    class
        inherit ContentControl
        interface IComponentConnector
        interface IStyleConnector
    end

Remarks

ExpressionTextBox uses a ValueExpressionConverter to convert between a ValueExpression and its string representation.

Inside Microsoft Visual Studio, this ExpressionTextBox provides additional features such as IntelliSense, when editing an expression.

In both Visual Studio and the rehosted case, ExpressionTextBox creates a ValueExpression after an expression is entered, validates the expression, and displays an error icon if the expression is invalid.

ExpressionTextBlock works in the following manner:

  1. Begins as a TextBlock.

  2. On a click inside of Visual Studio, the TextBlock transforms into an expression editor control. When the control looses focus, if the expression is valid the control turns back to a TextBlock. If the expression is invalid the control stays as expression editor.

  3. On a click inside of a rehosted application, the TextBlock turns into a TextBox. When the TextBox looses focus, it turns back into a TextBlock.

There are two ways to use the ExpressionTextBox. The first way is to bind it to an argument, as you would in the Assign activity:

<swdv:ExpressionTextBox x:Uid="assignToExpression"
              Expression="{Binding Path=ModelItem.To, Mode=TwoWay, Converter={StaticResource ArgumentToExpressionConverter}, ConverterParameter=Out }" 
              OwnerActivity="{Binding Path=ModelItem}"
              UseLocationExpression="True"
              Name="assignToExpression"
              Width="85"
              Margin="0"
              HintText="&lt;To&gt;"
              Grid.Column="0"
              MaxLines="1"
               />

The second way is as not bound to argument, as in the If designer:

<swdv:ExpressionTextBox x:Uid="conditionBox" Loaded="OnExpressionEditorLoaded" Grid.Row= "1" Grid.Column= "0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" x:Name="conditionBox"
                      MinLines="5" MaxLines="20" MaxWidth="450" MinWidth="450" HorizontalAlignment="Stretch"
                      ExpressionType="{x:Type TypeName=sys:Boolean}" />

For more information, see: IExpressionEditorInstance and IExpressionEditorService.

Inheritance Hierarchy

System.Object
  System.Windows.Threading.DispatcherObject
    System.Windows.DependencyObject
      System.Windows.Media.Visual
        System.Windows.UIElement
          System.Windows.FrameworkElement
            System.Windows.Controls.Control
              System.Windows.Controls.ContentControl
                System.Activities.Design.View.ExpressionTextBox

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 4

See Also

Reference

ExpressionTextBox Members

System.Activities.Design.View Namespace