为什么BindingSource组件看不到继承的属性?

编程入门 行业动态 更新时间:2024-10-25 20:20:40
本文介绍了为什么BindingSource组件看不到继承的属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经定义了类:

public class Parent : IParent { public string ParentText { get { return "ParentText"; } } } public interface IParent { string ParentText { get;} } public class Child : Parent, IChild { public string ChildText { get { return "ChildText"; } } } public interface IChild : IParent { string ChildText { get;} }

当我尝试将控件绑定到IChild实例时,可以对ChildText属性执行此操作,但对于ParentText属性则不能执行此操作。如果我尝试绑定到Child实例,则两个属性都是可绑定的。 为什么数据绑定机制看不到从其他接口继承的属性?

When I try to bind control to IChild instance, I can do this for ChildText property, but not for ParentText property. if I try to bind to Child instance, both properties are bindable. Why databinding mechanism does not see properties inherited from other interfaces?

编辑:SharePoint Newbie是正确的:通过手工代码定义数据绑定有效。但是,我尝试使用BindingSource组件在设计器中定义数据绑定。当您将对象源添加到项目中并将其指向IChild接口时,只有ChildText可见才能定义绑定。

SharePoint Newbie is right: databindings work when defined by hand in code. However, I tried to define databindings in designer using BindingSource component. When you add object source to project and point it to IChild interface, only ChildText is visible to define bindings.

我更新了问题标题以更好地反映我的问题。

I updated title of question to better reflect my problem.

推荐答案

我认为,框架中存在一个导致描述问题的错误。这是相关的连接问题:

I think, there is a bug in framework which causes described issue. Here is relevant connect issue:

connect.microsoft/VisualStudio/feedback/details/431273/interface-inheritance-bug

更多推荐

为什么BindingSource组件看不到继承的属性?

本文发布于:2023-10-16 05:22:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1496622.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:组件   属性   BindingSource

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!