diff --git a/src/Samples/Samples.Shared/OneWaySeqPage.xaml b/src/Samples/Samples.Shared/OneWaySeqPage.xaml
index 371e3b9f..61f6bb55 100644
--- a/src/Samples/Samples.Shared/OneWaySeqPage.xaml
+++ b/src/Samples/Samples.Shared/OneWaySeqPage.xaml
@@ -1,12 +1,19 @@
-
+ d:DataContext="{d:DesignInstance Type=samples:DesignData, IsDesignTimeCreatable=True}">
+
+
+
+
@@ -18,20 +25,21 @@
+
+ Text="Binding. oneWay"
+ TextWrapping="WrapWholeWords" />
+ Text="Binding. oneWaySeq"
+ TextWrapping="WrapWholeWords" />
+
+
+
+
+
+
diff --git a/src/Samples/Samples/OneWaySeq.fs b/src/Samples/Samples/OneWaySeq.fs
index 982c9c53..1b897ab0 100644
--- a/src/Samples/Samples/OneWaySeq.fs
+++ b/src/Samples/Samples/OneWaySeq.fs
@@ -1,31 +1,44 @@
module Elmish.Uno.Samples.OneWaySeq.Program
-open System
+open System.Threading.Tasks
+open FSharp.Collections.Immutable
open Elmish
open Elmish.Uno
type Model =
{ OneWaySeqNumbers: int list
- OneWayNumbers: int list }
+ OneWayNumbers: int list
+ IncrementalLoadingNumbers: int FlatList }
let initial =
{ OneWaySeqNumbers = [ 1000..-1..1 ]
- OneWayNumbers = [ 1000..-1..1 ] }
+ OneWayNumbers = [ 1000..-1..1 ]
+ IncrementalLoadingNumbers = [ 1..1..10 ] |> FlatList.ofSeq }
let init () = initial
type Msg =
| AddOneWaySeqNumber
| AddOneWayNumber
+ | LoadMore of count: uint * tcs: TaskCompletionSource
let update msg m =
match msg with
| AddOneWaySeqNumber -> { m with OneWaySeqNumbers = m.OneWaySeqNumbers.Head + 1 :: m.OneWaySeqNumbers }
| AddOneWayNumber -> { m with OneWayNumbers = m.OneWayNumbers.Head + 1 :: m.OneWayNumbers }
+ | LoadMore (count, tcs) ->
+ let intCount = int count
+ let builder = m.IncrementalLoadingNumbers.ToBuilder()
+ let max = FlatList.last m.IncrementalLoadingNumbers
+ for i = max + 1 to max + intCount do
+ builder.Add(i)
+ tcs.SetResult(count)
+ { m with IncrementalLoadingNumbers = builder.ToImmutable() }
let bindings : Binding list = [
"OneWaySeqNumbers" |> Binding.oneWaySeq ((fun m -> m.OneWaySeqNumbers), (=), id)
+ "IncrementalLoadingNumbers" |> Binding.oneWaySeq ((fun m -> m.IncrementalLoadingNumbers), (=), id, (fun _ -> true), LoadMore)
"OneWayNumbers" |> Binding.oneWay (fun m -> m.OneWayNumbers)
"AddOneWaySeqNumber" |> Binding.cmd AddOneWaySeqNumber
"AddOneWayNumber" |> Binding.cmd AddOneWayNumber