I am trying to change the base class of a Window that I have added to my project.
Here is some code:
public partial class MoviesView : MvvmHelper.Base.ViewBase
{
public MoviesView()
{
InitializeComponent();
}
}
And the XAML:
<Mvvm:ViewBase x:Class="MvvmHelperUI.Views.MoviesView"
xmlns:Mvvm="clr-namespace:MvvmHelper.Base"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MoviesView" Height="300" Width="300">
<Grid>
</Grid>
</Mvvm:ViewBase>
I am receiving the error:
The name "ViewBase" does not exist in the namespace "clr-namespace:MvvmHelper.Base".
And also:
The tag 'ViewBase' does not exist in XML namespace 'clr-namespace:MvvmHelper.Base'.
The base class, ViewBase has no implementation as of yet, it only inherits from Window . It definitely exists in the namespace, I have no idea what this issue could be.
It's probably worth mentioning that ViewBase is in a different assembly.
I found the answer.
As ViewBase is in a different assembly, I had to add the assembly declaration in the XAML:
xmlns:src="clr-namespace:MvvmHelper.Base;assembly=MvvmHelper"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.