视觉继承问题

发布于 2024-12-01 21:35:15 字数 713 浏览 1 评论 0原文

我已经构建了一个基本用户控件 BaseViewControl,它上面有一个 dataGridView 和一个 bindingSource。两者都有受保护的访问修饰符。 dataViewGrids 数据源指向基本表单绑定源。

然后,我创建了一个 InheritedUserControl、ApplicationUserView,当出现提示时,我将其指向我的 UI 程序集。它继承了同一程序集中的其他一些 arb UserControl,因此我手动更改它以继承我的 BaseViewControl。

在 ApplicationUserView 的绑定源上,我将 dataSource 属性设置为我的 ApplicationUser 域对象。然后,dataGridView 按照预期继续使用 DesignView 中的 ApplicationUser 域类中的属性填充其列。

现在,在来自控制器对象的异步回调中,视图接收 IList,我设置 BindingSource.DataSource = applicationUserList。

我已经确认回调被调用并且 applicationUserList 中有项目,但在运行时,网格不显示任何行。我怀疑这与视觉继承方面有关。

我曾经见过,只要您之前尝试修改继承项的属性,VS就会将继承表单中的项的副本创建到继承表单上,这具有类似的效果,但事实并非如此。

有什么想法我做错了吗?

谢谢,HS

I've build a base user control, BaseViewControl, it has a dataGridView and a bindingSource on it. Both have protected access modifiers. The dataViewGrids dataSource points to the base forms bindingSource.

Then I created an InheritedUserControl, ApplicationUserView, when prompted I pointed it to my UI assembly. It inherited some other arb UserControl in the same assembly so I manually changed it to inherit my BaseViewControl.

On the ApplicationUserView's bindingSource, I set the dataSource property to my ApplicationUser domain object. The dataGridView then proceeded to populate its columns with the properties in my ApplicationUser domain class in the DesignView, as expected.

Now, in an async callback from my controller object, where the view receives an IList<ApplicationUser>, i set my bindingSource.DataSource = applicationUserList.

I've confirmed that the callback gets called and that the applicationUserList has items in it, but at run time, the grid doesn't show any rows. I suspect it has something to do with the visual inheritance aspect of it all.

I've seen VS create copies of items from inherited forms onto the inheriting form as soon as you try and modify a property of an inherited item before, which has a similar effect, but this is not the case.

Any ideas what I'm doing wrong?

Thanks, HS

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文