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); }