index > Windows Workflow Foundation > Bind the CurrentItem property of the ForEach activty

Bind the CurrentItem property of the ForEach activty

Hi everybody,

I'm trying to use the ForEach activity provided on http://wf.netfx3.com/files/folders/control_flow/entry93.aspx.

I have an array of "User" an I want to print the name of each User in a messagebox. I want to use my "MessageBox" Activty that have a property "Text"

Here is my problem: I want to bind the text Property to the field "Name" of the CurrentItem. But CurrentItem doesn't appear on the binding list.

The CurrentItem is of type "Object", maybe this is the problem..

Someone can help me?
AntoineF
Yep, you won't be able to bind it directly because the CurrentItem property is of type Object: types don't match, so no binding is allowed, plus since you don't have type information for the object in CurrentItem available at design time, you can't drill down to get the Name field, either. Plus, the property is marked as [Browsable(false)], which further hides it from the designer.

The simplest way around it would be not to use binding right now and instead use the events fired by the ForEach activity with a little bit of code. If you do want to use binding instead, you'll likely need to modify the ForEach activity so that it exposes a dynamic property of the right type, which requires a bit of design-time trickery.



Tomas Restrepo [MVP]
Tomas Restrepo
reply 2

You can use google to search for other answers

 

More Articles

• canceling an activity to reset itself?
• Create a code expression with RuleConditionDialog
• exception when removing glyph providers
• Problem in WorkflowRuntime.WorkflowCompleted event
• Multiple workflow/more complex examples.
• Editable Composites?
• Business Object to WF Instance - How to associate?
• How return the parameter back to the host application from workfl...
• Reusable conditions for ifelse activities
• Update WPF UI
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Retrieving current state
• How to make an Activity appear like an i
• IndexOutOfRangeException while invoking
• Beta 2 Debugging question for HOL 1
• Workflow Designer Flexibility
• rule hierarchies
• guidance on deployment
• Spanning a Transaction Across Workflows
• Hosting more then one workflow type
• Hosting designer on asp page
• The workflow failed validation
• sqlPersistence
• Hosting Workflow Runtime
• Custom Properties and SQL Persistence
• Problem in installing WinFX

Hot Articles

• Sql script files
• StartWorkflow() function - ss.RunWorkfl
• Looking for PPT sample code on netfx3.com
• Embedded designer with ifElseActivity do
• Difference using WorkflowQueuingService
• create WorkflowQueue
• Hosting WWF designer in own application
• Embedding Activity Designer, How to load
• ASP.NET Smart Page Navigation thorugh WWF
• Workflow Roles and Persistence
• Rule ReevaluationBehavior
• 'advanced' tracking
• Generic state workflow with limited access
• documentation for schema
• WWF for configurable event sink

Recommend Articles

• Rule Engine enough flexible?
• SQLWorkflowPersistenceService
• short circuit parrallel activity
• Way to get property from an persisted wo
• Designers built to access fields only?
• Designtime changed values (by code)
• Error Binding Activity Properties when d
• Project type is not supported by this in
• workflow persitence
• web.config windows workflow schema??
• Compile error when Namespace name =Workf
• custom SequenceActivity - howto execute
• Unknown error in workflow1.xoml
• HELP: Exception has been thrown by the t
• about wwf