locked
How to set controls in a ScrollViewer? RRS feed

  • Question

  • Just trying to get a *simple* ScrollViewer to work in XAML in VS2013. The built-in Weather app has 7 "groups" of static controls (besides the main window). I'm just trying to add textboxes and textblocks to my app.

    What I don't understand is how to put static controls on the scrollviewer, whose placement will  exceed the width of the screen in the XAML editor? Or even if I put controls on another control, how do I get them into 'view' to edit them since they're hanging off the right of the XAML editor's screen?

    I see examples where controls are on an ItemsPanelTemplate (?).

    Any help is appreciated!


    Tuesday, January 28, 2014 8:58 PM

Answers

  • Hi JefffRozar,

    Why cant you directly put control into the ScrollViewer? Add them into ScrollViewer is fine.

            <ScrollViewer>
                  <your control here>
            </ScrollViewer>

    But unfortunately I don't think we can get the item into "view" when the item is "hide" by ScollViewer, only the outline can be seen. But if your control is hide by XAML designer, try uncheck the Clip to Display on Device panel.

    Hope this helps.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, January 29, 2014 3:01 AM
    Moderator
  • The ScrollViewer can only have one child control. Try wrapping both StackPanels in a Grid or another StackPanel:
    Wednesday, January 29, 2014 7:59 AM

All replies

  • Hi JefffRozar,

    Why cant you directly put control into the ScrollViewer? Add them into ScrollViewer is fine.

            <ScrollViewer>
                  <your control here>
            </ScrollViewer>

    But unfortunately I don't think we can get the item into "view" when the item is "hide" by ScollViewer, only the outline can be seen. But if your control is hide by XAML designer, try uncheck the Clip to Display on Device panel.

    Hope this helps.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, January 29, 2014 3:01 AM
    Moderator