Can StackLayout in Xamarin.Forms use "weight" like Linearlayout of Android? - xamarin

I'd like use BoxView to present timelines, and each color of the lines represents a kind of task.
I have used Grid to do this. However, you know, minute is a small unit so that there are hundreds of rows in one page. That leads to a performance problem.
With Xamarin.Android, I can use Linearlayout, set height "0dp" and set weight attribute a suitable value to do this.
Well, can StackLayout do so? If not, which other layout should I use.
effect drawing

Related

Can NSCollectionViewCompositionalLayout support "growing cells"

I have a collection view showing a simple one-column list with a NSCollectionViewCompositionalLayout. The cells take the full width and have a fixed height.
I would like that, upon an external event, one of the cell grows in height (animated).
That could be for example :
when the cell is selected
when an image shown in the cell is downloaded
I found no way to do this in Apple's doc, when I think this is a fairly common use case. It seems that NSCollectionViewCompositionalLayout is very flexible in positioning cells, but very static. All cell sizes are computed once and for all.
Is there any API for this ? What's the way ?

Does the react-virtualized Masonry component support setting the scrollTop or scrollToIndex values?

I've implemented a Masonry layout that adjusts dynamically to the window size and it all works very well. I calculate its height and width and reset the cell measurements when any outside dimensions change.
I just need to be able to programmatically slide into view a specific item while it is being edited as well as scroll back to top programatically. Is this possible? I've tried to set scrollTop or scrollToIndex but it has no effect (unlike List). I have the feeling that I'm missing something obvious.
Thank you!
Unfortunately, the Masonry component does not currently support a scrollTop prop (other than a partial support required to work with WindowScroller). I would be willing to review a PR adding this functionality, but whether it landed would depend on the complexity. :)

Swift - UIIMageView(Aspect Fill) and automatic row height

I'm trying to figure out how can I solve a problem.
Basically I have a Dynamic TableView, with dynamic Images(Different Sizes).
I want to set always a fixed width:320 for the UIImage and use the Mode: Aspect Fill(Without Clip Subviews), the image maintains the width and set the height dynamically based on my width, but the problem is, my image cover up everything else, like labels, buttons and edges of my cells, I tried to use auto-layout with constraints to reposition these other components(labels,buttons,etc), but not worked.
I don't know if just using the Interface Builder I can solve this behavior or I need to check/calculate some information programmatically.
Any ideas are welcome.
Thanks Team!
Due to lacking of your code as example, I can just suggest you use a swift library from GitHub called Toucan. Toucan is a Swift library that provides a clean, quick API for processing images. And it solve my image problem smoothly.
You should be able to solve this in Interface Builder.
I usually am always able to accomplish my desired layout using constraints and priorities. Only in cases with dynamic type it gets difficult.
I don't know the layout of your cell. It would be helpful if you would post a screenshot of your cell and indicate where the overlap occurs.

should we use StackPanel or Grid as Listbox item template

I heard that in order to improve Listbox performance, we should use simple ListBoxItem template.
In every Listbox row, I want to display 3 images. Should I use horizontal StackPanel for those 3 images, or Grid with 3 columns ?
And, should I specify the height of StackPanel/Grid ? Doing this gains better performance ?
While making a Listbox, the best practice is to use a StackPanel.
The basic difference between a StackPanel and Grid is that, the StackPanel will automatically adjust the Orientation of each ItemTemplate as and when it is added.
If you decide to use a StackPanel, you do not need to specify the Width. You could However specify the Maximum Height of the Stack Panel to make your ListBox look better.
There is no harm in using a Grid either. It would perhaps be a better idea to use a Grid if you wish to have columns of Alpha-Numeric Data.

How to set NSOutlineView to consider minimal content's widths with autolayout?

I have NSSplitView with NScrollView inside it and view-based NSOutlineView inside NSScrollView, it has e.g. one column. My outline view must be scrollable vertically only and it must consider minimal width of column content to fit it. I think they must return -(NSSize)fittingSize with values {minColumnWidth, 0}, but it returns {0,0}. How can I do that?
Try to return the desired view size in (NSSize)intrinsicContentSize. I am not sure if I totally understand your scenario. You could add a screenshot or wireframe to make it easier to understand the setup. Whatsoever, take a look at my question dealing with a similar problem.
Maybe also check out the WWDC Session 232 - Auto Layout by Example. It covers a new split view API together with Autolayout (starting around 41:00 minutes).

Resources