/// <summary>
        /// Handles changes to the ActiveForeground property.
        /// </summary>
        /// <param name="d">PivotHeaderControl</param>
        /// <param name="e">DependencyProperty changed event arguments</param>
        private static void OnActiveForegroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PivotHeaderControl header = (PivotHeaderControl)d;
            Brush oldActiveForeground = (Brush)e.OldValue;
            Brush newActiveForeground = header.ActiveForeground;

            header.OnActiveForegroundChanged(oldActiveForeground, newActiveForeground);
        }
        /// <summary>
        /// Handles changes to the IsActive property.
        /// </summary>
        /// <param name="d">PivotHeaderControl</param>
        /// <param name="e">DependencyProperty changed event arguments</param>
        private static void OnIsActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PivotHeaderControl header = (PivotHeaderControl)d;
            bool oldIsActive          = (bool)e.OldValue;
            bool newIsActive          = header.IsActive;

            header.OnIsActiveChanged(oldIsActive, newIsActive);
        }
        protected override System.Windows.DependencyObject GetContainerForItemOverride()
        {
            PivotItem pi = new PivotItem { PivotHeader = new TextBlock { Text = "header" }, PivotContent = new TextBlock { Text = "content" } };
            pi.Content = "yeah";
            string[] colors = new string[] { "premier", "second", "third", "fourth" };
            PivotHeaderControl tb = new PivotHeaderControl();
            tb.FontFamily = new FontFamily("Segoe WP");
            tb.FontWeight = FontWeights.Light;
            tb.ActiveForeground = Brushes.White;
            tb.InactiveForeground = new SolidColorBrush(Color.FromRgb(48, 48, 48));
            tb.FontSize = 64;
            tb.Content = colors[1];
            tb.Margin = new Thickness(20, 0, 0, 0);

            PivotContentControl pci = new PivotContentControl();
            ListBox lb = new ListBox()
            {
                FontFamily = new FontFamily("Segoe WP"),
                FontSize = 32,
                FontWeight = FontWeights.Light,
                Foreground = Brushes.Gray,
                Background = Brushes.Black,
                BorderThickness = new Thickness(0),
            };
            lb.ItemTemplate = (DataTemplate)this.Resources["ListBoxItemTemplate"];
            lb.ItemsSource = "test";
            ScrollViewer.SetHorizontalScrollBarVisibility(lb, ScrollBarVisibility.Disabled);
            lb.HorizontalAlignment = HorizontalAlignment.Stretch;
            lb.VerticalAlignment = VerticalAlignment.Stretch;
            lb.Margin = new Thickness(30, 10, 10, 10);
            pci.Content = lb;

            pi = new PivotItem { PivotHeader = tb, PivotContent = pci };
            return new Button { Content = "oky" };
            //return pi;
              //  return base.GetContainerForItemOverride();
        }
        private void InitializeFluidPivotPanel()
        {
            var items = new ObservableCollection<PivotItem>();

            var colors = new[] { "first", "second", "disabled", "fourth" };
            var brushes = new Brush[] { Brushes.Orange, Brushes.Green, Brushes.Blue, Brushes.Magenta, Brushes.Cyan };
            var data = new List<List<TextMessage>>
            {
                new List<TextMessage>()
                {
                    new TextMessage {MainText = "design one", SubText = "Lorem ipsum dolor sit amet"},
                    new TextMessage {MainText = "design two", SubText = "consectetur adipisicing elit"},
                    new TextMessage {MainText = "design three", SubText = "sed do eiusmod tempor incididunt"},
                    new TextMessage {MainText = "design four", SubText = "ut labore et dolore magna aliqua"},
                    new TextMessage {MainText = "design five", SubText = "Ut enim ad minim veniam"},
                    new TextMessage {MainText = "design six", SubText = "quis nostrud exercitation ullamco laboris"},
                    new TextMessage {MainText = "design seven", SubText = "nisi ut aliquip ex ea commodo consequat"}
                },
                new List<TextMessage>()
                {
                    new TextMessage {MainText = "runtime one", SubText = "Lorem ipsum dolor sit amet"},
                    new TextMessage {MainText = "runtime two", SubText = "consectetur adipisicing elit"},
                    new TextMessage {MainText = "runtime three", SubText = "sed do eiusmod tempor incididunt"},
                    new TextMessage {MainText = "runtime four", SubText = "ut labore et dolore magna aliqua"},
                    new TextMessage {MainText = "runtime five", SubText = "Ut enim ad minim veniam"},
                    new TextMessage {MainText = "runtime six", SubText = "quis nostrud exercitation ullamco laboris"},
                    new TextMessage {MainText = "runtime seven", SubText = "nisi ut aliquip ex ea commodo consequat"}
                },
                new List<TextMessage>()
                {
                    new TextMessage {MainText = "method one", SubText = "Lorem ipsum dolor sit amet"},
                    new TextMessage {MainText = "method two", SubText = "consectetur adipisicing elit"},
                    new TextMessage {MainText = "method three", SubText = "sed do eiusmod tempor incididunt"},
                    new TextMessage {MainText = "method four", SubText = "ut labore et dolore magna aliqua"},
                    new TextMessage {MainText = "method five", SubText = "Ut enim ad minim veniam"},
                    new TextMessage {MainText = "method six", SubText = "quis nostrud exercitation ullamco laboris"},
                    new TextMessage {MainText = "method seven", SubText = "nisi ut aliquip ex ea commodo consequat"}
                },
                new List<TextMessage>()
                {
                    new TextMessage {MainText = "solution one", SubText = "Lorem ipsum dolor sit amet"},
                    new TextMessage {MainText = "solution two", SubText = "consectetur adipisicing elit"},
                    new TextMessage {MainText = "solution three", SubText = "sed do eiusmod tempor incididunt"},
                    new TextMessage {MainText = "solution four", SubText = "ut labore et dolore magna aliqua"},
                    new TextMessage {MainText = "solution five", SubText = "Ut enim ad minim veniam"},
                    new TextMessage {MainText = "solution six", SubText = "quis nostrud exercitation ullamco laboris"},
                    new TextMessage {MainText = "solution seven", SubText = "nisi ut aliquip ex ea commodo consequat"}
                }
            };

            for (var i = 0; i < colors.Count(); i++)
            {
                var tb = new PivotHeaderControl
                {
                    FontFamily = new FontFamily("Segoe UI"),
                    FontWeight = FontWeights.Light,
                    ActiveForeground = Brushes.White,
                    InactiveForeground = new SolidColorBrush(Color.FromRgb(48, 48, 48)),
                    DisabledForeground = Brushes.Red,
                    FontSize = 42,
                    Content = colors[i],
                    Margin = new Thickness(20, 0, 0, 0),
                    IsEnabled = !((i > 0) && ((i % 2) == 0))
                };

                var pci = new PivotContentControl();
                var lb = new ListBox
                {
                    FontFamily = new FontFamily("Segoe UI"),
                    FontSize = 24,
                    FontWeight = FontWeights.Light,
                    Foreground = brushes[i],
                    Background = new SolidColorBrush(Color.FromRgb(16, 16, 16)),
                    BorderThickness = new Thickness(0),
                    ItemTemplate = (DataTemplate)this.Resources["ListBoxItemTemplate"],
                    ItemsSource = data[i],
                };
                ScrollViewer.SetHorizontalScrollBarVisibility(lb, ScrollBarVisibility.Disabled);
                lb.HorizontalAlignment = HorizontalAlignment.Stretch;
                lb.VerticalAlignment = VerticalAlignment.Stretch;
                lb.Margin = new Thickness(30, 10, 10, 10);
                pci.Content = lb;

                var pi = new PivotItem { PivotHeader = tb, PivotContent = pci };
                //pi.SetActive(false);
                items.Add(pi);
            }

            RootPivotPanel.ItemsSource = items;

            RootPivotPanel.Background = new SolidColorBrush(Color.FromRgb(16, 16, 16));
        }