Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you set the <code>AcceptsReturn</code> property in the <code>&lt;TextBox&gt;</code> XAML control to true, it will display the text in multiple lines. This sample app below does just that:</p> <p><strong>MainPage.xaml</strong></p> <pre><code>&lt;Grid x:Name="LayoutRoot" Background="Transparent"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="Auto"/&gt; &lt;RowDefinition Height="*"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"&gt; &lt;TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/&gt; &lt;TextBlock Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/&gt; &lt;/StackPanel&gt; &lt;Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="80" /&gt; &lt;RowDefinition Height="*" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Button Name="btnStart" Content="Click me" Click="btnStart_Click" /&gt; &lt;TextBox AcceptsReturn="True" Name="txtDebug" Grid.Row="1" /&gt; &lt;/Grid&gt; &lt;/Grid&gt; </code></pre> <p><strong>MainPage.xaml.cs</strong>:</p> <pre><code>public partial class MainPage : PhoneApplicationPage { public static MobileServiceClient MobileService = new MobileServiceClient( "https://YOUR-APP-NAME.azure-mobile.net/", "YOUR-APPLICATION-KEY" ); // Constructor public MainPage() { InitializeComponent(); } private async void btnStart_Click(object sender, RoutedEventArgs e) { try { var table = MobileService.GetTable&lt;Test&gt;(); var item = new Test { name = "Header Text \n• Item \n• Item \n• Item \n Header \n• Item" }; await table.InsertAsync(item); var inserted = await table.LookupAsync(item.id); this.txtDebug.Text = inserted.name; } catch (Exception ex) { this.txtDebug.Text = ex.ToString(); } } } public class Test { public int id { get; set; } public string name { get; set; } } </code></pre> <p><strong>Update after the edit to the original post</strong>. Using a <code>&lt;TextBlock&gt;</code> works just as well. As long as the text block is set up with a height of more than one line (in the example below, by binding it to a grid cell), it will display the multiple lines correctly, without the need for any additional property (like <code>AcceptsReturn</code> on text boxes). If you replace the control panel grid declaration in the XAML file above with the one below, you'll see that the multiple lines will be displayed on the text block.</p> <pre><code> &lt;Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="80" /&gt; &lt;RowDefinition Height="*" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Button Name="btnStart" Content="Click me" Click="btnStart_Click" /&gt; &lt;TextBlock Text="This will be replaced&amp;#10;after the call to the Mobile Service" Grid.Row="1" Margin="10" Name="txtDebug"/&gt; &lt;!--&lt;TextBox AcceptsReturn="True" Name="txtDebug" Grid.Row="1" /&gt;--&gt; &lt;/Grid&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload