Ah cool. Thanks. I'm actually doing this already for loading some xaml fragments from the database. I started wondering if Xamlreader.load might be the way to go but it seemed like a lot of trouble to go to just for a linebreak. Guess its a design time vs runtime issue.
cheers, Stephen On Sat, Jun 28, 2008 at 8:21 PM, Jonathan Parker <[EMAIL PROTECTED]> wrote: > I fixed this by using XamlReader.Load to create a StackPanel at runtime. > > > > Something like this: > > > > XamlReader.Load(@"<StackPanel xmlns="" > http://schemas.microsoft.com/client/2007"" > > xmlns:x="" > http://schemas.microsoft.com/winfx/2006/xaml""> > > <TextBlock TextWrapping=""Wrap"">" + > contentGoesHere + @"</TextBlock></StackPanel>"); > > > > The contentGoesHere string can have <LineBreak/> in it. > > Then you just add the stack panel as a child control to a control on your > page. > > > > It's a bit "dirty" but it works. > > > > *From:* [EMAIL PROTECTED] [mailto: > [EMAIL PROTECTED] *On Behalf Of *Stephen Price > *Sent:* Saturday, 28 June 2008 12:33 PM > *To:* [email protected] > *Subject:* [OzSilverlight] Text property vs Content > > > > Hi, > > I've got some text in a database which I'm binding to the Text property of > a TextBlock. > It doesn't seem to be honouring the tag's below > > <Run Text="First line of text here."/><LineBreak />This is the second line > of text.<LineBreak/>Third line. > > It works fine if I remove the binding and place the line above in between > the <TextBlock> and </TextBlock> elements. > I tried setting the property Text="<Run Text='First line of text > here.'/><LineBreak />This is the second line of > text.<LineBreak/>Third line." and it no longer worked. So it's not the > binding that is the problem here, it seems that anything in the Text > property is interpreted literally whereas the text in the content part of > the TextBlock (ie between the elements) can be proper Xaml. > > Is there a trick to get the Text property to be interpreted as Xaml and not > just a literal string? I need linebreaks with my bound data. > > thanks, > Stephen > ------------------------------------------------------------------- > OzSilverlight.com - to unsubscribe from this list, send a message back to > the list with 'unsubscribe' as the subject. > Powered by mailenable.com - List managed by www.readify.net > ------------------------------------------------------------------- > OzSilverlight.com - to unsubscribe from this list, send a message back to > the list with 'unsubscribe' as the subject. > Powered by mailenable.com - List managed by www.readify.net ------------------------------------------------------------------- OzSilverlight.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com - List managed by www.readify.net
