I'm creating a custom Entry component by wrapping a Entry around a StackLayout. Currently I'm trying to create a property called 'SandboxPlaceholder' and I simple want to redirect this property to the Entry component's 'Placeholder' property.
I'm trying something like this, but with no success. Please help guide me in the right direction.
Edit: My current workaround is setting the properties programmatically, but if I can figure how to achieve it using xaml, my development will be supercharged.
<unicareer:ViewEntrySettings
x:Name="EntryEmail"
SandboxPlaceholder="Hello"/>
public class ViewEntrySettings : StackLayout {
Entry entry;
public ViewEntrySettings () {
UtilLogger.Log ("ViewEntrySettings", "Constructor");
Orientation = StackOrientation.Horizontal;
HorizontalOptions = LayoutOptions.FillAndExpand;
HeightRequest = 40;
Padding = new Thickness (6, 0, 6, 0);
BackgroundColor = Color.White;
entry = new Entry {
Keyboard = Keyboard.Email,
Placeholder = SandboxPlaceholder,
HorizontalOptions = LayoutOptions.FillAndExpand,
};
Children.Add (entry);
UtilLogger.Log("ViewEntryLogin_Uni", "Sandbox: " + SandboxPlaceholder);
}
public static BindableProperty SandboxPlaceholderProperty = BindableProperty.Create<ViewEntrySettings, string>(p => p.SandboxPlaceholder, "Default");
public string SandboxPlaceholder {
get
{
UtilLogger.Log ("ViewEntrySettings", "SandboxProperty get");
return (string) GetValue(SandboxPlaceholderProperty);
}
set {
UtilLogger.Log ("ViewEntrySettings", "SandboxProperty set");
SetValue(SandboxPlaceholderProperty, value);
if(entry != null) {
entry.Placeholder = value;}
}
}
}