private void Redraw()
        {
            var properties = TypeDescriptor.GetProperties(viewModel.CollectionElementType).OfType<PropertyDescriptor>().Where(x => x.Attributes.OfType<ConfigurationPropertyAttribute>().Any()).ToArray();

            for (int n = 0; n <= viewModel.ChildElements.Count() + 1; n++)
            {
                Collection.RowDefinitions.Add(new RowDefinition());
            }

            int i = 0;
            foreach (var property in properties)
            {
                var label = new Label() { Content = property.DisplayName };
                Collection.Children.Add(label);
                label.SetValue(Grid.RowProperty, 0);
                label.SetValue(Grid.ColumnProperty, i);


                var gridSplitter = new GridSplitter() { Width = 2, HorizontalAlignment = HorizontalAlignment.Right };
                Collection.Children.Add(gridSplitter);
                gridSplitter.Focusable = false;
                gridSplitter.SetValue(Grid.RowProperty, 0);
                gridSplitter.SetValue(Grid.ColumnProperty, i);
                gridSplitter.SetValue(Grid.RowSpanProperty, viewModel.ChildElements.Count() + 1);
                i++;
            }

            ContextMenuButton addButton = new ContextMenuButton();
            Collection.Children.Add(addButton);
            CommandModel addCommand = viewModel.AddCommands.First();
            addButton.Command = addCommand;
            addButton.SetValue(Grid.RowProperty, 0);
            addButton.SetValue(Grid.ColumnProperty, i);
            addButton.Style = FindResource("ContextAdderButtonMenuStyle") as Style;
            addButton.VerticalAlignment = VerticalAlignment.Center;
            addButton.SetValue(AutomationProperties.AutomationIdProperty, addCommand.Title);
            
            int j = 1;
            foreach (var element in viewModel.ChildElements)
            {
                i = 0;
                foreach (var propertyDescriptor in properties)
                {
                    var property = element.Property(propertyDescriptor.Name);

                    ContentControl contentControl = new ContentControl();
                    contentControl.Focusable = false;
                    Collection.Children.Add(contentControl);
                    contentControl.SetValue(ContentControl.ContentProperty, property.BindableProperty);
                    contentControl.SetValue(Grid.RowProperty, j);
                    contentControl.SetValue(Grid.ColumnProperty, i);

                    i++;
                }

                Button deleteButton = new Button();
                Collection.Children.Add(deleteButton);
                CommandModel deleteCommand = element.Commands.Where(x => x.Placement == CommandPlacement.ContextDelete).First();
                deleteButton.Command = deleteCommand;
                deleteButton.SetValue(Grid.RowProperty, j);
                deleteButton.SetValue(Grid.ColumnProperty, i);
                deleteButton.Style = FindResource("DeleteButtonStyle") as Style;
                deleteButton.VerticalAlignment = VerticalAlignment.Center;
                deleteButton.SetValue(AutomationProperties.AutomationIdProperty, deleteCommand.Title);

                j++;
            }
        }
 /// <summary>
 /// Initializes a new instance of <see cref="ContextMenuButtonAutomationPeer"/>.
 /// </summary>
 /// <param name="owner">The owning <see cref="ContextMenuButton"/>.</param>
 public ContextMenuButtonAutomationPeer(ContextMenuButton owner)
     : base(owner)
 {
 }