0
Answer

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

Photo of sean wang

sean wang

10y
1.7k
1
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? 
 
 
 

Answers (0)