|
index > Windows Workflow Foundation > Misunderstanding about Binding |
|
Misunderstanding about Binding |
|
|
hi,
I'm trying to bind the Message property of a MessageBoxActivity to the text property of a custom activty.
in messageboxActivity:
public static DependencyProperty MessageProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Message", typeof(string), typeof(MessageActivity));
private string message;
public string Message { get { return message; } set { message = value; } }
in custom activity:
public static DependencyProperty TextProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Text", typeof(string), typeof(Activity1));
private string _text;
public string Text { get { return _text; } set { _text = value; } }
but when I bind message to text, the messagebox is empty, whereas i've filled the Text property before compiling and when I use it in conditions or in a code activity, the Text property got the right value
Any idea in this really basic issu?
Antoine
| | AntoineF | Your properties are declared incorrectly. The .NET properties should be implemented in terms of the corresponding dependency property, like this:
public
static DependencyProperty MessageProperty =
System.Workflow.ComponentModel.DependencyProperty.Register("Message",
typeof(string), typeof(MessageActivity));
public string Message { get { return (string)base.GetValue(MessageProperty); } set { base.SetValue(MessageProperty, value); } } | | Tomas Restrepo | ok that was the mistake!
thx a lot
ps: just don't forget to add the RETURN in the get for those who will take this code
Edit: Ok it's fixed ;)
| | AntoineF | Duh, yeah, fixed it :) That happens for writing code directly into the post :)
Tomas Restrepo [MVP] | | Tomas Restrepo |
|
|
| reply 4 |
|
|
|
You can use google to search for other answers |
|
|
|
|
More Articles |
|
| Raising Events from the Service in the Workflow Runtime |
| Workflow Activities for MSBuild Tasks and embedded designer for V... |
| How to Cancel current waiting activity |
| Rehydration and member variables |
| MCMS Project Templates |
| Communication between Workflow Instances without Runtime Service |
| Custom Service loading from a different client request |
| Problem when serializing an array property |
| Is WF the right solution for InfoPath/WSS, when BizTalk is in pla... |
| Modifying instance members from the host |
|