(X) Hide this Upcoming webinar by Brian Noyes: Querying and Updating Data From Silverlight Clients with WCF RIA Services. February 2nd, 10 am PST (see your local time)
Full webinar info | Register | Read WCF RIA Services Article series by Brian Noyes
Become a member to receive all webinar news by email, or follow all webinar news on Twitter | Facebook | LinkedIn
Skip Navigation LinksHome / Articles / View Article

Code to support new features doesn't write itself [HtmlTextBlock sample gets data binding support!]

+ Add to SilverlightShow Favorites
0 comments   /   aggregated from Delay's Blog on Mar 18, 2008  /  original article
(0 votes)
Categories: Misc

In the comments to my post about porting the HtmlTextBlock sample to Silverlight 2 Beta 1, kind reader eibrahim pointed out that Silverlight 2's data binding feature wasn't working with HtmlTextBlock. I explained why in a reply to that comment:

This is a consequence of me doing as simple a port as possible. :( Recall that Silverlight 1.1 Alpha did not support data binding, so this issue simply couldn't exist there. Now that Silverlight 2 Beta 1 supports data binding, HtmlTextBlock needs a minor change to support it. In particular, its properties need to be backed by DependencyProperties in order for data binding to work as we'd like. I'll be updating the sample soon to add this support ...

I've just finished updating the code to back each of the settable HtmlTextBlock properties that mirror TextBlock properties with a DependencyProperty in order to enable data binding and maintain HtmlTextBlock as "plug-compatible" with TextBlock as possible. Most of this was pretty straightforward (boring) typing, so I'll confess that I have not tested each property individually. :| But I did create a simple project (attached to this post) demonstrating HtmlTextBlock data binding - both standalone and within a ListBox DataTemplate - that interested readers can use to play around with this. I've also updated the HtmlTextBlock.cs file in the existing HtmlTextBlock source code download.

Thanks for the feedback, eibrahim, I hope you and others find that the new data binding support works well and enables even more compelling scenarios!

Share


Comments

Comments RSS RSS
No comments

Add Comment

 
 

   
  
  
   
Please add 3 and 4 and type the answer here: