Silverlight TextBlock Text Attribute vs Content?

The former can be bound, whilst the latter is particularly useful when combining Run s.

The former can be bound, whilst the latter is particularly useful when combining Runs: You have items.

The use of the Text property has become common as a result of previous versions of the Xaml parser but the placing the text as content is more natural especially if you have a background in HTML. The fact the many TextBlocks either have simple short chunks of literal text in or are bound. Would tip the balance IMO to using the Text property.In addition any globalisation that may come along latter may end with those literals being replaced by bindings as well.

AnthonyWJones is quite right: Localisation is a key factor here. In practice it usually means all fancy multiple value insertion is actually done elsewhere and only a single resulting text value is bound to the Text property. While the example with multiple runs is "ok" for hard-code English, it is not suitable for commercial applications.

– Tech Magic Sep 28 '10 at 18:19 1 @Tech: Anthony's point is certainly valid, but I'm calling BS on "not suitable for commercial applications". That depends entirely on whether globalisation is a requirement of said application, which is it often is not. – Kent Boogaart Sep 28 '10 at 19:08 @Kent Boogaart: Every application we develop nowadays should be expected to support localisation.To assume otherwise is a little short-siighted.

Should we really be encouraging bad habits (e.g. Hard-wiring text) for newbies? Sorry, but unless you have a better reason that "we don't always need to localise" I stand by my original comment. – Tech Magic Sep 29 '10 at 8:10 @ but that's ridiculous.

I could make the same "just-in-case" argument to justify all manner of wasteful effort. The reason is simple: globalization and localization takes extra effort, so if you know for a fact that the effort is unnecessary, you're wasting your own time and your client's money by supporting it. Of course, you should always make the trade-off clear to your client.

– Kent Boogaart Sep 29 '10 at 8:21 @Kent Boogaart: Allowing for the possibility of localisation is not the same as actually implementing it. Back to my original point If you use runs, you cannot easily localise those strings. That's all.

End of story.No extra time or cost to me or my clients. I have localised many dozens of apps, including legacy app, so you cannot possibly convince me to go back to hard-coding text anywhere :) – Tech Magic Sep 29 '10 at 8:49.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions