Partial Classes with ViewModels

ClintonRocksmithClintonRocksmith AUMember, University, Developer Group Leader

Hey there,

I generally like to separate my ViewModels into a bunch of partial classes so I know what logic is where.

For instance, I have a Base.cs which has the implementation for INotifyPropertyChanged, I also have a file for all the properties that are displayed on the screen, 1 for the network connection, 1 for the loading of settings etc.

The problem I have with Xamarin Studio is that the partial classes cannot see the values, members and methods in the other partial classes. Thus requiring me to put all my logic and code into a single file. I'm used to the Mvvm pattern with Silverlight and Visual Studio and partial classes work as a single one in that, am I missing something to join them altogether in the Xamarin Studio IDE?




  • MihaMarkicMihaMarkic SI ✭✭✭✭

    Are you talking about inheritance or partial classes? One would usually use partial classes when part of the code is autogenerated (i.e. designer or some other tooling) but otherwise I don't see any advantage of those.

  • ClintonRocksmithClintonRocksmith AUMember, University, Developer Group Leader

    Not inheritance, but actual partial classes for logical separation of concerns and code readability. Xamarin Studio behaves the same way as VS2013 with the new "Shared" type, must be because it's so new as a type that intellisense doesn't work yet.

Sign In or Register to comment.