Wpf MVVM–;教程中的第一个应用程序点类型';MVVM.Views.StudentView';没有定义

Wpf MVVM–;教程中的第一个应用程序点类型';MVVM.Views.StudentView';没有定义,wpf,vb.net,mvvm,Wpf,Vb.net,Mvvm,我是MVVM和WPF的初学者 Iam使用VB.NET 2015 我试着用C语言编写教程和代码,虽然我使用vb.net,但我使用telerik将C语言转换为vb语言。我做了本教程中的所有事情。但我还是有个例外: BC3002: 未定义类型“BillingBersama.BillingBersama.Views.StudentView”。。MainWindow.xaml 67 行错误,MainWindow.xaml: <views:StudentView x:Name="StudentView

我是MVVM和WPF的初学者 Iam使用VB.NET 2015 我试着用C语言编写教程和代码,虽然我使用vb.net,但我使用telerik将C语言转换为vb语言。我做了本教程中的所有事情。但我还是有个例外:

BC3002: 未定义类型“BillingBersama.BillingBersama.Views.StudentView”。。MainWindow.xaml 67

行错误,MainWindow.xaml:

<views:StudentView x:Name="StudentViewControl" Loaded="StudentViewControl_Loaded" />
StudentView.xaml

Application.xaml



就这样。如果有人能告诉我这里发生了什么?为什么我会犯这个错误

没有足够的信息告诉你。删除解决方案中的所有bin/obj文件夹。重新启动VisualStudio。全部重建。如果这不能解决问题,请删除StudentView并重新创建它。不要复制XAML中生成的根元素,也不要复制codebehind中生成的命名空间和类名。我已尝试删除bin/obj/excluded文件夹中的所有内容,并尝试从头开始编写代码,但我遇到了相同的错误。希望此链接中的答案能够有所帮助。没有足够的信息告诉你。删除解决方案中的所有bin/obj文件夹。重新启动VisualStudio。全部重建。如果这不能解决问题,请删除StudentView并重新创建它。不要复制XAML中生成的根元素,也不要复制codebehind中生成的命名空间和类名。我已尝试删除bin/obj/excluded文件夹中的所有内容,并尝试从头开始编写代码,但我遇到了相同的错误。希望此链接中的答案能够有所帮助。
Imports System.ComponentModel
Namespace MVVMDemo.Model
    Public Class StudentModel
    End Class

    Public Class Student
        Implements INotifyPropertyChanged
        Private m_firstName As String
        Private m_lastName As String

        Public Property FirstName() As String
            Get
                Return m_firstName
            End Get

            Set
                If m_firstName <> Value Then
                    m_firstName = Value
                    RaisePropertyChanged("FirstName")
                    RaisePropertyChanged("FullName")
                End If
            End Set
        End Property

        Public Property LastName() As String
            Get
                Return m_lastName
            End Get

            Set
                If m_lastName <> Value Then
                    m_lastName = Value
                    RaisePropertyChanged("LastName")
                    RaisePropertyChanged("FullName")
                End If
            End Set
        End Property

        Public ReadOnly Property FullName() As String
            Get
                Return Convert.ToString(m_firstName & Convert.ToString(" ")) & m_lastName
            End Get
        End Property

        Public Event PropertyChanged As PropertyChangedEventHandler
        Private Event INotifyPropertyChanged_PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged

        Private Sub RaisePropertyChanged([property] As String)
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs([property]))
        End Sub
    End Class
End Namespace
Imports System.Collections.ObjectModel
Imports MVVMDemo.MVVMDemo.Model

Namespace MVVMDemo.ViewModel

    Public Class StudentViewModel
        Private Student As Object
        Public Property Students() As ObservableCollection(Of Student)
            Get
                Return m_Students
            End Get
            Set
                m_Students = Value
            End Set
        End Property
        Private m_Students As ObservableCollection(Of Student)

        Public Sub LoadStudents()
            Dim students__1 As New ObservableCollection(Of Student)()

            students__1.Add(New Student() With {
                .FirstName = "Mark",
                .LastName = "Allain"
            })
            students__1.Add(New Student() With {
                .FirstName = "Allen",
                .LastName = "Brown"
            })
            students__1.Add(New Student() With {
                .FirstName = "Linda",
                .LastName = "Hamerski"
            })

            Students = students__1
        End Sub
    End Class
End Namespace
<UserControl x:Class="MVVMDemo.Views.StudentView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local ="clr-namespace:MVVMDemo.MVVMDemo.Views" 

             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <StackPanel HorizontalAlignment = "Left">
            <ItemsControl ItemsSource = "{Binding Path = Students}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation = "Horizontal">
                            <TextBox Text = "{Binding Path = FirstName, Mode = TwoWay}" 
                        Width = "100" Margin = "3 5 3 5"/>

                            <TextBox Text = "{Binding Path = LastName, Mode = TwoWay}" 
                        Width = "100" Margin = "0 5 3 5"/>

                            <TextBlock Text = "{Binding Path = FullName, Mode = OneWay}" 
                        Margin = "0 5 3 5"/>

                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </StackPanel>
    </Grid>
</UserControl>
<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:MVVMDemo"
        xmlns:views ="clr-namespace:MVVMDemo.MVVMDemo.Views"

        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <!--<views:StudentView x:Name = "StudentViewControl" Loaded = "StudentViewControl_Loaded"/>-->
        <!--this line is the error-->
        <views:StudentView x:Name="StudentViewControl" Loaded="StudentViewControl_Loaded" />


    </Grid>
</Window>
Namespace MVVMDemo
    Partial Public Class MainWindow


        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub InitializeComponent()
            Throw New NotImplementedException()
        End Sub

        Private Sub StudentViewControl_Loaded(sender As Object, e As RoutedEventArgs)
            Dim studentViewModelObject As New ViewModel.StudentViewModel()
            studentViewModelObject.LoadStudents()

            'this Line:  "StudentViewControl"  Is Error, copy from convert telerik
            'then I fix it from recomended VS Intellisense "Dim StudentViewControl As Object = Nothing"
            Dim StudentViewControl As Object = Nothing
            StudentViewControl.DataContext = studentViewModelObject
        End Sub


    End Class
End Namespace
<Application x:Class="MVVMDemo.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MVVMDemo"
    StartupUri="MainWindow.xaml">
    <Application.Resources>

    </Application.Resources>
</Application>