|
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 |
|