0
我有一個Listbox
綁定到ObservableCollection
。在我的應用程序中,我需要在OnNavigatedFrom
中清除此集合,並在OnNavigatedTo
中讀取它以減少內存。如何使列表框不記住它的最後一個視圖
但是,我看到使用StackPanel
爲ItemsPanelTemplate
時,Listbox
能記住其最後的觀點(其seletected項目),而VirtualizingStackPanel
沒有。
那麼如何在使用StackPanel
時禁用此行爲?
設置selectedIndex爲-1? – kindasimple