locked
Invalid L-value expression when using an ExpressionTextBox RRS feed

  • Question

  • I am attempting to create an ActivityDesigner for a custom activity.  I have two ExpressionTextBox controls on the ActivityDesigner that bind to InArguments of the custom activity.  When I drop the custom activity on a workflow and edit either ExpressionTextBox, the ExpressionTextBox displays the error icon and shows a complile error "Invalid L-value expression".  The value in the ExpressionTextBox does not transfer to the property in the Properties window.

    If I edit the properties in the Properties window, the values are transfered back to the ActivityDesigner and everything works fine.  It appears that I'm real close, but I just can't figure out what is causing this error.  I've tried following this artical, but I still can't resolve the error:

    http://blogs.msdn.com/b/cathyk/archive/2010/03/22/using-an-expressiontextbox-in-a-custom-property-editor.aspx

    Here is my xmal for the custom activity designer:

    <sap:ActivityDesigner x:Class="ConditionActivityLibrary.ConditionActivityDesigner"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:s="clr-namespace:System;assembly=mscorlib"
      xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
      xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
      xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignWidth="431">
    
      <sap:ActivityDesigner.Resources>
        <ResourceDictionary>
          <sapc:ArgumentToExpressionConverter x:Key="ArgumentToExpressionConverter" />
          <sapc:ModelPropertyEntryToModelItemConverter x:Key="ModelPropertyEntryToModelItemConverter" />
        </ResourceDictionary>
      </sap:ActivityDesigner.Resources>
    
      <Grid DataContext="{Binding Converter={StaticResource ModelPropertyEntryToModelItemConverter}}">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="59*" />
          <ColumnDefinition Width="10*" />
          <ColumnDefinition Width="348*" />
        </Grid.ColumnDefinitions>
    
        <Grid.RowDefinitions>
          <RowDefinition/>
          <RowDefinition/>
        </Grid.RowDefinitions>
    
        <sapv:ExpressionTextBox 
         HintText="Enter a VB expression"
         Expression="{Binding Path=ModelItem.Rule, Mode=TwoWay, Converter={StaticResource ArgumentToExpressionConverter}, ConverterParameter=In }"
         ExpressionType="s:Boolean"
         OwnerActivity="{Binding Path=ModelItem}"
         UseLocationExpression="True" Margin="0,5" Grid.Column="2"
         MaxLines="1" />
    
        <sapv:ExpressionTextBox 
         HintText="Enter a VB expression"
         Expression="{Binding Path=ModelItem.Message, Mode=TwoWay, Converter={StaticResource ArgumentToExpressionConverter}, ConverterParameter=In }"
         ExpressionType="s:String"
         OwnerActivity="{Binding Path=ModelItem}"
         UseLocationExpression="True" Margin="0,5"
         Grid.Row="1"
         Grid.Column="2"
         MaxLines="1" />
    
        <Label Content="Rule:"
         Width="110"
         Margin="0,5"
         Grid.Row="0"
         Grid.Column="0"
         Height="28" 
         HorizontalAlignment="Left"
         Name="lblRule"
         VerticalAlignment="Top" />
    
    
        <Label Content="Message:"
         Width="110"
         Margin="0,5"
         Grid.Row="1"
         Grid.Column="0"
         Height="28" 
         HorizontalAlignment="Left"
         Name="lblMessage"
         VerticalAlignment="Top" />
    
      </Grid>
    
    </sap:ActivityDesigner>
    

     I would appreciate any help to resolve this error.

    Thanks,

    Al

     

     

     

     

    Tuesday, May 25, 2010 3:05 AM

Answers

  • Hi,

    ->"the ExpressionTextBox displays the error icon and shows a complile error "Invalid L-value expression".  The value in the ExpressionTextBox does not transfer to the property in the Properties window."
    Are you sure that you input the right type? In your xaml code, one expressionTextBox is for boolean type value, the other one is for String type.

    I also wrote such a custom activity, and it may be helpful to you:
    http://xhinker.com/2010/03/16/WF4CreateACustomActivity.aspx

    Regards


    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support
    • Marked as answer by AVO2 Friday, May 28, 2010 4:41 AM
    Thursday, May 27, 2010 5:55 AM
  • Hi,

    ->"By the way, I noticed the collapse feature does not work when I place the activity in a FlowChart Activity.  I have to double-click to see the designer.  Do you know why this would be?"
    It is a By-Design. When they create FlowChart activity, collapsing messes the display of workflow. We may have this feature in the next version.

    Thanks
    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support
    • Marked as answer by AVO2 Friday, May 28, 2010 4:40 AM
    Friday, May 28, 2010 1:17 AM

All replies

  • Hi,

    ->"the ExpressionTextBox displays the error icon and shows a complile error "Invalid L-value expression".  The value in the ExpressionTextBox does not transfer to the property in the Properties window."
    Are you sure that you input the right type? In your xaml code, one expressionTextBox is for boolean type value, the other one is for String type.

    I also wrote such a custom activity, and it may be helpful to you:
    http://xhinker.com/2010/03/16/WF4CreateACustomActivity.aspx

    Regards


    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support
    • Marked as answer by AVO2 Friday, May 28, 2010 4:41 AM
    Thursday, May 27, 2010 5:55 AM
  • The data types are correct.

    I used your example and it works.  I noticed a few differences (i.e., the collapsable template and no grid) between your approach and the other samples I was using.  I originally followed the ExpressionTextBox Sample and that had the same issue with the "Invalid L-value expression".  I'm not sure why yours works and the other two examples I followed did not work -- maybe the Grid has something to do with it.

    By the way, I noticed the collapse feature does not work when I place the activity in a FlowChart Activity.  I have to double-click to see the designer.  Do you know why this would be?

    Al

    Thursday, May 27, 2010 6:28 PM
  • Hi,

    ->"By the way, I noticed the collapse feature does not work when I place the activity in a FlowChart Activity.  I have to double-click to see the designer.  Do you know why this would be?"
    It is a By-Design. When they create FlowChart activity, collapsing messes the display of workflow. We may have this feature in the next version.

    Thanks
    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support
    • Marked as answer by AVO2 Friday, May 28, 2010 4:40 AM
    Friday, May 28, 2010 1:17 AM
  • Thanks!
    Friday, May 28, 2010 4:40 AM