How to set Page Navigation from Listbox to another Page?

后端 未结 3 1856
情话喂你
情话喂你 2020-12-21 14:20

Hi am using XAML file given below.I want to Navigate Listbox selected item to another page.

 

        
3条回答
  •  轮回少年
    2020-12-21 14:47

    You have set ItemsSource="{Binding Images}" for your list box which means that you should not cast to Notch in your SelectionChangedHandler. Every item receives an image as its data context which is an element from the list Images inside a Notch instance.

    Therefore, you can only cast to String inside your handler.

    You have a top-level listbox and each item again has its own listbox. You are tracking the selection changes for the inner list and in that case your data context is individual item for that list. You do not have access to parent scope inside it.

提交回复
热议问题