Skip to content

Instantly share code, notes, and snippets.

@tugcearar
Created September 20, 2018 22:28
Show Gist options
  • Save tugcearar/78050e6a369ac5fc0ae4832cb893ad0a to your computer and use it in GitHub Desktop.
Save tugcearar/78050e6a369ac5fc0ae4832cb893ad0a to your computer and use it in GitHub Desktop.
public class CustomPicker : Picker
{
public string DoneButtonText
{
get
{
return (string)GetValue(DoneButtonTextProperty);
}
set
{
SetValue(DoneButtonTextProperty, value);
}
}
public static readonly BindableProperty DoneButtonTextProperty = BindableProperty.Create(
propertyName: "DoneButtonTextProperty",
returnType: typeof(string),
declaringType: typeof(CustomPicker),
defaultValue: string.Empty,
defaultBindingMode: BindingMode.TwoWay,
propertyChanged: DoneButtonTextPropertyChanged);
private static void DoneButtonTextPropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
(bindable as CustomPicker).DoneButtonText = newValue.ToString();
}
public string CancelButtonText
{
get
{
return (string)GetValue(CancelButtonTextProperty);
}
set
{
SetValue(CancelButtonTextProperty, value);
}
}
public static readonly BindableProperty CancelButtonTextProperty = BindableProperty.Create(
propertyName: "CancelButtonTextProperty",
returnType: typeof(string),
declaringType: typeof(CustomPicker),
defaultValue: string.Empty,
defaultBindingMode: BindingMode.TwoWay,
propertyChanged: CancelButtonTextPropertyChanged);
private static void CancelButtonTextPropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
(bindable as CustomPicker).CancelButtonText = newValue.ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment