A wrapper for an ApplicationBarMenuItem object that adds support for data binding.
To be used in BindableApplicationBar.MenuItems or BindableApplicationBar.MenuItemTemplate The class derives from FrameworkElement to support DataContext and bindings. Note that ApplicationBarMenuItem.Click event is not wrapped since /// the purpose of this class is to bind to view models and use Commands instead.
Inheritance: System.Windows.FrameworkElement
        private void DetachMenuItem(BindableApplicationBarMenuItem menuItem)
        {
            if (menuItem.GetBindingExpression(DataContextProperty) == null &&
                menuItem.GetValue(DataContextProperty) == this.DataContext)
            {
                menuItem.DataContext = null;
            }

            menuItem.Detach();
        }
        private void AttachMenuItem(
            BindableApplicationBarMenuItem menuItem, int i)
        {
            if (menuItem.GetBindingExpression(
                    FrameworkElement.DataContextProperty) == null &&
                menuItem.GetValue(
                    FrameworkElement.DataContextProperty) == null)
            {
                menuItem.DataContext = this.DataContext;
            }

            menuItem.Attach(this.applicationBar, i);
        }