我创建了一个新窗口并尝试将我的类设置FooService为 DataContext 属性。但在“选择对象”对话框中,我只能找到一些类,而不能找到FooService.
如果对要在该对话框中列出的类有任何要求,有什么想法吗?
我创建了一个新窗口并尝试将我的类设置FooService为 DataContext 属性。但在“选择对象”对话框中,我只能找到一些类,而不能找到FooService.
如果对要在该对话框中列出的类有任何要求,有什么想法吗?
FooService 是否有一个公共的无参数构造函数?如果没有,Blend 将看不到它。
You need to add the appropriate namespace to the list of XML namespaces in the XAML file for the Window.
For example, if your FooService class had a namespace of "Services" you would add an xmlns declaration like so:
<Window ...
xmlns:services="clr-namespace:Services"
... />
or (if it's in a different project that you have referenced)
xmlns:services="clr-namespace:Services;assembly=Services"
Assuming that project's name is "Services".