Monday, 1 October 2012

How to make ReadProjectProperty works

I don't know whether this is an intended behaviour or not, but when you click on the button in property PropertyValues, it will always open dialog string collection editor.  But actualy this should point to a variable in code behind that will store the value from project information.  Assigning variable string[] (using ReadProjectProperty1.PropertyValues = arrayOfStringVariable) in code behind manualy also doesn't seem to work either.  You need to use ActivityBind method for this to work.  This is how i did (_projectName is variable string[]):
ActivityBind activityBindReadProjectName = new ActivityBind();
activityBindReadProjectName.Name =  "Workflow1";
activityBindReadProjectName.Path = "_projectName";
this.ReadProjectName.SetBinding(Microsoft.Office.Project.Server.Workflow.ReadProjectProperty.PropertyValuesProperty, ((System.Workflow.ComponentModel.ActivityBind)(activityBindReadProjectName)));
 
 I put that code in Workflow1.Designer.cs class file inside InitializeComponent().

Edit: actually you can bind that PropertyValues from designer by pressing database icon next to PropertyValues, this will allow you to select variable you want to bind

No comments:

Post a Comment