Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
👩‍💻💙📱

Anna Domashych foxanna

💭
👩‍💻💙📱
View GitHub Profile
View RoundCornersEffectUsageExample.xaml
<ContentPage ...
xmlns:effects="clr-namespace:<project>.Effects;assembly=<project>"
BackgroundColor="PaleTurquoise">
<ContentPage.Resources>
<ResourceDictionary>
<x:Int32 x:Key="SmallCornerRadius">4</x:Int32>
<x:Int32 x:Key="MediumCornerRadius">8</x:Int32>
<x:Int32 x:Key="LargeCornerRadius">16</x:Int32>
</ResourceDictionary>
View SelectableLabel.cs
namespace <project>.Controls
{
public class SelectableLabel : Editor
{
public SelectableLabel()
{
}
}
}
View CustomEditText.cs
namespace <project>.Droid.Controls
{
public class CustomEditText : FormsEditText
{
public CustomEditText(Context context) : base(context)
{
}
protected override void OnAttachedToWindow()
{
View SelectableLabelRenderer.cs
[assembly: ExportRenderer(typeof(SelectableLabel), typeof(SelectableLabelRenderer))]
namespace <project>.Droid.Controls
{
public class SelectableLabelRenderer : EditorRenderer
{
public SelectableLabelRenderer(Context context) : base(context)
{
}
View SelectableLabelRenderer.cs
[assembly: ExportRenderer(typeof(SelectableLabel), typeof(SelectableLabelRenderer))]
namespace <project>.iOS.Controls
{
public class SelectableLabelRenderer : EditorRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
{
base.OnElementChanged(e);
View CustomEditTextUsageExample.cs
protected override FormsEditText CreateNativeControl() =>
new CustomEditText(Context);
View CustomSelectionActionModeCallback.java
public class CustomSelectionActionModeCallback implements ActionMode.Callback {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
try {
View CustomSelectionActionModeCallbackUsageExample.java
editText.setCustomSelectionActionModeCallback(new CustomSelectionActionModeCallback());
View CustomInsertionActionModeCallback.java
public class CustomInsertionActionModeCallback implements ActionMode.Callback {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
return false;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
View CustomInsertionActionModeCallbackUsageExample.java
editText.setCustomInsertionActionModeCallback(new CustomInsertionActionModeCallback());