私はいくつかのカスタムビュー要素を作成しています:要素のすべてのプロパティがロードされているかどうかをチェックする方法は?
public class ExtendableButtonList : StackLayout
{
public static readonly BindableProperty NewSlotNameProperty = BindableProperty.Create(
propertyName: "NewSlotName",
returnType: typeof(string),
declaringType: typeof(ExtendableButtonList),
defaultValue: default(string));
public string NewSlotName
{
get { return (string)GetValue(NewSlotNameProperty); }
set { SetValue(NewSlotNameProperty, value); }
}
public delegate void OnLoadHandler(ExtendableButtonList ebl);
public event OnLoadHandler OnLoadEvent;
public ExtendableButtonList(){
//not all properies are loaded at this point
}
[...]
}
私は、このオブジェクトにXAMLを通過している性質上のいくつかのアクションを行う必要があります。残念ながら、ExtendableButtonListクラスのコンストラクタが呼び出されているときは、この時点ですべてのBindablePropertiesが読み込まれるわけではありません。彼らは後で表示されます。
このオブジェクトにすべてのプロパティがロードされたときは、どうすればわかりますか? OnLoadEventを呼び出すときに、このオブジェクトがさらに使用できる状態になっていることを私のアプリに知らせますか?
あなたがOnBindingContextChangedを上書きしようとしたのについての良い説明を見ることができますか?それを確認するには良い場所を推測してください。 – jzeferino
@jzeferinoが正しいです。私はここで同様の/重複する質問に答えました:http://stackoverflow.com/questions/37867863/how-to-get-contentpages-bindingcontext-from-contentview –
私はポストで自分の答えを追加しました。これはその質問の重複ではないからです。ありがとうございました。 – jzeferino