我创建了一个自定义控件,可以通过用户控件的ControlToValidate属性找到控件。该代码正常工作,但是将xamarin表单更新为3.2后,它开始引发错误“此元素不在名称范围中”。有人可以帮忙吗?
下面是代码。
protected override void OnParentSet()
{
base.OnParentSet();
this.IsVisible = false;
View view = this.Parent.FindByName<View>(ControlToValidate);
if (view is Entry)
{
ControlType = "Entry";
this.Parent.FindByName<Entry>(ControlToValidate).Completed += Entry_Completed;
}
if (view is Picker)
{
ControlType = "Picker";
this.Parent.FindByName<Picker>(ControlToValidate).SelectedIndexChanged += Picker_SelectedIndexChanged;
}
}