Controls on Pivot disappear
Asked Answered
W

2

110

I have an app with a pivot control. The pivot control has two items (pages), both contain a grid. The grids contain a few buttons and one a map and the other a text block. When the app first runs the pivot works as expected. However, after the app has been running some time, like a day, all the controls on the pivot disappear after pivoting (or swiping). They appear momentarily while swiping, but disappear again once the pivot rests.

Has anyone else experienced this? What could be the cause and solution?

Video: http://www.youtube.com/watch?v=nd7bfTJ53Nk

Code: https://github.com/JamieKitson/TrackLog/

Wyeth answered 19/11, 2013 at 23:50 Comment(29)
We have the same problem. Application with background task and pivot. From time to time, not very often we get this problem. We found exception in crash log from our clients, but not in our code: CDirectManipulationPivot::MoveToPosition, exception type: "c0000005 " Stack: CDirectManipulationPivot::MoveToPosition, CDirectManipulationPivot::OnManipulationCompleted, ... CDirectManipulationServer::ServerThreadStatic, RtlUserThreadStartStinkwood
Can you elaborate how the app and the issue depends on background agent you disabled in video?Claudio
Can you provide the xaml for your Pivot control and maybe any errors/exceptions shown on the Output console?Bloodstone
@AlexSorokoletov The app and the background agent are one and the same, the bug only happens after the app has been running for a long time, like a day, so it will only happen (afaik) for background enabled tasks. In the video I kill the background task to force it to restart, curing the bug.Wyeth
@AlexSorokoletov github.com/JamieKitson/TrackLogWyeth
@ChrisLava xaml is not very interesting: github.com/JamieKitson/TrackLog/blob/master/TrackLog/…Wyeth
@JamieKitson why do you set CacheMode="{x:Null}" on Pivot Items? This is the only place that looks strange to me.Claudio
@AlexSorokoletov I don't know, most likely it was a default or I copied it from an example.Wyeth
@MichalDobrodenka Do you have CacheMode="{x:Null}"?Wyeth
can you share the codePhilomel
@JamieKitson no, I don't have CacheMode="{x:Null}"Stinkwood
did you all ever solve this? we're having the same issueArvind
@Arvind No, but I've stopped developing/using the app.Wyeth
There seems to be some known issue with the pivot. I think you shouldn't worry about it.Cowen
@AnasTasadduq Should the users also not worry about it when they can't see the controls?Wyeth
Yes, you can tell the users to restart the application if this occurs or not leave the application open for such a long time in the first palce.Cowen
@AnasTasadduq The whole point is that it runs in the background.Wyeth
Oh! Then the only solution seems to be is to restart the application when the problem occurs.Cowen
I think the problem might be associated with that map control. Try to subscribe to Pivot's SelectionChanged event and remove the map from visual tree when user goes to another pivot item and add it back when he goes back to pivot item with the map. In the past I worked on an app which also had a map control in a pivot and it caused all sorts of problems.Alurta
A shot in the dark will be to also check if the user is disabling the app or any services it may rely on or goes in a battery saving mode. This may probably stop something you rely on but haven't accounted for.Ursala
@LukášNeoproud I don't think all the other people having this issue are also using the map control.Wyeth
@PavelDonchev The issue is happening to me.Wyeth
@AnasTasadduq Well done.Wyeth
@JamieKitson I understand. Still - is it possible that the phone is in battery saving / have your app or services your app relies on stoppe / suspended / etc?Ursala
a workaround might be to run code that grabs a shot of a part of the UI (say a small box the middle of the screen) and if it sees just black there (or whatever is the current background color) then it would rebuild the UI. That should work then unless the issue is that the app is running low in memory or other resources (could check that with a code profiler I guess)Thallic
i dont' know how is going in windows mobile but in android this is also can happen, you need to reload the instance from the beginning...Chandrachandragupta
I reproduced it on Windows10 too. After some swiping Pivot can loose controls. We simply removed Pivot for now.Himalayas
We have similar issues on windows phone. It happens to both pivot and panorama controls although on panorama it manifests itself a bit differently - after going to a page it shows entrance transition, displays content normally for a split second the goes to the left side as if the entrance transition is not complete.Mcelhaney
We were fixing a memory leak occurring after extensive use of unmanaged resources (camera, QR reader), we managed to clear all leaks nicely when we started to get this issue more often even with lots of memory available. My guess it's resource lack but not necessarily memory.Mcelhaney
S
1

Quite old question, but still unanswered. It seems like it's because of Application_Deactivated event handler, which runs when application is sent to background:

private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
     diagLog("Deactivated, reason: " + e.Reason);
}

In this event handler you should set RunningInBackground = true

Hope that helps

Sheree answered 12/7, 2015 at 4:43 Comment(0)
K
0

I am facing the same issue, and its solved weirdly.

If I use Grid inside PivotItem this Issue comes but when I use some other control like StackPanel or something else it works fine.

Kutzer answered 14/9, 2016 at 10:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.