Attach() public method

Creates an associated ApplicationBarMenuItem and attaches it to the specified application bar.
public Attach ( Microsoft.Phone.Shell.ApplicationBar parentApplicationBar, int i ) : void
parentApplicationBar Microsoft.Phone.Shell.ApplicationBar /// The application bar to attach to. ///
i int /// The index at which the associated /// will be inserted. ///
return void
        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);
        }