Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XAML XMLNS:Local C#

I am working through an MVVM tutorial, and I have the following code, written in Xaml:

<Window x:Class="WPFMVVM.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WPFMVVM; assembly=WPFMVVM"
    Title="MainWindow" Height="388" Width="545">

The xmlns:local line is complaining saying that WPFMVVM assembly is not referenced. Although it is the assembly that I am working in.

Anybody know why?

Thanks

like image 671
Darren Young Avatar asked Jun 06 '11 14:06

Darren Young


1 Answers

You must not have spaces in there & if it's the assembly you work in just do not specify assembly.

xmlns:local="clr-namespace:WPFMVVM"

The assembly parameter is for referenced assemblies. Also see the MSDN article on XAML namespaces.

assembly can be omitted if the clr-namespace referenced is being defined within the same assembly as the application code that is referencing the custom classes. Or, an equivalent syntax for this case is to specify assembly=, with no string token following the equals sign.

like image 127
H.B. Avatar answered Sep 19 '22 05:09

H.B.