MapInfo Pro Developers User Group

Ribbon: StackPanels versus WrapPanels

  • 1.  Ribbon: StackPanels versus WrapPanels

    Posted 09-21-2018 07:46
    Edited by Peter Horsbøll Møller 10 days ago

    With v17.0 we have made a few more control types available for use in the ribbon interface: WrapPanel, RadioButton and CheckBox.

    In this post, we will take a closer look at the difference between the StackPanel and the WrapPanel.

    The main difference between these two, is that the WrapPanel automatically can wrap controls to the "next line" if the controls no longer fits within the given size of the panel.

    Here's an image illustrating this behaviour in a WrapPanel.

    Where you for StackPanel would get one long line of controls.

    If you only have a few controls and now the number, StackPanels are quite good. If you have a dynamic number of controls, you might get a better behaviour by using the WrapPanel that can spread the controls over multiple lines automatically.

    In the attached PDF document, you can find some sample code for working with WrapPanels and StackPanels in C# .NET.

    Also note that you can add multiple StackPanels to a SplitButton or DropDownButton to get a similar behaviour of a WrapPanel for a known number of controls.