I have a set of Entry Views which is created Dynamically. I need to identify that on which entry view the text has been changed. I have the same scenario in buttons where I use CommandParameter to Identify each button.
Sample Code
public class Questionaire : ContentPage
{
StackLayout contentview = new StackLayout {
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand,
};
int Count = <The Count varies>; //Number Of Views
for(int i=0; i<Count; i++)
{
Entry entryview = new Entry {
WidthRequest = Metrics.Textentrywidth,
Keyboard = Keyboard.Numeric,
VerticalOptions=LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.Center,
};
entryview.TextChanged += OnTextChanged;
contentview.Children.Add (entryview);
}
void OnTextChanged(object sender, TextChangedEventArgs e)
{
//Need to get which Entry view is changed
Entry entry = sender as Entry;
String val = entry.Text;
}
}