我有一个ViewCell
用作 a 的项目模板ListView
:
ListView details_list = new ListView ();
details_list.ItemTemplate = new DataTemplate(typeof(CartViewCell));
在 ViewCell 内部,我想要一个函数来访问 ListView 的 itemSource 以删除一个项目。我虽然我会通过访问Parent
里面的属性来做到这一点ViewCell
ListView parent = (ListView)this.Parent;
但是当我尝试这样做时,它显示父级为空。这是使用Parent
房产的不正确方式吗?我错过了什么?