How to apply a Layout to a Panel in a certain circumstance

I have the following in my app:

<ScrollView>
  <StackPanel>
    <Each Items="{items}>
      <Panel>
        // stuff
      </Panel>
    </Each>
  </StackPanel>
</ScrollView>

How do I apply a <ColumnLayout> on the <StackPanel> only when the screen is a certain size

Hi,

You can decouple a Panel from it’s layout and use a Set to change the layout, e.g.:

<Panel ux:Name="panel">
    <StackLayout ux:Name="stackLayout" />
    <ColumnLayout ux:Name="columnLayout" ux:AutoBind="false" />
    <WhileWindowLandscape>
        <Set panel.Layout="stackLayout" />
    </WhileWindowLandscape>
    <WhileWindowPortrait>
        <Set panel.Layout="columnLayout" />
    </WhileWindowPortrait>
</Panel>

Note how ux:AutoBind="false" prevents the columnlayout from being added by default

@Anders this works thanks