Sumit Singh Sisodia

Sumit Singh Sisodia

  • 365
  • 4.2k
  • 1.2m

Selecting Listview items then App is Crashed.

Feb 26 2018 10:45 PM
problem is that when i add item in listview, its properly add then i select any item in Listview So app crashed. i don't understand and i also use try/catch but no solve this problem.
 
<StackLayout>
<ListView x:Name="SelectionListView" HeightRequest="100"/>
<Button Text="button" Clicked="Button_Clicked"/>
</StackLayout>
 
Code Behind is 
List<string> ss;
public AddMenuPage()
{
InitializeComponent();
ss =new List<string>() { "Awesome!", "Great!", "Cool!", "Good!", "Not Bad!", "Meh!", "Awesome!", "Great!", "Cool!", "Good!", "Not Bad!", "Meh!" };
SelectionListView.ItemsSource = ss;
}
private void Button_Clicked(object sender, EventArgs e)
{
try
{
ss.Add("amit");
SelectionListView.ItemsSource = ss;
}
catch (Exception ex)
{
}
}
 
 

Answers (1)