我正在使用在XAML中声明的ObjectDataProvider,如下所示:
<UserControl.Resources>
<ObjectDataProvider x:Key="odpTheList"
ObjectType="{x:Type library:StaticClass}"
MethodName="GetListOfItems" />
</UserControl.Resources>
基本上它会调用StaticClass.GetListOfItems()
来获取数据。
好的,问题是这个GetListOfItems在设计时遇到异常 - 它实际上是从数据库中获取数据; 问题是设计师崩溃(可以理解),但有没有办法使用ObjectDataProvider,就像我正在尝试使用并仍然有设计师的支持?..
在运行时,它运行良好。
我也尝试设置IsInitialLoadEnabled="False"
,但没有成功。
提前完成。