简体   繁体   English

Xamarin.Mac TextBox更新

[英]Xamarin.Mac TextBox Update

I have a form with a TextBox and a Label. 我有一个带有文本框和标签的表单。 My goal is to auto-update the label to the value of the TextBox each time I change something. 我的目标是每次更改内容时将标签自动更新为TextBox的值。

I know that in the .NET Framework there is a "TextChange" Event, which worked. 我知道在.NET Framework中有一个“ TextChange”事件,它可以正常工作。 But somehow I am not able to recreate this with with Visual Studio for Mac. 但是以某种方式,我无法使用Visual Studio for Mac重新创建它。

Use the Changed event and set the label's StringValue to the text field's StringValue: 使用Changed事件并将标签的StringValue设置为文本字段的StringValue:

nstextfield.Changed += (sender, e) =>
{
    label.StringValue = nstextfield.StringValue;
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM