【发布时间】:2014-11-15 00:32:47
【问题描述】:
我有一个在 c++ 中(不是在 XAML 中)以编程方式创建的元素列表。我为holding事件添加了一个事件处理程序,如下所示:
listItem->Holding += ref new Windows::UI::Xaml::Input::HoldingEventHandler(this, &listItem_hold);
我已经定义了这样的事件处理程序:
void listItem_hold(Platform::Object^ sender, Windows::UI::Xaml::Input::HoldingRoutedEventArgs^ e);
有没有办法将我自己的数据添加到 HoldingRoutedEventArgs 对象中,以便我可以从事件处理程序内部访问它? 我尝试从 HoldingRoutedEventArgs 创建一个派生类,但它是密封的,所以我不能将它用作基类。
谢谢!
【问题讨论】:
-
感谢罗伯·卡普兰!这对我来说似乎是一个很好的解决方案!
标签: c++ events arguments windows-phone-8.1