2016-06-19 9 views
0

私はswitchcell(switch1という名前の別のスイッチセル)をオン/オフすることでSwitchcell(switch2という名前)を有効/無効にする簡単な例を作成しています。 私はバインディングメソッドを使用しています。私は "Entry"要素(これを無効にしようとする)でこのコードを試してみましたが、完璧に動作しますが、 "switchcell"の "IsEnabledProperty"プロパティでは動作していないようです。 (私はXamlを使用していない、私はPCLを使用している)。 Xamarinフォームが最新バージョン(2.3.0.49)にアップデートされました。 これはXamarinの問題ですか?Xamarin SwitchcellバインドIsEnabledProperyが機能しませんか?

BindingContext = new DetailsViewModel(); 

     SwitchCell switch1 = new SwitchCell() 
     { 
      Text = "Switch", 
     }; 
     switch1.SetBinding(SwitchCell.OnProperty, new Binding("Test", BindingMode.TwoWay)); 

     SwitchCell switch2 = new SwitchCell() 
     { 
      Text = "Visibilita", 
     }; 
     switch2.SetBinding(SwitchCell.IsEnabledProperty, "Test"); 

、ここではDetailsViewModel.csである:ここで コードです

public class DetailsViewModel : INotifyPropertyChanged 
{ 
    bool test; 


    public bool Test 
    { 
     get { return test; } 
     set 
     { 
      if (test != value) 
      { 
       test = value; 
       OnPropertyChanged("Test"); 
      } 
     } 
    } 

    public event PropertyChangedEventHandler PropertyChanged; 

    protected virtual void OnPropertyChanged(string propertyName) 
    { 
     var changed = PropertyChanged; 
     if (changed != null) 
     { 
      PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 
     } 
    } 
} 

答えて

0

実はこれはXamarinからバグですが、私はまだ働いてか

されているかどうかを結合せずに固定された最初のチェックはないと思います
+0

ありがとうございます、私はバインドせずに試してみましたが、動作していません。回避策はありますか? –

関連する問題