TextBoxを複数行入力できるようにする

2021-03-14

AcceptsReturn="True" を付ける。

MainWindow.xaml

<Window x:Class="WpfApp17.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp17"
        mc:Ignorable="d"
        Title="MainWindow" Height="250" Width="400"
        WindowStartupLocation="CenterScreen">

    <Grid>
        <TextBox Grid.Row="0" AcceptsReturn="True" Text="{Binding Text}" />
    </Grid>
</Window>