© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
8 replies
The Fog from Human Resources

Avalonia ViewLocator not ViewLocating

I have an Avalonia project with multiple pages like MainView and LoginView and SettingsView etc, pretty standard stuff
But now I have the following problem, trying to set my
ViewModelBase.ContentViewModel
ViewModelBase.ContentViewModel
to something will result in the
ContentViewModel
ContentViewModel
being
null
null
for no apparent reason

The program workflow goes like this:
The program starts -> the program sets the
DataContext
DataContext
to
new MainViewModel()
new MainViewModel()
-> MainViewModel checks if the user is logged in to an account, if not it will set
ContentViewModel
ContentViewModel
to
new LoginViewModel()
new LoginViewModel()
, in the LoginView the user is supposed to log into an account which is then supposed to set the
ContentViewModel
ContentViewModel
to a
new MainViewModel()
new MainViewModel()
, but instead the
ContentViewModel
ContentViewModel
is
null
null
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Avalonia Not Found
C#CC# / help
11mo ago
✅ Not understanding Avalonia Error
C#CC# / help
3y ago
Avalonia IconPath not showing up
C#CC# / help
2y ago
Avalonia Issue
C#CC# / help
10mo ago