file360

Log | Files | Refs

OccupyStack.cs (921B)


      1 using System;
      2 using System.Collections.Generic;
      3 using System.Linq;
      4 using System.Text;
      5 using System.Threading.Tasks;
      6 using Windows.UI.Xaml;
      7 using Windows.UI.Xaml.Controls;
      8 
      9 namespace File360
     10 {
     11     class OccupyStack : StackPanel
     12     {
     13         public OccupyStack()
     14         {
     15             foreach (Button but in Children)
     16             {
     17                 but.Height = ((Grid)Parent).ActualHeight;
     18                 but.Width = ActualWidth / Children.Count;
     19             }
     20             SizeChanged += OccupyStack_SizeChanged;
     21         }
     22 
     23         private void OccupyStack_SizeChanged(object sender, Windows.UI.Xaml.SizeChangedEventArgs e)
     24         {
     25             Width = Window.Current.Bounds.Width;
     26             UpdateLayout();
     27             foreach (Button but in Children)
     28             {
     29                 but.Height = ((Grid)Parent).ActualHeight;
     30                 but.Width = ActualWidth / Children.Count;
     31             }
     32         }
     33     }
     34 }