English 中文(简体)
XamlParseException in View
原标题:XamlParseException in View

我只想看到一个拉贝尔。

The viewmodel is injected correctly in the view because the text of the label is bound to a viewmodel property. Now, if I try to define a DataGrid in the xaml, I ve got a XamlParseException:

{System.Windows.Markup.XamlParseException: Type DataGrid not found. [Line: 16 Position: 45] su System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) su Common.Views.FunctionalityView.InitializeComponent() su Common.Views.FunctionalityView..ctor(IFunctionalityViewModel viewModel)}

BUT, 如果我界定了<代码>DataGrid myDg = 新的数据Grid(,在InitializeComponent();之前即行。

我检查了所有参考资料,仍然可以发现问题。

问题回答

象你的假名空间一样,它听起来或失踪。 如果没有Xaml,很难告诉你应该做什么。

简便地说明这一点,就是建立一个新的用户框架,然后审查并比较其根基上确定的xmlns名称空间与你的观点的基本要素。

计生联根据专门名称空间定义确定类型。 格式

clr-namespace: [名称 (;assembly=[assembly name])

where

[名称

名称空间包含这一类型定义。 而且,如果这种类型是在不同组别中确定的,而Xaml案卷位于何处,则你必须将该部分列入前言。 [assembly name] is the name of the Assembly without the .dll extension (e.g., assembly=mscorlib will importmscorlib.dll. 为了进口Int32型,并在您的xaml中加以使用,你必须界定名称空间。

xmlns:s="clr-namespace:System;assembly=mscorlib"

还有一个网站:assembly-level accreditatione 。 允许在组装上<>内指定一个不同的名称空间。 典型的情况是,这是以URL为形式。 这是传统,而不是必要性的。 因此,有些控制是以更传统的名称空间确定的,例如,

xmlns=“http://schemas.microsoft.com/winfx/2006/xaml/presentation”





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签