2016-05-27 6 views
0

Ich mag würde meinen abgeschriebenen Code aktualisieren, hier ist sie:erstellen BindableProperty mit der neuesten Version (nicht abgeschrieben)

public static readonly BindableProperty CompletedProperty = BindableProperty.CreateAttached<EntryCompletedBehavior, Command>(
       bindable => EntryCompletedBehavior.GetCompleted(bindable), /* staticgetter */ 
       null, /* default value */ 
       BindingMode.OneWay, /* defaultBindingMode */ 
       null, /* validateValue */ 
       (b, o, n) => EntryCompletedBehavior.OnCompletedChanged(b, o, n), /* PropertyChanged */ 
       null, /* PropertyChanging */ 
       null); /* CoerceValue */ 

Aber ich bin nicht sicher, was in Property, Rückgabetyp, DeclaringType zu setzen und PropertyChanged. Ich habe diesen Code hier http://pause.coffee/blog/..., die derzeit die folgenden Code does'nt Arbeit:

public static readonly BindableProperty CompletedProperty = BindableProperty.CreateAttached(
       "Completed", /* string PropertyName */ 
       typeof(Command), /* Type returnType */ 
       typeof(Command), /* Type declaringType */ 

       null, /* default value */ 
       BindingMode.OneWay, 
       null, 
       (b, o, n) => EntryCompletedBehavior.OnCompletedChanged(b, o, n), 
       null, 
       null); 

Antwort

1

Dank Bill Reiss ;-)

Der folgende Code funktioniert:

public static readonly BindableProperty CompletedProperty = BindableProperty.CreateAttached(
       "Completed", /* string PropertyName */ 
       typeof(Command), /* Type returnType */ 
       typeof(Entry), /* Type declaringType */ 
       null, /* default value */ 
       BindingMode.OneWay, /* defaultBindingMode */ 
       propertyChanged: (bindable, oldValue, newValue) => { 
        EntryCompletedBehavior.OnCompletedChanged(bindable, (Command)oldValue, (Command)newValue); 
       }); 
Verwandte Themen