Attach() public method

Creates an associated ApplicationBarIconButton 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 AttachButton(BindableApplicationBarButton button, int i)
        {
            if (button.GetBindingExpression(
                    FrameworkElement.DataContextProperty) == null &&
                button.GetValue(
                    FrameworkElement.DataContextProperty) == null)
            {
                button.DataContext = this.DataContext;
            }

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