I am writing to ask how best to access a value Heading in Raw View section of below C# ObservableCollection cBeanList;
Please see attached screen shot of debug mode for additional details of existing ObservableCollection layout;
public static ObservableCollection cBeanList = new ObservableCollection();
Type SingleBeanGroup is specified as follows: public class SingleBeanGroup : List, INotifyPropertyChanged
Type SingleBean is simply a class with values of string and bool :
public class SingleBean
{
public string Field1 { get; set; }
public bool Selected { get; set; } public SingleBean() { }
}
Following code snippet works well to access Field1 - which is selected by user, via a Xaml page Check Box:
foreach (var data in MonkeysViewModel.cBeanList)
{
for (int i = 0; i < data.Count; i++)
{
if (data[i].Selected == true)
{
await DisplayAlert("Alert", "Model Tapped: " + data[i].Field1, "OK");
}
}
}
Thanks in advance for any insight, guidance;
Update: an addition of public string Heading { get; set; } to SinglerBean class resolved access issue:
public class SingleBean
{
public string Field1 { get; set; }
public bool Selected { get; set; } public string Heading { get; set; } public SingleBean() { } }
Answers
Update: an addition of public string Heading { get; set; } to SinglerBean class resolved access issue:
public class SingleBean
{
public string Field1 { get; set; }