0
在MAXL,我可以實現這樣添加pointermoved事件TextBlock的:如何使用XAML中的pointerMoved事件函數連接窗口小部件?
<TextBlock Text="Drag and Drop"
AllowDrop="True"
PointerMoved="TextBlock_PointerMoved"
/>
然後,我只需要實現的功能來完成的pointermoved工作:
TextBlock_PointerMoved(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
但現在,我需要使用C++在代碼區執行此操作,我將新建一個文本塊,並在代碼中創建所有內容。例如:
TextBlock^ my_textblock = ref new TextBlock();
my_textblock->SetValue(TextBlock::TextProperty, "My Text Block");
my_textblock->SetValue(TextBlock::WidthProperty, 100);
我應該怎麼做連接與插件的pointermoved事件函數?希望如下:
my_textblock->SetValue(TextBlock::PointerMovedEvent, myPointerMovedFunction);
但它不起作用。 非常感謝。