Search code examples
wpfxamlscrolltextblock

Making textblock scroll


i currently have a textblock that is embedded in a large grid. I have read some post with regards to adding a grid/dockpanels and put the textblock inside.

In my XAML,

if i do this:

<Grid name="Large">
   <Scrollviewer>
      <Grid name="Small">
         <Textblock/>
      </Grid>
   </Scrollviewer>
</Grid>

i will get the vertical scroll bars in the "large" grid. My objective is to get scroll bars in the "small" grid. Anybody has any idea?


Solution

  • Move it down a level:

    <Grid name="Large">
       <Grid name="Small">
           <Scrollviewer>
              <Textblock />
           </Scrollviewer>
       </Grid>
    </Grid>