I have a two ListViews
with one that should display a subset of the other's trough a second source list populated with context actions from the first ListView
source list. I both tried creating a List<T>
property in the target ListView
class and in the model class to bind as the source but despite marking them as static
I always get an error stating:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
What should I do? Is this the best approach to my issue? Anyway, this is my code:
MODEL
public class Nodes
{
#region Tracking List
public class TrackingList
{
public static List<Item> Items { get; set; }
}
#endregion
}
LISTVIEW CODEBEHIND
#region Events
public void AddTracking(object sender, EventArgs e)
{
//Retrieves the object bound to the cell raising the event
var mi = (MenuItem)sender;
var item = (Nodes.Item)mi.BindingContext;
Nodes.TrackingList.Items.Add(item);
}
#endregion