Wednesday, June 26, 2019 ..:: Home ::.. Register  Login
All blog entries are the opinions of the author and do not necessarily reflect the opinions of their employer. All the code presented is for explanation and demonstration purposes only. Any damages incurred to your site and/or data are not the responsibility of the author. Every effort is taken to ensure the code properly compiles, however sometimes there are some hiccups and you might be required to do your own debugging.
   TechTidBits (Blog)  

What's the non-breaking whitespace code in XAML?

Apr 13

Written by:
Tuesday, April 13, 2010 11:33 PM  RssIcon

WP7What is the equivalent of the non-breaking whitespace in XAML?

WP7We've all been there in the past!  You're writting a document and the date you're typing out wraps lines.  Shoot!  It just doesn't look correct.  So what do you do?  If you're in Microsoft Word, you hit CTRL+SHIFT+SPACE to get what's called a non-breaking whitespace character.  Looks EXACTLY like a regular whitespace/space you'll get when you hit the spacebar, BUT this one's special!  No, it's not a Leafs fan! LOL  No, it's specially formulated to keep the adjacent words together, as if it were in fact ONE word.  Very cool eh?! 

The only problem is, HOW DO YOU DO THAT IN XAML?  DOH!  If you try HTMLs   you'll get, well, those exact same characters outputted.  DOH, not what I was looking for.

Well, it turns out, according to MSDN, there is something like the & nbsp; but the UTF-8 equivalent for XAML called & #160;.  Here's what it does, check out the Ottawa IT Day in the text for my WP7 app.

Text with breaking spaces Text with non breaking spaces

COOL!  Now I just have to remember the code & #160; (yes, without the space inside it, I had to put it in there otherwise, when you're viewing this blog, it'll show, uuuhhh a space?! LOL DOH!).  Now that you know a little formatting trick, it's time to grab a coffee and get coding!



MSDN: Whitespace Processing in XAML, look for Preserving Whitespace

TechRepublic: Use a nonbreaking space to keep words togethter

Location: Blogs Parent Separator TechTidBits

2 comment(s) so far...

Re: What's the non-breaking whitespace code in XAML?

I'm noticing a trend with the coffee here :P

By on   Wednesday, April 14, 2010 12:44 PM

Re: What's the non-breaking whitespace code in XAML?

HAHA! OH YAAAAAA! Since my Habs are not doing so well this year, AND the lack of sleep married to the uber-late nights lately, caffeine is definitely in high demand. In other words, get out of my way and make sure the coffee machine's a flowing this week, NON-STOP! LOL

By phenry on   Wednesday, April 14, 2010 12:45 PM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Add Comment   Cancel 
Copyright 1999-2012 by   Terms Of Use  Privacy Statement