Hello,
You can do this by adding Xamarin.Forms Bindable Properties when you create BorderlessEntry.cs
like following code.
public class BorderlessEntry : Entry
{
public static readonly BindableProperty ControlIndexProperty =
BindableProperty.Create("ControlIndex", typeof(int), typeof(BorderlessEntry), -1);
public int ControlIndex
{
get { return (int)GetValue(ControlIndexProperty); }
set { SetValue(ControlIndexProperty, value); }
}
}
Then you can set ControlIndex="1" in the xaml like following code, please remove the BindingContext="1"
<local:BorderlessEntry x:Name="tbx_Conductor_Sensor_MAC_ID_1" ControlIndex="1" Text="{Binding TbxConductorSensorMacID1Text}">
Then you can get this BorderlessEntry in the viewmodel and get the controlindex as well.
ConductorSensorMacIDTextChangeCommand = new Command((e) =>
{
BorderlessEntry rs = e as BorderlessEntry;
Console.WriteLine("============"+rs.ControlIndex + "============");
});
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.