【问题标题】:Button disable not working按钮禁用不起作用
【发布时间】:2018-06-04 07:20:53
【问题描述】:

我正在使用 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") + "...";
        }

【问题讨论】:

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


【解决方案1】:

也许尝试在 Command 属性之后定义“IsEnabled”属性。

<Button Command="{Binding YourCommand}" IsEnabled="{Binding YourIsEnabledProperty}" /> 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-28
    • 2023-03-25
    • 2014-06-05
    • 1970-01-01
    相关资源
    最近更新 更多