Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8289529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:31:42+00:00 2026-06-08T12:31:42+00:00

So anyone out there knows of sample code or control that perfectly emulates the

  • 0

So anyone out there knows of sample code or control that perfectly emulates the Windows 8 Start Menu Tile Layout Engine?

It should support mixed Square and Rectangle Tiles, and repacks the square tiles over or under rectangle tiles properly.

Note: WrapPanel works if ALL TILES are Square. But once you mix in tiles that span 2-Squares worth of space, the layout breaks, and is inconsistent with the Windows 8 Start Menu

I am expecting code that extends the WPF Panel.


Disclaimer: Yes I have searched the Internet, the closest thing I’ve found is the CodeProject example, but that only works if all tiles are same-sized squares.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:31:43+00:00Added an answer on June 8, 2026 at 12:31 pm

    I’ve looked around myself and couldn’t find anything to do what I/we want. I knew that to get this behavior we’d need some sort of custom panel object, so I set about creating one…

    What it boils down to, is the tiles need to be arranged vertically, with double-width tiles taking up a whole row in that column, and normal width tiles to pair up. When it reaches the bottom of the container, it needs to create a new column and follow the same pattern.

    Here’s my implementation:

        public class MetroTilePanel : Panel
    {
        protected override Size ArrangeOverride(System.Windows.Size finalSize)
        {
            double x = 0, y = 0, colWidth = 0, rowHeight = 0;
            int col = 0;
            colWidth = Children.Cast<UIElement>().Select(c => c.DesiredSize.Width).Max();
    
            foreach (UIElement child in Children)
            {
                rowHeight = Math.Max(rowHeight, child.DesiredSize.Height);
    
                if (x + child.DesiredSize.Width > (colWidth * (col + 1)))
                {
                    // New row
                    y += rowHeight;
                    x = (colWidth * (col));
                    rowHeight = child.DesiredSize.Height;
                }
    
                if (y + rowHeight > finalSize.Height)
                {
                    // New column
                    col++;
                    x = (colWidth * (col));
                    y = 0;
                }
    
                child.Arrange(new Rect(x, y, child.DesiredSize.Width, child.DesiredSize.Height));
                x += child.DesiredSize.Width;
            }
            return finalSize;
        }
    
        protected override Size MeasureOverride(Size availableSize)
        {
            double x = 0, y = 0, colWidth = 0;
    
            foreach (UIElement child in Children)
            {
                child.Measure(availableSize);
    
                if (x + child.DesiredSize.Height > availableSize.Height)
                {
                    x += colWidth;
                    y = 0;
                    colWidth = 0;
                }
    
                y += child.DesiredSize.Height;
                if (child.DesiredSize.Width > colWidth)
                {
                    colWidth = child.DesiredSize.Width;
                }
            }
            x += colWidth;
    
            var resultSize = new Size();
    
            resultSize.Width = double.IsPositiveInfinity(availableSize.Width) ? x : availableSize.Width;
            resultSize.Height = double.IsPositiveInfinity(availableSize.Height) ? y : availableSize.Height;
    
            return resultSize;
        }
    }
    

    Screenshot of the control in action:
    enter image description here

    Disclaimers:

    • The MeasureOverride only works by chance, and isn’t setup correctly.
    • If you want the nice MetroTile layout, then stick to uniform sizes i.e 100×100 and 200×100
    • I haven’t fully tested it, but I will be implementing it into my fake-Metro app, so if you want to see any future changes, just holler.
    • If you want the proper GridView tiling behavior, then we’d have to create a brand new control (to support dragging items around etc).

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any tutorials or guides out there that anyone knows of that will
Anyone out there who knows what are the differences between BasicRenderEngine and LazyRenderEngine?
Is there anyone out there who knows if it's possible to use common web
I was wondering if there is any sample code out there for objective-C for
Does anyone out there know how to integrate ContentFlow ( http://www.jacksasylum.eu/ContentFlow ) and Lightbox2
I am curious to know whether anyone out there have tried mixing node.js headless
Anyone know of any re libraries out there to help parse columns, functions, and
Anyone out there using YAML as a data DSL in .NET? I'd like to
Anyone out there using the FTUtils library for iPhone development? Following the instructions here
Is anyone out there testing on a Samsung Galaxy S3 yet? Specifically, does it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.