Creating a SimpleStackPanel

Let’s look at replicating another existing panel, but one that does a bit more work while measuring and arranging. We’ll create a SimpleStackPanel that acts just like StackPanel. The only major difference between SimpleStackPanel and StackPanel is that our version is missing some performance optimizations. Listing 20.2 contains the entire implementation in the context of a Windows Store app.

LISTING 20.2 SimpleStackPanel.cs: The Implementation of SimpleStackPanel

using System;using Windows.Foundation;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;namespace CustomPanels{  public class SimpleStackPanel : Panel  {    // The direction of stacking    public static readonly DependencyProperty ...

Get XAML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.