Comments (5)
Need to modify the SimpleGalleryPageModel.cs
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Xamvvm;
namespace DLToolkitControlsSamples
{
public class SimpleGalleryPageModel : BasePageModel
{
public void ReloadData()
{
var list = new ObservableCollection<ItemModel>();
string[] images = {
"https://farm9.staticflickr.com/8625/15806486058_7005d77438.jpg",
"https://farm5.staticflickr.com/4011/4308181244_5ac3f8239b.jpg",
"https://farm8.staticflickr.com/7423/8729135907_79599de8d8.jpg",
"https://farm3.staticflickr.com/2475/4058009019_ecf305f546.jpg",
"https://farm6.staticflickr.com/5117/14045101350_113edbe20b.jpg",
"https://farm2.staticflickr.com/1227/1116750115_b66dc3830e.jpg",
"https://farm8.staticflickr.com/7351/16355627795_204bf423e9.jpg",
"https://farm1.staticflickr.com/44/117598011_250aa8ffb1.jpg",
"https://farm8.staticflickr.com/7524/15620725287_3357e9db03.jpg",
"https://farm9.staticflickr.com/8351/8299022203_de0cb894b0.jpg",
};
int number = 0;
string group = "";
for (int i = 0; i < images.Length; i++)
{
number++;
if (i < 3) group = "0";
else group = "1";
var item = new ItemModel()
{
ImageUrl = images[i],
//FileName = string.Format("image_{0}.jpg", number),
FileName = group,
};
list.Add(item);
}
var sorted = list
.OrderBy(item => item.ImageUrl)
.GroupBy(item => item.FileName)
.Select(itemGroup => new Grouping<string, ItemModel>(itemGroup.Key, itemGroup));
Items = new ObservableCollection<object>(sorted);
}
public ObservableCollection<object> Items
{
get { return GetField<ObservableCollection<object>>(); }
set { SetField(value); }
}
public class ItemModel : BaseModel
{
string imageUrl;
public string ImageUrl
{
get { return imageUrl; }
set { SetField(ref imageUrl, value); }
}
string fileName;
public string FileName
{
get { return fileName; }
set { SetField(ref fileName, value); }
}
}
public class Grouping<K, T> : ObservableCollection<T>
{
public K Key { get; private set; }
public Grouping(K key, IEnumerable<T> items)
{
Key = key;
foreach (var item in items)
this.Items.Add(item);
}
}
}
}
and the SimpleGalleryPage.xaml
<flv:FlowListView SeparatorVisibility="None" HasUnevenRows="true"
IsGroupingEnabled="true" FlowGroupDisplayBinding="{Binding Key}" FlowGroupShortNameBinding="{Binding Key}"
FlowItemTappedCommand="{Binding ItemTappedCommand}" FlowLastTappedItem="{Binding LastTappedItem}"
FlowColumnMinWidth="110" FlowItemsSource="{Binding Items}">
from dltoolkit.forms.controls.
Thanks @BuzasP :)
from dltoolkit.forms.controls.
Please why SetField and GetField don't work for me ?
from dltoolkit.forms.controls.
@BuzasP code is not working , sorted cannot convert to items , does anyone has idea ?
from dltoolkit.forms.controls.
Where is BasePageModel
? Why not full sample there ?
from dltoolkit.forms.controls.
Related Issues (20)
- UWP, Disable row highlight does not work. HOT 1
- DLToolkit.Forms.Controls.FlowListView not working in UWP
- ImageCropView: "Can not access a closed stream." HOT 1
- How do you use FlowListView with design time data
- UWP issue - FlowLoadingCommand keeps loading 5 times ahead of the page size
- Footer is suddenly missing after updating Xamarin.Forms
- Does not move or zoom in XF 4 HOT 2
- Long pressing AND tap command in a list item using effects ?
- ImageCircleCrop Pan and Pinch doesnt seem to be working with latest version HOT 1
- Unable to spy items with Appium HOT 1
- Long tap event with FlowListView
- TagEntryView loses focus when a new tag is added on UWP.
- Extra new elements from OnElementChanged in UIView on iOS HOT 6
- Binding subproperty of object to FlowItemsSource throws NullRefenceException HOT 1
- Creating sections with different layouts but no grouping
- Add column in Flowlistview
- Heavy lags when connected with debugger to Android on VS2019 16.9.2 and newer HOT 2
- it won't work with ios 15 anymore, are you planning to fix it?
- Since ios 15 reload from event handler leads to immense flickering! HOT 2
- InfiniteScroll, binding FlowTotalRecords doesn't work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dltoolkit.forms.controls.