Search code examples
c#wpfxamlgroupbox

How to wrap text in GroupBox header?


How to wrap text in GroupBox header? This code doesn't work.

<GroupBox>
<GroupBox.Header>
    <TextBlock Text="qwertyuiopasdfghjklqwertyuiopasdfghjkl" TextWrapping="Wrap"/>
</GroupBox.Header>


Solution

  • In-order to get the text content wrapped,You have to specify the width, other wise the with of the textblock automatically set to the length of content in the text block.

       <TextBlock Width="150" Text="qwertyuiopasdfghjklqwertyuiopasdfghjkl" TextWrapping="Wrap"/>