Description: 在自定义类似dropdownlist类型的单元格时,按照通常的方法,在点击输入的时候显示的是正常的文本,而输入完成后单元格显示的是实际值,并不符合我们的合适习惯.
本例通过在EditingControlFormattedValue中返回combobox的selecteditem ,
在自定义单元格控件时重写GetValue,GetFormattedValue
解决了 显示时显示的是绑定的实际值,而输入选择时显示的是显示的字段的问题.
具体实现见附件,也请大家指教-Custom similar to the the dropdownlist type of unit cell in the usual way, click on the input display is normal text, while the input is complete, the cell is the actual value does not comply with the appropriate habits in this case rewrite the GetValue return to the combobox in EditingControlFormattedValue selecteditem custom cell control GetFormattedValue resolve displayed is the actual value of the binding when the input selection is shown in the display field to achieve specific see annex, please advise Platform: |
Size: 5120 |
Author:mozi |
Hits:
Description: C# DataGridview中使用ComboBox,实现Column可以手动自由输入。在winform datagridview中使用下拉框, 既可以从下拉框里选择数据,也可以让使用者自己手动往里面输入数据。虽然简单,不过觉得挺实用的功能。-Use C# DataGridview ComboBox, realize Column can manually enter freely. Use the drop down box in winform datagridview, you can either choose from a drop-down box data, but also allows the user to manually enter the data entered. Although simple, but feel very useful features. Platform: |
Size: 13312 |
Author:lpudn56 |
Hits: