sean wang

sean wang

  • NA
  • 1
  • 1.5k

An object reference is required for the non-static field,

Jul 13 2015 10:26 AM
I got this compile error
 
An object reference is reqired for the non-static field, method, or property MainWindow.MainRib
 
When I do
 
public static void toggle_visibility()
{
     foreach (var ribbonTab in MainRib.Items.OfType<RibbonTab>())
     ....
}
 
If I remove static, the error would be gone from here, but it will show up from the caller
MainWindow.toggle_visibility(). I can create an instance for the class MainRib, but then
that is not the instance I want to modify. So the question is how to modify MainRib
outside of the class?