Silverlight toolkit namespace is "sometimes" unknown

I use the BusyIndicator control from the SL Toolkit 5 in a ChildWindow .

In some solutions, it works but in others, with exactly the same code (at least it seems), I get the following exception at runtime, during the parsing of my ChildWindow XAML:

The 'BusyIndicator' type was not found because 'http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit' is an unknown namespace. [Line: 59 Position: 44]

How is it possible that it sometimes works? I browsed some forums and read some solutions (cleaning Bin and Obj folders did nothing) but nothing is working so far.

If I create my BusyIndicator in the code-behind, everything just works fine.

Has anyone an idea?

Thanks.


OK, I found the source of the problem. If BusyIndicator is not used in the C# code, the Toolkit assembly is not included in the XAP file. And then, using it in the XAML causes a crash at runtime.

Simply adding this line somewhere in the C# code fixes it:

BusyIndicator bi = new BusyIndicator();

And another (and better, I think) workaround is to give the BusyIndicator (in the XAML code) a name.

链接地址: http://www.djcxy.com/p/34552.html

上一篇: 该属性的'命令'不存在于类型'按钮'

下一篇: Silverlight工具箱命名空间“有时”是未知的