Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. TextBox Not Sizing

TextBox Not Sizing

Scheduled Pinned Locked Moved WPF
wpfcsswcfhelpquestion
1 Posts 1 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups