TextBox Not Sizing
-
I have an app that converts a PDF to a text file and displays the contents in a textbox inside a tab control. The contents of the file is then displayed in a textbox in the tab. Here's a screenshot[^]. The file loaded here is 3 1/2 pages long. It appears that the textbox has stretched past the bottom of the tab, yet the textbox's scroolbar is disabled and nothing scrolls, even when I drag select. Am I doing this wrong? Thanks Here's the relevant window XAML:
<TabControl Grid.Row="2"
Grid.Column="0"
ItemsSource="{Binding Files, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedFile, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="SteelBlue"
BorderThickness="1"
Margin="2,0,2,0"><TabControl.ItemContainerStyle> <Style TargetType="TabItem"> <Setter Property="Header" Value="{Binding FileName}"/> </Style> </TabControl.ItemContainerStyle>
</TabControl>
The DataTemplate for the tab is:
<Grid>
<Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="\*"/> </Grid.RowDefinitions> <TextBlock Grid.Row="0" Text="{Binding FullName}" Margin="2,2,2,5"/> <ScrollViewer Grid.Row="1"> <TextBox Text="{Binding FileContent}" Margin="2,0,2,2" BorderBrush="LightGray" BorderThickness="1" FontFamily="Courier New" FontSize="12"/> </ScrollViewer>
</Grid>
In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.