I built a simple adaptation of the Entry control as follows:
<?xml version="1.0" encoding="utf-8" ?>
<Grid xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:B1WApp.CustomControls"
x:Class="B1WApp.CustomControls.UI5Entry"
x:DataType="local:UI5Entry">
<Border StrokeShape="RoundRectangle 5"
Stroke="{StaticResource SAPFieldBackground}"
BackgroundColor="{StaticResource SAPFieldBorderColor}"
Padding="1"
x:Name="OuterBorder">
<Border StrokeShape="RoundRectangle 4"
Stroke="{StaticResource SAPFieldBackground}"
BackgroundColor="{StaticResource SAPFieldBackground}">
<Entry Text="{Binding Path=Text}"
Placeholder="{Binding Path=Placeholder}"
PlaceholderColor="{StaticResource SAPFieldPlaceholderColor}"
ReturnType="{Binding Path=ReturnType}"
IsPassword="{Binding Path=IsPassword}"
Margin="{OnPlatform Default='0', Android='0,-8,0,-8'}"
Focused="Entry_Focused"
Unfocused="Entry_Unfocused"
Completed="Entry_Completed"
ReturnCommand="{Binding Path=ReturnCommand}"/>
</Border>
</Border>
</Grid>
In code-behind I have:
using System.Windows.Input;
public partial class UI5Entry : Grid
{
public UI5Entry()
{
InitializeComponent();
this.BindingContext = this;
}
// additional code omitted for brevity
public static readonly BindableProperty ReturnCommandProperty = BindableProperty.Create(
propertyName: nameof(ReturnCommand),
returnType: typeof(ICommand),
declaringType: typeof(UI5Entry),
defaultValue: null,
defaultBindingMode: BindingMode.OneWay);
public ICommand ReturnCommand
{
get => (ICommand)GetValue(ReturnCommandProperty);
set => SetValue(ReturnCommandProperty, value);
}
}
However, when I use the control, the ReturnCommand never fires. The other properties work fine, however. Am I missing something here?
<customControls:UI5Entry
ReturnType="Search"
Placeholder="Digita/escanea # de doc."
Text="{Binding SearchText, Mode=TwoWay}"
ReturnCommand="{Binding SearchForBaseDocumentsCommand}"
/>
Thanks in advance for any hints on this issue.
Best regards,
Joerg.