How to access CodeActivity In Argument Value in Code Behind

43 Views Asked by At

Can Someone please help me how to access Code Activity's InArgument in CodeBehind of xaml designer

I am trying to play around with Activity Designer for understanding From other posts on stack overflow I learned to use ModelItem is used for accessing argument values of CodeActivity in Xaml

But How to access the values in code behind ?

    [Designer(typeof(ActivityDesigner1))]
public class Class1 : CodeActivity
{   
public InArgument<String> FirstName { get; set; }
protected override void Execute(CodeActivityContext context)
{
    // Activity Action Logic
}
}

Here is the Activity Designer XAML

<sap:ActivityDesigner.Resources>
    <ResourceDictionary>
        <sapc:ArgumentToExpressionConverter x:Key="ArgumentToExpressionConverter" />
    </ResourceDictionary>
</sap:ActivityDesigner.Resources>
<Grid x:Name="MyGrid">
    <Grid.RowDefinitions>
        <RowDefinition Height="50">
            </RowDefinition>
        <RowDefinition Height="50"></RowDefinition>
    </Grid.RowDefinitions>
    <TextBox x:Name="MyBtn" Grid.Row="0" Text = "{Binding Path=ModelItem.FirstName, 
Converter={StaticResource ArgumentToExpressionConverter},ConverterParameter=In, 
Mode=TwoWay}" TextChanged="OnTextChange" />
</Grid>

And Here is the code Behind

public partial class ActivityDesigner1
{
    public ActivityDesigner1()
    {   
        InitializeComponent();
    }
    private void OnTextChange(object sender, RoutedEventArgs e)
    {
     // WANT TO ACCESS FirstName  HERE
    }


}
0

There are 0 best solutions below