.Net Maui Slow Loading CollectionView and UI Tree structure - xaml

So I set out to do a simple interface with a search field, a couple of "tabs" that represent data categories and a CollectionView to show the data as the figure below
During development I noticed that when I set a tab that had more data, the loading would take a longer time (too long), and everything would kind of get stuck waiting for it to respond, so I started making some tests on how the CollectionView gets populated (via the ChildAdded event) and here are my findings
In most cases the CollectionView will load Childs that fit in the view (in my screenshot for example it would only load 4 children), and everytime you scroll it will load the appropriate number of items to fill the screen. This happened when the collection only had this types of ancestor Elements - ContentPage, Frame, RefreshView. ScrollView, TableView, Grid (if not set to Auto), HorizontalStackLayout, FlexLayout, toolkit:DockLayout
However there are other cases where all the childs are loaded right away, this happens when the CollectionView is the descendant of this types - ScrollView, VerticalStackLayout, StackLayout, AbsoluteLayout, Grid (when set to auto)
Does anyone have any idea why this happens?
Also is it possible to make it load a fixed number of Children each time, let's say instead of loading enough items to fill the View I want to load 10 items (note that loading the data incrementally with RemainingItemsThresholdReachedCommand for example, only loads the data into memory, and doesn't create a child item in the View)
Note this tests are not exhaustive and there can be other combinations of ancestors/configurations that have different results, and they where only done with Android emulator

Related

How to disable Sap Business One form's default resizing behavior?

I'm developing the custom UI layout system for our custom SBO forms. I.e. catching form's resize event and arranging the controls according to our specific layout logic. The problem is that, apparently, SBO tries to arrange controls according to its (clunky and primitive) logic on every form resize first! My code handling the resize event and rearranging the items works, but there is a noticeable performance delay, as items are essentially re-positioned twice on each form resize - once by SBO itself, and then by my code.
Is there any way to stop SBO arranging controls on our custom forms during resize, so that they will be positioned only once by my code (in the resize event handler)?
This page by Boyum IT helps to explain what the resizing rules are.
There's additional information on this page
To summarize those pages, every form is split into 4 quadrants, which are effectively pinned to the corners of the form that they belong to.
That means that as you resize the form, these quadrants separate from each other, leaving large sections of space between them.
I don't believe that there's an easy way to prevent this behavior out of the box, but you can manually override it using the B1 UI API, by setting the LinkTo property of the Items to match the ID of one of the Items in the top left quadrant, which causes the given item to move with the same behavior as that of the item specified in LinkTo.

First segment of my segment controller doesn't respond

I have a settings screen with a couple of segmented controls on it. All was well until I added a third. Now the new one works, and the top one works, but the one in the middle doesn't...
It used to work fine, but now the first segment doesn't respond. If I click on segments 2 through 4 my controller's method is called as expected. If I click on the first segment... nothing.
I suspect there is another flag somewhere that I hit by mistake, but I can't find it. Yes, all of the segments are Enabled. Any ideas?
I would suggest looking through the hierarchy in detail: the tap is possibly trapped by a partially overlapping view.
If a tap does not respond because the size of an element changes, it may because it is hidden by one of these:
an unconventionally long navigation item
a view with no visible content
a title view
This amazing tool has saved me time and again: Spark Inspector. It shows you the intricate overlapping layers of all your UIViews.

How does the Reeder Mac app animate lists when switching folders?

Initially I was under the impression that it uses the table row slideup/down animations while inserting/deleting new rows but I doubt if it's doing that as it does it so fluidly even with thousands of items in the list (otherwise it would take a lot of time for the deletions/insertions to work).
Am I right in my assumption that it's simply attaching a new instance of the News list at the bottom of the screen, shrinking the above one while the one at the bottom expands to fill up space?
UPDATE:
Please see this video of what I mean: http://dl.dropbox.com/u/4960327/ReederAnim.mov
I can not tell you exactly how Silvio Rizzi made this, but as you see in the playback, a list view is added behind the shown list view, and the front list view fades out (.alpha = 0.0;) while the list view behind it expands its height per row.
When you desicate it frame by frame it becomes quite clear what he does, and it is really not that advanced. But I have to admit, with the white "milky" polished interface, it looks quite neat.
In addition, you can see that while animating, the background list view only renders the top 7 entries (hopefully calculated by dividing the view height with the average height of the cells shown) making the list view quick to load. Then afterwards, he can load an extended array of cells once you start scrolling, or in a background thread starting once the animation is complete.

Lazy loading images in a UITableView that has a scroll index

I think this is a new spin on an old question, but I'm completely stuck here.
In my app, I have a UITableView with 650 cells, each with a custom 16x16 RGB icon. On most recent iOS devices, loading all of those icons into memory before displaying the table works totally fine, but on older hardware, I'd like to implement a lazy load system that only loads icons it needs.
I've implemented the Apple LazyTableImages example, (which uses a UIScrollView delegate to determine when the table stops moving to load the visible icons), but I've run into another snag.
My UITableView also has a section index display (ie the list of labels on the right hand side you can swipe up and down to scroll quickly), and the LazyTableImages example hasn't taken this into account.
If I scroll using the index, the images won't lazy-load. :(
As far as I can see, the scroll index doesn't actually have any delegate events it triggers.
So I'm wondering, has anyone else tried to implement lazy-loading on a table with a scroll index? Is there any way to track the index and find out if the user has interacted with it?
Thanks!
After buzzing around a few of my iOS developer buddies, I came up with a solution that worked well enough.
I set it up so that in addition to the icons being loaded from the UIScrollView delegates, an NSTimer object will periodically call a method that checks the currently visible table cells ([UITableView indexPathsForVisibleRows]) every .5 seconds, and loads any icons on the screen that haven't been loaded yet in a single separate thread.
I tried to make the solution as efficient as possible, so I made sure the timer was only active when the tableView was visible and stationary, and I liked it since it meant that every visible icon regardless was addressed.
One thing I discovered was that if the tableView was reloaded while the thread was looping through the visible cells (rare, but was possible), it would crash. The solution to this was to make sure each cell data source entry was retained while the icon was being loaded.

Cocoa one row table view or a horizontal list view

Is it posible to use table view to show just one row of a big amount of elements? What I'm looking for is for some kind of horizontal list, like we have in XCode preferences or Aperture image list.
It would behave just like a one columnt table view, but instead of showing the elements vertically, it should be horizontally.
Can you point me to where should I start from?
If you're okay with Leopard-only, The new NSCollectionView supports horizontal display. Just set the collection view's number of rows to 1 in Interface Builder; it'll even handle the horizontal scroll bar for you. The IconCollection sample code provides a simple demonstration of how it works. It's bindings work similarly to a table view's, except instead of rows and columns, each object represented gets an 'item' (an object of type NSCollectionViewItem) that displays it, and those items will be laid out in a grid. The sample code above demonstrates how to set up these 'items' in Interface Builder, which is definitely the easiest way.
With a table view? No. If I'm understanding correctly what you want, in the past I've created my own NSView subclass for this type of control. Define a data source protocol similar to NSTableView, and in your NSView drawRect method, draw the elements in order one by one from left to right. You can either keep track of paging in your control, or put it in a scroll view and resize yourself whenever the number of items changes.
Usually this type of thing starts off pretty simple, and gets a bit complex once you start handling caching, paging, selection, mouse and keyboard input and so on. My advice, start as simple as possible and add new features one by one, only after you've finished the previous task.