Answers for "mvvmlight System.Exception: Cannot find resource named 'Locator'. Resource names are case sensitive."

0

mvvmlight System.Exception: Cannot find resource named 'Locator'. Resource names are case sensitive.

I solved the problem by using the Startup event in the App, instead of overriding OnStartup.

<Application x:Class="TestWPF.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:vm="clr-namespace:TestWPF.ViewModels"
             Startup="App_Startup">
    <Application.Resources>
          <vm:ViewModelLocator x:Key="ViewModelLocator" />
    </Application.Resources>
</Application>
Code

public partial class App : Application
{
    void App_Startup(object sender, StartupEventArgs e)
    {
        var view = new ShellView();
        Current.MainWindow = view;
        Current.MainWindow.Show();
    }
}
Posted by: Guest on June-25-2020

Code answers related to "mvvmlight System.Exception: Cannot find resource named 'Locator'. Resource names are case sensitive."

Browse Popular Code Answers by Language