locked
snap view and user control issue

    Question

  • In my app I use user control. If I put a user control in 'Full' view, such as

    <UserControl:Control1x:Name="Control1a"></UserControl:Control1>

    Do I have to define a different control for my 'Snap' view? Such as

    <UserControl:Control1x:Name="Control1b"></UserControl:Control1>

    If so, I will end up having 2 controls and I have to load data and manage them separately then?

    Monday, February 4, 2013 6:17 PM

Answers

  • It isn't an obligation to have different controls for each state. If you look at the Grid App template in Visual Studio 2012, you'll see that there are a GridView in Full view and a ListView in Snapped view.

    The reason for this is that it is easier to simply show or hide one of the two component than to modify its layout. But both controls are bound to the same collection of items, so you don't have to load and manage them separately.

    In your case, if your UserControl:Control1 renders nicely in Snapped view as well as in Full view, you don't have to use two different instances of your usercontrol. It's really up to you to decide what's best !

    Have a look at the VisualStateManager in the Grid App template. It will helps you adapt your view depending on its state!


    http://www.renauddumont.be


    • Edited by RenaudDumontMVP Monday, February 4, 2013 11:43 PM
    • Marked as answer by TChiang Wednesday, February 6, 2013 4:38 PM
    Monday, February 4, 2013 11:42 PM