An unexpected caveat is found when attempting to modify the menubar buttons (enable/disable) on a WP7 application.
You can not (as you rightfully would expect) just reference the menubar buttons by name (x:name), and then access this in code. Due to reasons unknown to me, the menubar buttons are only accessible by index.
Due to this reason – you access (and manipulate) the button via ApplicationBar.Button[index] instead. In the below code sample, the ApplicationBarIconButton is retrieved via index and referenced as ‘b'.
void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
var b = (ApplicationBarIconButton)ApplicationBar.Buttons; //indx based!
b.IsEnabled = (pivItms.SelectedIndex == 1);