1- Copy and paste the following code to the MainWindow.xaml file.
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<StackPanel>
<Button x:Name="Button1" Height="25" Width="100" Content="Press Me" Click="Button1_Click"/>
<TextBox x:Name="TextBox1" Width="400" Height="200" TextWrapping="Wrap" TextAlignment="Justify" AcceptsReturn="True"/>
</StackPanel>
2- Copy and paste the following code to the code behind file.
private void Button1_Click(object sender, RoutedEventArgs e)
{
System.Text.StringBuilder myStringBuilder = new System.Text.StringBuilder();
myStringBuilder.Append("Orange").AppendLine();
myStringBuilder.Append("").AppendLine();
myStringBuilder.Append("Apple").AppendLine();
myStringBuilder.Append("Banana").AppendLine();
myStringBuilder.Append("").AppendLine();
myStringBuilder.Append("Plum").AppendLine();
TextBox1.Text = myStringBuilder.ToString();
}
3- Run this project and then press Button1.
My question:
How can I manage desired result via only XAML code?
(I dont want to use C# code)