none
Multi-line string as resource

    Question

  • Hello, 

    Is there a way to define multi-line string as resource? I've found that it's possible to create muti-line string using 
 in xaml. It works fine if I set text directly to TextBlcok but if I use StaticResource 
 is converter to ' ' (space).

    <Window.Resources>
    	<System:String x:Key="MyString">Multi&#x0a;line</System:String>
    </Window.Resources>
    <StackPanel x:Name="LayoutRoot">
    	<TextBlock Text="Multi&#x0a;line"/> <!--Multi-line -->
    	<TextBlock Text="{StaticResource MyString}"/> <!--Single line -->
    </StackPanel>

     

    Monday, June 28, 2010 2:07 PM

Answers

  • This will work too:

        <Window.Resources>
            <System:String x:Key="MyString" xml:space="preserve">Line1
    Line2</System:String>
        </Window.Resources> 


    http://blog.voidnish.com
    Monday, June 28, 2010 2:41 PM
    Moderator
  • This work great! Thank you!

    <Window.Resources>
    	<System:String x:Key="MyString" xml:space="preserve">Multi&#x0a;line</System:String>
    </Window.Resources>
    <StackPanel x:Name="LayoutRoot">
    	<TextBlock Text="Multi&#x0a;line"/> 
    	<TextBlock Text="{StaticResource MyString}"/> 
    </StackPanel>
    

    Tuesday, June 29, 2010 6:55 AM

All replies