locked
ExpressionTextBox validity state propagated to Root activity RRS feed

  • Question

  • Hi

    In my re-hosted WF designer app scenario  I have to re-implement  DynamicArgumentDialog  in order to avoid argument name, type and argument direction being modified by user (as wll as adding new Argument), leaving only ExpressionTextBox to be editable.

    When I close the dialog leaving ExpressionTextBox with validation error, the error sign (red circle) is NOT displayed on owner Activity.

    What do I do wrong ?

    Or is there a way to use DynamicArgumentDialog customized to my requirement ? 

    Thanks

    Here is the DataGrid with column containing ETB :

     <DataGrid Name="DG1" AutoGenerateColumns="False" CanUserReorderColumns="False" 
             CanUserAddRows="False" CanUserDeleteRows="False" 
             CanUserSortColumns="False" Margin="0,0,0,29" Width="Auto" Height="Auto">
          <DataGrid.Columns>
            <DataGridTextColumn Binding="{Binding Path=Name}" Header="Name" />
            <DataGridTextColumn Binding="{Binding Path=ArgumentDirection}" Header="Direction" />
            <DataGridTextColumn Binding="{Binding Path=ArgumentType.Name}" Header="Type" />
            <DataGridTemplateColumn ClipboardContentBinding="{x:Null}" Header="Value">
              <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                  <sapv:ExpressionTextBox
                    Expression="{Binding Path=Argument, Mode=TwoWay, ValidatesOnExceptions=True, ValidatesOnDataErrors=True, Converter={StaticResource ArgConv}}"
                    ExpressionType="{Binding Path=ArgumentType}"
                    OwnerActivity="{Binding Path=OwnerActivity}" MinWidth="100" 
                    UseLocationExpression="{Binding Path=UseLocationExpression}"          
                    MinLines="1" MaxLines="1"
                    ExplicitCommit="True"
                    LostFocus="ExpressionTextBox_LostFocus"
                    />
                </DataTemplate>
              </DataGridTemplateColumn.CellTemplate>
            </DataGridTemplateColumn>
          </DataGrid.Columns>
        </DataGrid>
    


    Dialog class:

     public partial class WebServiceCallArgumentsDialog : WorkflowElementDialog {
        private ObservableCollection<Wrapper> arguments = new ObservableCollection<Wrapper>();
        private ModelItemDictionary _data;
        public WebServiceCallArgumentsDialog ( ModelItemDictionary data , EditingContext context,ModelItem activity ) {
          _data = data;
          Context = context;
          ModelItem = activity;
          Owner = activity.View;
           foreach( var modelItem in data) {
             arguments.Add(new Wrapper {
            Name = modelItem.Key.GetCurrentValue() as string,
            Argument = modelItem.Value,
            OwnerActivity = activity
             }
            );
             
           }
          this.InitializeComponent ();
          
        }
        protected override void OnInitialized ( EventArgs e ) {
          base.OnInitialized ( e );
          DG1.ItemsSource = arguments;
        }
    }
    
    public class Wrapper{
        public string Name { get; set; }
        public ModelItem _Argument;
        public ModelItem Argument {
          get{
            return _Argument;
          }
          set{
            if(null == _Argument) {
              ArgumentType = (value.GetCurrentValue () as Argument).ArgumentType;
              UseLocationExpression = (value.GetCurrentValue () as Argument).Direction != ArgumentDirection.In;
              ArgumentDirection = (value.GetCurrentValue () as Argument).Direction;
            }
            _Argument = value;
            
          }
        }
        
        public Type ArgumentType {
          get;
          private set;
        }
        
        public ArgumentDirection ArgumentDirection {
          get;
          private set;
        }
        public bool UseLocationExpression {
          get;
          private set;
        }
        public ModelItem OwnerActivity {
          get;
          set;
        }
      }
    


     

    Wednesday, June 29, 2011 10:36 AM

All replies