I have a custom control derived from StackLayout that contains two Labels. Each Label's Text property is bound to a property in the codebehind
public string Label1Text
{
get { return _label1Text; }
set
{
_label1Text = value;
OnPropertyChanged(nameof(Label1Text));
}
}
The text content for the labels is determined by the content of a separate BindableProperty in the codebehind that is set by the consumer of the control, so the properties that the Label's are bound to should not really be visible outside of the custom control.
If I set the properties as private in the codebehind the binding in the Xaml of the control doesn't work. However when set to public they are visible in Intellisense which is wrong as they are for internal use only.
I can set the attributes
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
on the properties but is this the correct way to handle this as it only hides the properties not actually preventing them from being set by the consumer of the control?