FlexLayout Improvements

SolomonFriedSolomonFried USMember ✭✭

I was hoping to use the new FlexLayout control to display data in a flowing grid (left to right and then down). The new control seems interesting but is missing some basic features and I was wondering if there are any thoughts on improving the control in upcoming releases.

I would suggest the following features and would hope that the community adds or votes on this discussion.

ItemsSource (bind a list of items to the layout)

DataTemplate

MaxRowsOrColumns. Set the maximum row or column count (depending on Direction) before another row/column is added.

Thank you.

Tagged:

Posts

  • MarcLuderMarcLuder CHMember ✭✭

    I definitely agree with you, @SolomonFried.
    +1 for ItemsSource and DataTemplate !

  • AlmaJensen.9398AlmaJensen.9398 USMember ✭✭✭

    Look up the WrapLayout that has those properties. some google searches for Xamarin WrapLayout and I think you'll find it easily.

  • SolomonFriedSolomonFried USMember ✭✭

    @AlmaJensen.9398
    thanks for the WrapLayout info. I wonder why they would not include that as part of Xamarin.Forms. It is installed as its own nuget package.
    Also, just looking at the code (very little documentation) it does not seem to expose a property for MaxColumns (or anything similar). My guess is that WrapLayout became FlexLayout.
    I use Syncfusion controls and they have a sfListView that does provide what I am looking for and I will probably use that. I would just prefer native controls when they are available.

    Thanks

  • AlmaJensen.9398AlmaJensen.9398 USMember ✭✭✭

    I think most of the layout controls in XF are not native. FlexLayout under the hood are C binaries. I saw the source code on github. WrapLayout started from the last Xamarin Evolve Conference and Jason Smith did a presentation on how to create custom layouts and posted the demo code online. A couple other guys from Xamarin polished it up and posted it online, and then someone else took it much further and added Itemsource and template support to it. The wraplayout is all done in C#.

    Yes I use syncfusion as well though mostly for graphing.

    As to always native controls in XF that's starting to change. There's proposals under way to bring things like the check box, and radio buttons to XF. They've been excluded up until now because apple thinks we don't need them.

  • SolomonFriedSolomonFried USMember ✭✭

    I agree with the proposal to add check boxes, radio buttons etc. to Xamarin.
    Instead of providing controls aimed at the lowest common denominator for all platforms, Xamarin could become the go-to technology for building, on any platform, apps that provide a richer UI than is currently available.
    Radio Buttons,
    Check Boxes
    Complex Buttons (ala WPF)
    AppBar Buttons.
    etc,
    etc.

  • IvanIcinIvanIcin USMember ✭✭✭
    edited October 2018

    While I agree that there should be such a control, your request is technically completely wrong.

    It is like if you requested for DataTemplate in StackLayout, while the thing you need is ListView.

    The same goes here, DataTemplate in FlexLayout is problem rather than a solution. Such app would crash easily with any bigger data and you don't expect Xamarin to ship a Control that should have a remark 'but please add less than 100 items'.

    So yes there is a thing called GridView that is equivalent to the ListView for this sort of layout that you request, it has its equivalents in the native views and Xamarin needs to create renders that would handle things. I would be pretty amazing if anyone in Xamarin is not aware of the lack of this feature, however it isn't trivial to implement and yes I think they should give a higher priority to this.

  • NMackayNMackay GBInsider, University mod

    https://www.davidbritch.com/2018/06/binding-flexlayout-to-collection.html

    It's not out of the box behaviour and as mentioned by @IvanIcin it will have performance overheads without virtualisation, for smaller datasets it should be okay (less than 100 items etc....depends on the complexity of the template) depending on available memory.

    Here's a good example of using Skiasharp and Forms to make a cross platform checkbox.

    https://github.com/Intelliabb/XamarinControls

Sign In or Register to comment.