locked
Metro Apps - TextBox, Scrolling RRS feed

  • Question

  • I am working on a metro app. What i want to know is , what codes would i use so that when i have textbox ,and when i type alot things into it. That  the scrollbar shows up so that the users can see the rest of the texts?

    Can you guys show me an ACTUAL code example , not something brief.

    Tuesday, June 5, 2012 1:18 AM

Answers

  • If you set the ScrollViewer.VerticalScrollBarVisibility to "Auto" then the scrollbar will show up when there is enough text to scroll. Set it to "Visible" and the scrollbar will always show.

    Here is Xaml to demonstrate it:

    <TextBox ScrollViewer.VerticalScrollBarVisibility="Auto" AcceptsReturn="True" Height="100"></TextBox>

    If you want to set it in code then give your TextBox a name (e.g. x:Name="testText") and call SetValue:
                testText.SetValue(ScrollViewer.VerticalScrollBarVisibilityProperty, ScrollBarVisibility.Auto);

    --Rob
    Tuesday, June 5, 2012 2:10 AM
    Moderator