when swipe pivot quickly the pivot performance slowly - windows-phone-7

there
I found that when quickly swiping or flicking the pivot, the pivot will become very obtuse.When the finger off the screen the pivot still traslate between pivotItems a few times.
Is there any way to make the Pivot performance like the Panorama in the situation of quickly swiping or flicking.

I encountered the same problem which was due to using more than 5 tabs each with databinding on them. Each time I swerved to a new page the databinding was triggered thus causing a noticeable delay. (If you keep swirving these requests create a backfill this eventually resulting in multiple background threads for each pivot tab)
I fixed this by collapsing the data on the tabs and only revealing it when the tab was shown for more than 3 seconds. This greatly reduced the databinding and thus data loading. Inmy case though I did have to resort to this because I used the tabs as ways to navigate through dates thus I was facing a potentially limitless collection and had to cycle data across my 5 available tabs. (Microsoft recommends against using more than 5 tabs).
If you have a finite set of less than 6 tabs an easier approach would be to set data binding to ‘one time’ to populate the data. If you have items on the tabs that rely on allowing a control to not just display but also update a value you can always trigger the databinding through that controls events. (be sure to not just use the updated method but also the page.navigateaway event to trigger databinding as navigating away from a page right after updating the value of a control won’t trigger the control.updated event)

Related

How to prevent content jumping/scrolling in Angular 5 with NGRX

Let's say I have a long page with a table (or to be correct with a set of containers that contain tables) and there is a lot of data in these tables, so that it doesn't fit into a screen and therefore it is possible to scroll the page with scrollbars.
Now I have a checkbox in each row of the table so that I can select some rows and perform some actions with them.
These checkboxes are tied to the state so that when I check one of them, the state gets updated and entire page gets re-rendered. If I understand correctly, this leads to unexpected content scrolling (jumping).
So my question is: is there any common approach to avoid this unexpected behavior? I'm thinking of separating user interactions into a separate state, but it feels like a reinventing the wheel a bit. Any other ideas or standard approaches?
#Simon_Weaver, #user2216584 your comments were correct: just need to add trackBy to prevent Angular from redrawing containers

Scroll SlickGrid only one line, when using keyboard navigation

I have implemented a slickgrid and activated keyboard navigation.
When the users is scrolling down using the down-arrow key and reaches the last of the currently visible rows, the grid loads a whole new section of rows and places the selection at the top.
My user tests have all included a complaint about this behaviour as they all find the jump jarring.
I would like to implement behaviour, so the grid scrolls just one line at a time, when I press the down arrow while the last visible row is selected.
I was wondering if there might be some setting, I have overlooked, or if anyone has some suggestions for how to approach the task of adding this behaviour.
(the "problem" is the same, when you scroll upwards - only reversed of course)
This is controlled by the doPaging argument in scrollRowIntoView(row, doPaging) (https://github.com/mleibman/SlickGrid/blob/master/slick.grid.js#L2662). There's no setting to control that behavior, but you could easily add one.
It was initially written this way to make keyboard navigation faster since continuously navigating down doesn't have to do as much work as it would have if we were updating the grid on every 'row down'.

what does Recalculate Layout Paint mean in chrome developer tool TimeLine records?

what does Recalculate Layout Paint mean in chrome developer tool TimeLine records? and how to improve the page performance by reduce the page Recalculate,Layout and Paint's count? can give some suggestion?thanks
Basically, they're your browser figuring out how to draw the changes that you made to the page.
Don't worry about getting rid of them -- if you did that, your site would be static.
However... ...if you want to do something that IS useful for performance, which does have to do with reflows and repaints, then batch your changes together.
Lets say that you got a job at Twitter.
And your job is to write the next version of the window that adds each twitter post to the screen.
If a user gets 250 new tweets in their timeline, and you add each one in a loop, one after the other, the browser is going to slow way down, because every time you add one, it will have to reflow (move things around to make space for the thing you added) and repaint (style everything that was affected by the addition).
A better way of doing it would be to build the list of new tweets together off-DOM (ie: with elements that aren't actually on the page right now), and then add them all at once.
This cuts down on the number of times that a browser has to figure out where everything needs to go.
#Fabricio -- Micro-optimizing might not be great, but appending hundreds of browser elements in a loop, versus putting all of them in at the same time can make a big difference.
Just ask the Twitter guys, who weren't bothering to cache their jQuery objects.
Here's a very handy list of properties and methods that trigger the layout (reflow) of a page:
http://gent.ilcore.com/2011/03/how-not-to-trigger-layout-in-webkit.html
You want to minimize these calls as much as possible -- especially in situations where performance is critical, such as during the scroll event, or when animating large blocks of content.
You can use the "Profiles" tab and "Audits" tab to detect the performance of your code. The will give you a report about your codes.
You can reduce the page Recalculate,Layout and Paint's count by many ways.
Append many child at one time.
Hide elements before change them.
Give images and other elements height and width.

How to speed up dynamically adding user controls in wp7

I have a page in my WP7 app that I build dynamically. I create and add 60 user controls to a grid and it takes around 5 seconds. I need to find a way of speeding this up.
The process is as follows:
Create user control
Add new grid row definition
Set the value of the control row property
Add the control to the grid.Children collection.
It is step 4 that is taking the time. I'm guessing that each time I do this the visual tree is getting re-built.
Is there any way of telling the grid to only re-build the visual tree after I have finished updating the children collection?
Or is there another better way of doing this?
UPDATE: The List Picker control from the WP7 Toolkit was causing the problem. When I changed to one I wrote myself the time taken to display the page on a phone reduced from 25 seconds to 1 second.
The/your aim is to try and reduce the number of times you update the visualtree.
A few suggestions:
Try including (some of) the items in the page by default but just change their visibility depending on what you need.
Build the whole grid in code and add it to the page in one go (rather than a line at a time)
Depending on your content, you could try using a ListBox and alternating the template used for each row to get different content displayed.
The technique which will be best for you will depend on what you're actually adding to the UI. You'll need to test to see what is best for you.
If the UI virtualization (i.e. ListBox) helped, the problem must be in your controls. Templating, bindings, converters, using Xaml instead of C# code, unnecessary Xaml constructs (such as element names), overcomplicated visual tree (e.g. unneeded grids) etc. - those are the things that can degrade the performance.
If you suspect incremental visual tree rebuilds (I don't think so), then simply debug MeasureOverride/ArrangeOverride methods.
I guess this article might give you more tips. I described there how we optimized a similarly complex control - MonthCalendar with 126 sub-controls. Control load time decreased approx. 5x!

WP7 pivot headers stop animating when I scoll too fast

i have a pivot control with around 20 items that are data binded to an observable collection. One of these items has a long text inside, and I think it delays a bit to data bind. when i scroll too fast and pass this item, the headers start to behave strange, the highlighted header disappears from the screen and i see the other headers. the animation of headers stops.
How can i fix this? any ideas? You can reproduce this problem on a device.
thanx
I would have though that having 20 pivot items was more likely to be the cause of the problem, rather than a long pivot title. However, from a user experience point-of-view I would suggest that 20 pivot items is not going to provide a good user experience especially as all pivot items are loaded on when the pivot is started, so performance is likely to be poor, too.
I would suggest that you consider an alternative approach. Perhaps you could use the Panorama to provide a Hub-like experience with your data grouped into different Panorama items. You could then use a Pivot on secondary pages to show group contents where appropriate.
I can't say that I've experienced this, but then I haven't found a need to use a Pivot with 20 pages.
Could it be that if you're finding the need to flick that quikly through the pages that another UX would be more appropriate?
Perhaps a listbox to present a choice of items allowing ultra smooth and fast scrolling, from which the user can choose to select an item and drill down for details.
The databound project template provides some out of the box handling to demonstrate the concept, but don't be show to roll your own in a vanilla project template.
I've experienced the same issue with a pivot control with only 4 pivot items. The animation gets screwed up when the pivot item containing a long list is selected, so I'm guessing that because pivots don't load their data until the item is selected, that the pivot control is getting screwed up trying to load the long list while animating...so it gives up on the animation.
I haven't really figured out what to do about this yet. One solution is to not bind the data in the pivot item until that item is selected. This isn't really ideal, but it would likely solve the animation issue.

Resources