PRISM Framework - Silverlight Data binding problem.
I faced the following problem with my Silverlight code...
1. Simple data binding to the silverlight control in the XAML file does not work.
2. Same code when used outside the ZFS app works fine (local project on my machine).
Binding method:
XAML way...
Back end code (Data context)
{
MyTextBlock.DataContext = new TextBindData() { TextValue = "Onewireless-ZFS program" };
}
Public class TextBindData
{
public string TextValue {get; set;}
}
3. The above code doesn’t throw any error but the binding just doesn’t work. This may be due to the PRISM framework usage.
4. If the control is created at run time and binded then it works.
Fix: Create the user control at run time….
...
TextBlock MyTextBlock = new TextBlock();
… // Add the control to Layout root
Now the binding should work just fine.
If you find a better fix for this problem; please let me know.
No comments:
Post a Comment