collectionview

C# - how to get distinct items from a Collection View

▼魔方 西西 提交于 2021-02-17 04:30:10
问题 CollectionView view = CollectionView)CollectionViewSource.GetDefaultView(MyData); View.Filter = i => ((MyClass)i).MyProperty; I have a collection view like in the above. The problem is that the collection MyData which has already been bound to a listview contains duplicate items. How do I get unique items as the result of my filtering? 回答1: This method works: CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(c.Items); view.Filter = i => { var index1 = c.MyData

How can l put TableView inside CollectionViewCell?

大憨熊 提交于 2021-02-11 12:29:14
问题 I have a tableView with several cells (created by MVVM-architecture). In ViewController I fill my tableView like this: tbv.registerCells( withModels: FirstViewModel.self, SecondViewModel.self, ThirdViewModel.self) My task is to put my TableView in one cell of CollectionView. I thought l have to create CollectionView in my ViewController, after it create CollectionViewCell and CollectionCellViewModel, but how to do it exactly I don't understand. If you know, how to make it, help. 回答1: How I

How can l put TableView inside CollectionViewCell?

一世执手 提交于 2021-02-11 12:28:42
问题 I have a tableView with several cells (created by MVVM-architecture). In ViewController I fill my tableView like this: tbv.registerCells( withModels: FirstViewModel.self, SecondViewModel.self, ThirdViewModel.self) My task is to put my TableView in one cell of CollectionView. I thought l have to create CollectionView in my ViewController, after it create CollectionViewCell and CollectionCellViewModel, but how to do it exactly I don't understand. If you know, how to make it, help. 回答1: How I

Xamarin Forms CollectionView Custom Layout Design

末鹿安然 提交于 2021-02-05 11:44:26
问题 In the app that I'm designing, I use collectionview to show loads of images. And this is my current design. And this is the design I want. where the images that are shorter in height will have the next image fill up the white spaces. Heres my code: <CollectionView x:Name="cv_WallPapers" ItemsSource="{Binding Results, Mode=TwoWay}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" SelectionMode="Single" SelectionChanged="cv

NSDiffableSnapshot causes collectionview's cell registration to be re-called even without any changes to the data

空扰寡人 提交于 2021-01-29 13:38:41
问题 I have a problem with NSDiffableDataSource . I have created this basic example containing a UICollectionView with a single item showing a random number: import UIKit class ViewController: UIViewController { enum Section { case main } enum Item { case myItem } var collectionView: UICollectionView! var dataSource: UICollectionViewDiffableDataSource<Section, Item>! lazy var myCellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, Void> { (cell, indexPath, _) in print(

Xamarin.Forms: how to automatically hide first CollectionView

ⅰ亾dé卋堺 提交于 2021-01-29 05:10:15
问题 I work on a Xamarin.Forms app that will contain a page with 2 CollectionView items: an horizontal CollectionView that will display events a vertical CollectionView that will display posts I would like that the first list is progressively hidden as soon as the user starts to scroll on the second list. We can found this behaviour on a sample from Syncfusion : but they use a SfRotator as control for the horizontal list: I've tried to reproduce the same behaviour on my page, but it doesn't work

iOS - scrollViewDidEndDecelerating runs for both scrollView and collectionView

試著忘記壹切 提交于 2021-01-28 09:17:55
问题 I have a VC that contains a collectionView and a scrollView . I put this code to change current page of pageController by scrolling in scrollView : func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { let pageNumber = round(scrollView.contentOffset.x / scrollView.frame.size.width) self.pageController.currentPage = Int(pageNumber) } It works nice for scrollView but the problem is when i even scroll in collectionView it declares and causes unwanted changing in pageController ! What

iOS - scrollViewDidEndDecelerating runs for both scrollView and collectionView

时光总嘲笑我的痴心妄想 提交于 2021-01-28 09:16:57
问题 I have a VC that contains a collectionView and a scrollView . I put this code to change current page of pageController by scrolling in scrollView : func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { let pageNumber = round(scrollView.contentOffset.x / scrollView.frame.size.width) self.pageController.currentPage = Int(pageNumber) } It works nice for scrollView but the problem is when i even scroll in collectionView it declares and causes unwanted changing in pageController ! What

UICollectionView with SwiftUI + Drag and drop reordering possible?

假装没事ソ 提交于 2021-01-27 07:51:12
问题 I'm implementing a UICollectionView inside my SwiftUI View (also with SwiftUI View cells). So I have a Hosting+Representable Combo. Now I want to reorder my cells through drag and drop, but nothing happens. The idea is to use a longpressGesture together with the given functions canMoveItemAt and moveItemAt. Here is the full code: import SwiftUI import UIKit struct ContentView: View { var body: some View { CollectionComponent() } } struct CollectionComponent : UIViewRepresentable { func

Custom Collection View Layout like Chanel app

微笑、不失礼 提交于 2020-12-12 15:05:56
问题 I'm trying to do a custom layout like the Chanel app you can find the app in the Appstore. https://itunes.apple.com/us/app/chanel-fashion/id409934435?mt=8 I know they are using an UICollectionView, but no clue how to start. The interaction feels like a tableview mixed with a paginated scroll. When you scroll the elements grow, and the first element position itself at the top. 回答1: Start with dragging & positioning just one UIView . See UIGestureRecognizer docs and look for existing examples