将winforms标签绑定到对象的状态 [英] Bind winforms label to an object's state

查看:98
本文介绍了将winforms标签绑定到对象的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个特殊的类,它具有一个称为Status的属性,该属性可以一次具有两个字符串值-"active"或"inactive";不是都.我正在尝试使标签控件文本属性反映此值.那么我们该怎么做呢?

I''ve a particular class which has a property called Status, which can either have two string values at one time - "active" or "inactive"; not both. I am trying to have a label control text property reflect this value. So how do we do this?

推荐答案

您可以使用委托在状态更改时触发并设置值.您不能对控件进行自动绑定,以使数据源发生更改,而不是在Winforms中发生更改.
You can use a delegate to fire when the status is changed, to set the value. You can''t do automatic binding to a control, so that the data source changes, not in winforms.


这篇关于将winforms标签绑定到对象的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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