2017-02-10 115 views
0

不知道爲什麼發生這種情況,但(有時)當我改變設備的方向,這是輸出我得到:古怪的行爲

enter image description here

似乎只正在iPad上發生。不是iPhone。任何見解?

回答

0

結束導航返回到同一頁面以避免這種情況。似乎在我的代碼或Xamarin的限制,我有一個複雜的設置,這是可能的。

0

可能是一個ObservableCollection綁定到ListView的錯誤。

您可以通過覆蓋當前ContentPage的OnSizeAllocated來強制刷新ListView。

protected override void OnAppearing() 
{ 
    base.OnAppearing(); 
    ExampleListView.ItemsSource = null; 
    ExampleListView.ItemsSource = ObservableCollection; 
} 
+0

當取向改變時,OnAppearing不會被調用。 – jdmdevdotnet

+0

我寧願完全重新加載頁面。有沒有辦法做到這一點? – jdmdevdotnet

+0

你說得對,我想要OnSizeAllocated。您是否嘗試在內容視圖控件上調用Invalidate()? https://developer.xamarin.com/api/member/Xamarin.Forms.Layout.InvalidateLayout()/ – Zroq