简体   繁体   English

如何在OnNavigatedFrom事件中更新辅助磁贴

[英]How to update a secondary tile in the OnNavigatedFrom event

I have implemented live tiles in my application, whereby a user may pin a secondary tile to the start screen. 我已经在应用程序中实现了实时磁贴,用户可以将辅助磁贴固定到开始屏幕。 The issue I am having is how to update the BackgroundImage of the secondary tile when the user selects a new image in the application. 我遇到的问题是,当用户在应用程序中选择新图像时,如何更新辅助图块的BackgroundImage。 As far as I can tell, the best way to update the BackgroundImage so the user always sees the new image he or she has chosen, is to update the secondary tile in the OnNavigatedFrom event on my MainPage. 据我所知,更新BackgroundImage以便用户始终看到他或她选择的新图像的最佳方法是更新MainPage上OnNavigatedFrom事件中的辅助图块。 I am not sure how to udpate a secondary tile though that is not created in a click event. 我不确定如何在次点击中未创建辅助贴图。

To add a little bit more detail, my application has a hubtile, and I have created a ContextMenu with a 'pin to start' option and a 'change image' option. 为了添加更多细节,我的应用程序具有功能,并且我创建了一个ContextMenu,带有“ pin to start”选项和“ change image”选项。 The 'change image' option loads the PhotoChooserTask and allows the user to pick an image from there and then saves that image in isolated storage and applies it to the hubtile. “更改图像”选项将加载PhotoChooserTask,并允许用户从那里选择图像,然后将该图像保存在隔离的存储中,并将其应用于中枢。 When the user clicks 'pin to start', a secondary tile is created which has the same image as its respective hubtile. 当用户单击“固定到开始”时,将创建一个辅助图块,该图块具有与其各自的无效对象相同的图像。 So far this works, but when I change the image in the application's hubtile, I do not know how to automatically update the respective secondary tile's image on the start screen. 到目前为止,这是可行的,但是当我在应用程序的中心位置更改图像时,我不知道如何在开始屏幕上自动更新各个辅助磁贴的图像。 Every method I have researched online shows how to update a tile instance in the same click event as where the tile is created (perhaps in a button click event saying 'create tile'), but how would I get an instance of this tile to update in another method or event handler, such as the OnNavigatedFrom event? 我在线研究的每种方法都显示了如何在创建磁贴的相同单击事件中更新磁贴实例(也许在一个名为“创建磁贴”的按钮单击事件中),但是如何获取该磁贴的实例进行更新在另一个方法或事件处理程序中,例如OnNavigatedFrom事件?

您可以从onnavigatedfrom代码中删除辅助磁贴并将其像新的一样添加

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM