チャットアプリケーションを作成しようとしています。Label
一連のテキストを a内にラップして表示しようとしていますGrid
。
<Grid Grid.Row="2">
<Grid Margin="0,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Width="auto" MaxWidth ="300" Height="auto" HorizontalAlignment="Left" Margin="10,5,0,0" ScrollViewer.CanContentScroll="True">
<Grid.Background>
<ImageBrush ImageSource="Public\Images\chat_green-textarea.png"/>
</Grid.Background>
<Label Padding="5,0,5,5" Foreground="White" FontSize="15">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</Label>
</Grid>
</Grid>
<Image Source="Public\Images\chat_green-textarea-tail.png" Height="20" Width="30" VerticalAlignment="Top" Margin="-20,29.5,0,0"/>
</Grid>
</Grid>
ご覧のとおり、ラベル内のテキストがこの幅に達すると、ラベル内のすべてのテキストを処理するようにグリッドが高さを調整することを期待して、最大幅を設定しました。しかし、それはうまくいきません。初めての試みWPF
です。アイデアや提案はありますか?ありがとう!