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.
上一篇: 该属性的'命令'不存在于类型'按钮'