Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline TextBox + Wrap with auto size window will grow textbox instead of line break #4789

Closed
sn4k3 opened this issue Oct 1, 2020 · 0 comments

Comments

@sn4k3
Copy link
Contributor

sn4k3 commented Oct 1, 2020

Not sure if this is a bug or is to work like this, but i have a Window with: CanResize="False" & SizeToContent="WidthAndHeight"

Then i have a textbox and tried two methods:

  <Grid RowDefinitions="Auto,10,Auto" ColumnDefinitions="*" >
    <TextBlock Text="Sentence:"/>

    <TextBox Grid.Row="2"
      Text="{Binding Operation.Sentence}"
      Watermark="Type your sentence here."
      Height="150"
      TextWrapping="Wrap"
      AcceptsReturn="True"
      />
    
  </Grid>

AND

  <StackPanel Spacing="10">
    <TextBlock Text="Sentence:"/>

    <TextBox 
      Text="{Binding Operation.Sentence}"
      Watermark="Type your sentence here."
      Height="150"
      TextWrapping="Wrap"
      AcceptsReturn="True"
      />
    
  </StackPanel>

Width is absent so it will strech to window, but i want to constrain content to control width without knowing the width or having one so it always match window width from all other content.

image

image

Is there a way to do this?
I'm thinking about after the window loads, set it to fixed width of current bounds so it will keep the optimal witdh and fix this problem, but there is another solution?

@sn4k3 sn4k3 closed this as completed May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant