【发布时间】:2018-03-03 13:12:01
【问题描述】:
我为 wrappanel 创建了一个自定义控件。但它显示了额外的空间。 所以我正在尝试创建HeightRequest的BindableProperty进行控制,并根据内容进行设置以去除多余的空间。
这就是我创建 HeightRequest 的 BindableProperty 的方式
public double HeightRequest { get; set; }
private static BindableProperty heightTextProperty = BindableProperty.Create(
propertyName: "HeightRequest",
returnType: typeof(double),
declaringType: typeof(InstallationPhotoWrappanel),
defaultValue: 100,
defaultBindingMode: BindingMode.TwoWay,
propertyChanged: heightTextPropertyChanged);
private static void heightTextPropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
var control = (InstallationPhotoWrappanel)bindable;
control.HeightRequest = Convert.ToDouble(newValue);
}
但它给了我例外
exception has been thrown by the target of an invocation
我在这里做错了什么。请帮忙。
提前谢谢你。
【问题讨论】:
标签: properties xamarin.forms bindable