Properties 需要帮助使用数据绑定显示布尔属性状态吗

Properties 需要帮助使用数据绑定显示布尔属性状态吗,properties,binding,boolean,Properties,Binding,Boolean,因此,我在尝试获取正确的数据以在我的子窗体中显示时遇到困难 我正在使用子窗体列出在条目(父)窗体中选择的当前对象的详细信息 我的问题在于绑定对象。我有一个布尔属性(IsAutomatic),当它为真时,以我想要的详细信息形式显示为“自动”,当为假时显示为“手动” 我似乎无法在表单中显示字符串,只能显示单词“true”或“false”,事实上,这是值,而不是我想要的 下面是我使用的代码 Binding _transmission = new Binding("Text", _formData

因此,我在尝试获取正确的数据以在我的子窗体中显示时遇到困难

我正在使用子窗体列出在条目(父)窗体中选择的当前对象的详细信息

我的问题在于绑定对象。我有一个布尔属性(IsAutomatic),当它为真时,以我想要的详细信息形式显示为“自动”,当为假时显示为“手动”

我似乎无法在表单中显示字符串,只能显示单词“true”或“false”,事实上,这是值,而不是我想要的

下面是我使用的代码

   Binding _transmission = new Binding("Text", _formDataSource.Current, "IsAutomatic");
        //how the hell do i do this?
 _transmission.FormatString = string.Format(//and i've tried a ternary operator here to display literals depending on if _transission is true or false, but this is a binding object and not a bool data type.  I attempted to try a cast on the _transmission object, but the IDE did not like it at all.
        lblTransmission.DataBindings.Add(_transmission);
   // do i want code the ternary here 
 (lblTransmission.Text.Equals("true")) ? "Automatic" : "Manual"; //this brought up errors too... 

任何帮助都将不胜感激,因为我已经在这方面工作了一段时间。

我能够通过使用一个简单的演员阵容来完成这项工作

Vehicle _vehicle;
后来

_vehicle = (Vehicle)_bindingSource.Current;
并获得我的标签所需的输出

lblTransmission.DataBindings.Add("Text", _vehicle, "IsAutomatic",true);
lblTransmission.Text = String.Format("{0}", 
( _vehicle.IsAutomatic) ? "Automatic" : "Manual")
我希望这最终能帮助一些人。如果有人有任何建议或批评,请随时告诉我你的想法。。。我还是个学生(只剩下两个学期了!!)。 多谢各位