Last time when i was reviewing my code I found out that I have assigned wrong declaringType to my Custom ContentView declaring type. It was interesting because it did not affect the way this content view worked. It passed UI tests and integration tests. So my question is. What is a purpose of declaring type in BindableProperty?
public partial class SomeContentView : ContentView
{
public static readonly BindableProperty IsSthProperty = BindableProperty.Create(
propertyName: nameof(IsSth),
returnType: typeof(bool),
declaringType: typeof(SomeContentView), <-- There were wrong assignment
defaultValue:true);
}
CodePudding user response:
Actually, if you check the actual DeclaringType documentation it says:
Remarks
Unused
So there is not much point about declaring it
But is required to create a new BindableProperty, even if it is pointless