0

I've written the following TextBox for xaml:

<TextBox Padding="20,17,20,17"  BorderThickness="0" IsReadOnly="True" 
TextBlock.LineStackingStrategy="BlockLineHeight" TextBlock.LineHeight="24" 
VerticalAlignment="Center" Text="{Binding Ticket.MessageContent}"  
FontSize="14" FontFamily="HelveticaNeue" TextWrapping="Wrap" 
DockPanel.Dock="Top" />

However, it is in a dynamic window that messes up the lines the further you expand the window. I believe it has to do with the TextWrapping but I have tried WrapWithOverflow and this did not solve the problem. I have also tried to add a StackPanel with a Orientation=Horizontal but this makes the text go over the page. Does anyone know why this is happening?

enter image description here

enter image description here

user180708
  • 407
  • 1
  • 4
  • 16
  • 2
    Please show what the value of `Ticket.MessageContent` is (including any linebreaks). Also, please post what the desired result would look like. – Sudsy1002 May 15 '18 at 16:45
  • 1
    Setting _"TextWrapping"_ to _"Wrap"_ works perfectly for me - other than when there are embedded newline characters & a break always occurs there. Are you sure there are not newline characters after _"anything"_, _"was"_ & _"to"_? – PaulF May 15 '18 at 16:45

1 Answers1

0

Try setting TextBox properties with MaxLines="1" TextWrapping="NoWrap". Hope you can get something from this reference too > Multiline Text in a WPF Button

J. Bag
  • 1
  • 2