Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How can i set "x:Name" (Name) in code behind?

$
0
0

My App creates dynamically a lot of Xamarin.Forms.Entry
List LstEntry= new List ();
foreach (FormSubTypeParameterDTO fsubTypeParameters in formSubTypeParameterDTO)
{
ParameterDTO parameterDTO = ParameterBLL.Get (fsubTypeParameters.IdParameter);
txtCampo = new Entry
{
//Name= "txt" + parameterDTO.Id.ToString(), //(Here´s the problem)
HorizontalOptions = LayoutOptions.FillAndExpand,
BackgroundColor = Color.Transparent,
TextColor = Color.Gray,
Placeholder = "Your name"
};
LstEntry.Add(txtCampo);
}

In other function, i need get the values of LstEntry looking for by Name (ex: LstEntry[0].FindByName("yyyy").
This is impossible because I cannot set the "Name" property in the fields of Entry type.

How can i set "x:Name"(Name) in code behind?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>