如何检查用户何时在Xamarin表单中输入



我是Xamarin Forms的新手,我想检查用户何时打字,这样我就可以更改按钮的文本

<Entry IsPassword="True"
Placeholder="password"
Style="{StaticResource InputStyle}"
Text=""
Margin="16,0,16,0">
<Button BorderColor="orange"
TextColor="{black"
Command="{Binding LoginCommand}"
Text="{Binding ButtonText}"
Margin="25,0,25,0"/>

在xaml 中添加TextChanged事件

<Entry IsPassword="True"
Placeholder="password"
Style="{StaticResource InputStyle}"       
TextChanged="Entry_TextChanged"
Margin="16,0,16,0">

并将此添加到您的代码隐藏页以捕获它:

void Entry_TextChanged(System.Object sender, TextChangedEventArgs e)
{
//do something here
}

最新更新