Visual Studio Winform设计器:在当前控件BindingSource上设置DataBindings [英] Visual Studio Winform designer: Set DataBindings on current control BindingSource

查看:626
本文介绍了Visual Studio Winform设计器:在当前控件BindingSource上设置DataBindings的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2013设计器在Winforms中创建一个UserControl。它包含一个TextBox。我添加了一个BindingSource(在代码中将DataSource属性设置为List)。





当我点击文本框时,查看属性窗口(F4),展开(DataBindings)节点,然后单击(高级)按钮,打开绑定窗口。





在该窗口中,绑定列表中无法选择(旁边添加)。我希望在该列表中找到我的BindingSource。





可以在Binding窗口中获取我的自定义BindingSource(在设计器中添加了Drag& Drop)吗?

解决方案

您必须在BindingSource控件上设置DataSource属性,如下所示:



img src =https://i.stack.imgur.com/eC6jI.pngalt =BindingSource>



您的BindingSource控件现在可以在设计师:




I am creating a UserControl in Winforms, using Visual Studio 2013 designer. It contains a TextBox. I added a BindingSource (which DataSource property is set in code to a List).

When I click on the TextBox, look in the property window (F4), expand the "(DataBindings)" node and click on the "(Advanced)" button the Binding window opens.

In that window, there is no choice available in the Bindings list (beside Add). I Expected to find my BindingSource in that list.

Is it possible to get my custom BindingSource (added with Drag&Drop in the designer) available in that Binding window?

解决方案

You have to set the DataSource property on your BindingSource control, like so:

Your BindingSource control will now be available in the designer:

这篇关于Visual Studio Winform设计器:在当前控件BindingSource上设置DataBindings的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆