Inaccessible due to it's protection level :(

  • Thread starter Thread starter Integrater
  • Start date Start date
I

Integrater

Guest
In my main window (called MainWindow) class, at the top level (ie outside the constructor) I have instantiated a class called 'vm'. Inside vm I have a property called MyProperty (for the sake of simplicity).

I tried to read that property in a totally separate class like so: MainWindow.vm.MyProperty

The problem is vm is underlined red and I'm told that MainWindow.vm is inaccessible due to it's protection level. The Mainwindow class is public partial, the default and the class trying to access MainWindow.vm.MyProperty is just public. The property itself is also public and it's not static.

The vm class is a public class but the instance is not set to public, I didn't specify any access level, but if I do set it to public then the error changes and I'm told I need an object reference to access the property.

How can I access that property?

Thanks

Continue reading...
 
Back
Top