Viewmodel not found

Topics: Getting Started
Jul 20, 2014 at 8:39 AM
I have an AppView and in this view I have an CustomerListView and offcource the viewmodels with the same name.

My AppView looks like:
<Window x:Class="Klanten_beheer.Views.AppView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="clr-namespace:Klanten_beheer.Views"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">

<Grid Height="Auto" Width="Auto" Background="AliceBlue">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>

    <local:CustomerListView Grid.Column="0"/>
    <local:CustomerView Grid.Column="2"/>
    <local:ContactView Grid.Column="4"/>

    <GridSplitter Grid.Column="1" Width="3" ResizeDirection="Auto" 
        HorizontalAlignment="Stretch" Background="Navy"
        VerticalAlignment="Stretch"/>

    <GridSplitter Grid.Column="3" Width="3" ResizeDirection="Auto" 
        HorizontalAlignment="Stretch"
        Background="Navy"
        VerticalAlignment="Stretch"/>
</Grid>
</Window>


and my customer list view like (only relevant peace that is):

<UserControl x:Class="Klanten_beheer.Views.CustomerListView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:caliburn="http://www.caliburnproject.org"
         xmlns:local="clr-namespace:Klanten_beheer.ViewModels"
         xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit">

<Border BorderBrush="Navy" BorderThickness="1">
    <Grid>

        <DockPanel  LastChildFill="True" Height="Auto" Width="Auto" Grid.Row="0">
            <Button x:Name="ToLastRecord" Content="&lt;&lt;" Background="LightSkyBlue" caliburn:Message.Attach="[Event Click] = [Action ToLastRecord()]"/>
When push the button a crash is the result telling me it can't find the ToLastRecord.

When I copy past the ToLastRecord to my AppViewModel it will execute this function instead.

I did check all the naming if it's correct and these seem ok.
AppViewModel
AppView

CustomerListViewModel
CustomerListView
Oct 27, 2014 at 9:16 PM
Hi,
I have simillar issue on Windows Phone 8 App. I found that TypeNameCache doesn't have any of ViewModels after injecting thats why It can't find the view model.