按钮禁用不起作用

时间:2018-06-04 07:20:54

标签: c# xamarin xamarin.forms xamarin.ios

我正在使用Visual Studio 2017中的Xamarin Forms应用程序,我想禁用一个按钮并更改按钮文本,我在下面的代码中禁用了按钮。它适用于Android而不是IOS,在IOS中按钮禁用后,用户可以反复点击按钮,但外观看起来已禁用,但点击事件会激活

   public void btnAction_Click(object sender, System.EventArgs e)
        {
            PerformAction();
        }

        private void PerformAction()
        {
            btnAction.IsEnabled = false;
            string btnText = btnAction.Text;
            btnAction.Text = L10N.Localize("Sending") + "...";
        }

1 个答案:

答案 0 :(得分:1)

也许会尝试定义" IsEnabled" Command属性后的属性。

<Button Command="{Binding YourCommand}" IsEnabled="{Binding YourIsEnabledProperty}" /> 
相关问题