Collection View inside scroll view in xamarin.forms - c#

I am working in xamarin.forms. I have the collection view inside the scroll view. I know it is not a good practice but I am not in a position to change the whole code from scratch. Because of this, there are two scrolls on my single page, especially in IOS. I have gone through several articles, the below link is one of them but I could not access the whole code.
https://luismts.com/collectionview-inside-scrollview/
Is there any workaround? The blue arrows are my two different collection views and the whole page has inside Scroll View.

I suggest you use Bindable layout instead of collectionview here. The bindable layout uses the parent scrollview and this will not create multiple scrollable layouts like collectionview.
Here is the official xamarin documentation: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/bindable-layouts

Related

How to implement panel with features of ListBox And FlipView in WPF

I'm am not good enough in WPF, so I'd like to ask for any advice how to implement panel layout something link displayed on image below:
So, the main purpose is to display a collection of items with possibility to select a single item, which should be moved to the first position (probably with animation) and then another item template should be applied to that container (it is bigger than other items in the collection). The list doesn't have to be infinitive, so just like a simple ListBox.
For me it looks like a FlipView but with a few items, which are neighboring siblings of the selected one and are also visible in the panel's viewport.
Please, advice me how to implement such a panel, or if you have seen something suitable, please, provide a link to the source.
You need to create your custom panel using User control.
Here is one example which is similar to your requirement.

Make ListView show all items?

I'm building an application in Xamarin Forms targeting iOS, Android and ideally also UWP, but that's not absolutely required. I have a page which will have three ListView controls. Each ListView is databound with the items coming from the database. I'd like each of them to size so that all items can be seen without scrolling the ListView. Instead the page should scroll. I've tried changing the page so that the lists are contained in a StackLayout instead of a Grid, and have also tried various combinations of setting the layout and views' VeriticalOptions to ExpandAndFill, but each takes up roughly a third of the screen making the lists larger than they need (for the first two, which only contain a few items) or too small (for the third, which may contain a number of rows).
How can I get the views to resize and show all of their items?
Having a ListView inside a ScrollView is not recommended, i'd suggest to bind your three lists into a single ListView and then using TemplateSelectors and/or grouping to achieve the look and feel you are looking for.
You need to set a height on the ListView in order to achieve a fixed height. If the ItemSource for the list is dynamic I would suggest using a single list with grouping. Some details that might help you can be found on this related topic here.
If your list is static then just set the ListView.Height = <appropriate size> for each listview

Display items in different styles(List, Grid, Blocks) in Xamarin ios?

i am new to xamarin ios.
i want to implement display items in different styles (List,Grid,Blocks) in view controller.
I tried with table view cell, But i am unable to make it proper.
Please find the below images.
When ever we click on icons (List icon, grid icon, Block icon) we need to display the different styles view in same view controller.
Please suggest me how to make it possible.
Thanks in advance.
As you are talking about view controllers and table view cells I assume you are not working with Xamarin Forms.
This means you are creating a native iOS user interface and what you are trying to accomplish can be done with a UICollectionView.
In particular you want to use the performBatchUpdates:completion: method, which allows you to animate reload and move operations.
Xamarin example: https://github.com/xamarin/monotouch-samples/tree/master/CircleLayout
Very good and comprehensive tutorial (Objective-C): https://www.objc.io/issues/12-animations/collectionview-animations/
There are two videos about collection views from the WWDC 12 which I suggest you too see: https://developer.apple.com/videos/wwdc2012/
Introduction to collection view tutorial (Swift): https://www.raywenderlich.com/78550/beginning-ios-collection-views-swift-part-1
Tutorial on animations while dragging collection view elements (Swift): http://nshint.io/blog/2015/07/16/uicollectionviews-now-have-easy-reordering/

WPF: One window, multiple views

Once I asked how to display multiple views in one window in a windows-forms-application (link).
Now I'd like to know how to do the same in an WPF-application.
You could have in your MainWindow.xaml, just one Stackpanel. Nothing else.
You define all your views in other xaml files. Just that the parent element is not a Window. You need to have it as a Grid/StackPanel.
When you want to load a new view, you just set the appropriate view's root element(or the view itself) as the Children of the StackPanel in MainWindow.xaml
Your best option is to use an MVVM framework such as Caliburn.Micro, which makes view composition very easy. In this case, you would have your shell screen for example, which would be a conductor, and each of your sub screens would just be other view models, which your shell would have references to, and each would become the active item when they needed to be displayed.
I would recommend you to go to MVVM framework . I think you need a MainTabControl which will have child controls. The child controls are not needed to be Windows but UserControls. You can use DataTemplates in wpf to choose the view according to the viewmodel.
Please do let me know if you need more explanation on this.

Keyboard Map Binding

I'm having some trouble coming up with a xaml page that would bind to a keyboard layout displayed on a page. Originally I have an ObservableCollection of rows that contain a KeyboardKey datatypes that specify the width of a button. The collection is bound to a listbox in the xaml. The problem I'm having is that on some keyboards the the height of a key spans two rows, which the xaml listbox does not support. I would like to avoid hard coding a bunch of keys in the xaml. Any thoughts on how to approach this?
You can create you own layout buy inheriting one of container controls and overriding
ArrangeOverride method.
You can find the example here: http://www.wpftutorial.net/CustomLayoutPanel.html
When I was creating the virtual keyboard, I declined automatic layout and put the buttons manually in designer. I think in some cultures it is better to put key rows with horizontal shift and in others it is better to to place buttons under each other. So I have a flexible layout and can quickly edit it in designer.

Categories