XAML XMLNS:本地C# [英] XAML XMLNS:Local C#

查看:275
本文介绍了XAML XMLNS:本地C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过MVVM教程,我有下面的代码,写在XAML:

 <窗口x :类=WPFMVVM.MainWindow
的xmlns =http://schemas.microsoft.com/winfx/2006/xaml/presentation
的xmlns:X =http://schemas.microsoft。 COM / WinFX的/ 2006 / XAML
的xmlns:地方=CLR的命名空间:WPFMVVM;装配= WPFMVVM
标题=主窗口HEIGHT =388WIDTH =545>



的xmlns:本地线路抱怨说WPFMVVM组件未引用。虽然这是我在我工作的程序集。



有人知道为什么吗?



感谢


解决方案

您一定不能有空格在那里&放大器;如果这是你在工作装配的只是不指定组装



<预类=郎XML prettyprint-覆盖> 的xmlns:地方=CLR的命名空间:WPFMVVM



组装参数是的引用的程序集的。另请参阅 MSDN文章XAML命名空间



可以,如果引用的CLR命名空间正在同一总成作为被引用自定义类的应用程序代码中定义的省略

组装。或者,对于这种情况下的等效语法是指定装配=,没有字符串标记以下等号。



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

解决方案

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.

这篇关于XAML XMLNS:本地C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆