I have a pretty complicated task that I couldn't find much on resolving online. I have a WPF application consisting of a frame
connecting to different pages in it. Sometimes, depending on the screen size, the content can't fit inside. To combat this I added a scrollviewer
to the frame. Now the textbox height resize to the content within it. I need that size to stay the same size. But, when the window gets changed the textboxes need to be responsive. Not sure on how to limit changing the screen size only when needed. Here is some of my code:
Main.cs ~Holding the scrollviewer and frame
<ScrollViewer Grid.Row="2"
Grid.Column="1"
>
<Frame x:Name="ActiveItem"
NavigationUIVisibility="Hidden"
Background="White"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.CanContentScroll="False"
/>
</ScrollViewer>
Snippit of long ~2000 line:
<Grid.RowDefinitions>
<RowDefinition Height="3*" />
</Grid.RowDefinitions>
<TextBox x:Name="text"
Grid.Row="0" />
I need the textbox to only resize when the window resizes but stay the same when content is added to ensure the textbox overflows. Removing the Scrollviewer from the frame does allow the textbox to have the scrollbar but then the content can't fit on the screen.
Edit:
To simply the question, basically, I am asking how do you allow the textbox to only resize when the window resizes and not when a user adds content without specifying the height directly? Thank you to anyone who is able to assist with this conundrum!