You are viewing limited content. For full access, please sign in.

Question

Question

Custom Activity custom property to enable Edit Control

asked on November 3, 2021

Hello,

I went through quite a few discussions and documentation about adding custom control but I am getting a bit lost.

 

I have a use case that I need to have a dropdown with options so that at design time in Workflow user can pick a value and it will be used in the custom activity.

I created a custom control by adding a comboBox (id TemplateList) following some suggestions to override certain methods. All I want is to capture what option is selected

public partial class TemplateSelection : EditPanelControlBase
    {
        public TemplateSelection()
        {
            InitializeComponent();
        }

        private string _selectedTemplateValue = String.Empty;

        public override void NotifyPanelShown()
        {
            this.UpdatePanel();
            base.NotifyPanelShown();
        }

        public override void Save()
        {
            this.Value = _selectedTemplateValue;
            base.Save();
        }

        private void UpdatePanel()
        {
            _selectedTemplateValue = this.Value.ToString();
            this.TemplateList.SelectedValue = _selectedTemplateValue;
        }


        private void TemplateList_SelectedIndexChanged(object sender, EventArgs e)
        {
            _selectedTemplateValue = TemplateList.SelectedValue.ToString();
            this.Save();
        }
    }

 

My questions are:

1. I found a Laserfiche sample by linking it to a list (list<string>). That example is to have a checklist and selected values will be added to a list of string.

In my case I want to have a dropdown list and I want to have 1 selected value.

Is List<string> a correct type? How can I get the selected value in my custom activity code? Is the expect to have the selection and it will map to the list<string> with 1 list item?

 

2. I read from a discussion that I can use type "object" as a property type. I was able to enable have the Edit Control option in proxy generator. However when I engage the custom activity, the configuration panel for the activity was not able to rendered properly

What are the possible property types that can enable the option Edit Control option in proxy generator? I can't find any documentation explaining that.

0 0

Replies

replied on November 4, 2021 Show version history

I found the answer myself.

For the record in case someone else had the difficulty figuring out the essential.

1 - To enforce the option to use a custom control, I need to set the property in the Custom Activity class as object first. Then I use Proxy Generator to assign the custom control to the property (in my case it is a combobox). Then I modify the same property in my Custom Activity class back to String. This way this property is just to expect the selected value from my combobox.

2 - The association between the custom activity class and the custom control is the following:    this.Value

Inside the custom control class when you refer to this.value, this refers to the property of the custom activity class defined by the proxy generator. 
Hence, in my case if I want to pass my combobox selection to my custom activity class public property I can have the following:

 private void TemplateList_SelectedIndexChanged(object sender, EventArgs e)
 {
      
        //---- TemplateList is my comboBox ---
        this.Value = TemplateList.Text;

}


3- after I removed those unnecessary NotifyPanelShown() or save() override, I was able to have the property panel rendered properly in Workflow Designer

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.