Hi everyone.
I have a working custom control. I want to have another custom control inheriting from the previous one but something is not working as expected.
In the second control oneway properties don't take the value I send from the implementation while the original control works perfectly. Looks like an issue at rendering time because if I debug a property change event I can see the values I sent in the control. Even a validation takes the default value at first but then use the value I sent.
For example this simple string property to display in a label doesn't work in DateTimeRange
public class DateRange : ContentView, IDateRange
{
//....
public static readonly BindableProperty FromTextProperty = BindableProperty.Create(
propertyName: nameof(FromText),
returnType: typeof(string),
declaringType: typeof(DateRange),
defaultValue: "Desde",
defaultBindingMode: BindingMode.OneWay
);
public string FromText
{
get => (string)GetValue(FromTextProperty);
set => SetValue(FromTextProperty, value);
}
}
public class DateTimeRange : DateRange, INotifyPropertyChanged
{
//....
}
Implementations:
<controls:DateRange DateTimeFrom="{Binding DateFrom}" DateTimeTo="{Binding DateTo}" Difference="10" Size="Large" LabelColumnWidth="70" FromText="From" ToText="To"/>
<controls:DateTimeRange DateTimeFrom="{Binding DateFrom}" DateTimeTo="{Binding DateTo}" Difference="2" Size="Large" LabelColumnWidth="70" FromText="From" ToText="To"/>