Active when the number of items in a collection fulfills some criteria.

The collection is specified with Items.

WhileCount accepts a combination of properties that form an open or closed range of numbers to test against. The trigger is active while the count of items matches.

  • EqualTo is used on its own and the item count must match this number.
  • Using just LessThan or LessThanEqual the count of items must be less than, or less than or equal to, this number.
  • Using juse GreaterThan or GreaterThanEqual the count of items must be greater than, or greater than or equal to, this number.
  • Using both a LessThan or LessThanEqual and GreaterThan or GreaterThanEqual creates a closed range to compare. The number of items must be within this range.

This example shows how to use WhileCount and WhileEmpty with an Observable:

<JavaScript>
    var Observable = require("FuseJS/Observable");
    module.exports = {
        friends: Observable("Alice", "Bob", "Courtney")
    }
</JavaScript>
<WhileEmpty Items="{friends}">
    <Text>Your friends list is empty.</Text>
</WhileEmpty>
<WhileCount Items="{friends}" EqualTo="1">
    <Text>Your have 1 friend.</Text>
</WhileCount>
<WhileCount Items="{friends}" GreaterThan="3" >
    <Text>You have more than 3 friends.</Text>
</WhileCount>
<WhileCount Items="{friends}" GreaterThanEqual="1" LessThanEqual="3" >
    <Text>You have 1-3 friends.</Text>
</WhileCount>
<WhileCount Items="{friends}" GreaterThanEqual="2" LessThanEqual="5" Invert="true">
    <Text>You do not have 2-5 friends.</Text>
</WhileCount>

Location

Namespace
Fuse.Reactive
Package
Fuse.Reactive.Bindings 1.9.0

Interface of WhileCount

EqualTo : int ux

Active when the count of the collection is equal to the provided value.

GreaterThan : int ux

Active when the count of the collection is greater than the provided value.

Items : object ux

Specifies the collection whose item count will be compared.

LessThan : int ux

Active when the count of the collection is less than the provided value.

LessThanEqual : int ux

Active when the count of the collection is less than or equal to the provided value.

Inherited from WhileTrigger

BypassSetActive(bool) uno

Call in situations where the bypassing is forced. This should be rare since during rooting the normal bypass mechanism of the trigger will apply.

Invert : bool ux

Inverts the trigger so it will be active when it would normally be inactive, and vice versa.

Inherited from Trigger

BackwardAnimation : TriggerAnimation ux

Specifies an explicit backward animation instead of using the implied backward animation of the animators involved. Be aware that actions are not part of the animation.

CrossFadeDuration : double ux

If there is a transition between forward/backward playback and two timeilnes are being used (implicit or explicit) this specifies the cross-fade time.

Deactivate uno

Deactivates the trigger (target progress of 0).

Pulse uno

Plays the trigger to progress 1 then back to 0.

RequireLayout(Visual) uno

Indicates the trigger is bound to the layout of a visual. This will keep the trigger in Bypass mode until after the first layout of the element is obtained. This is required since layout does not happen in the same root grouping/update phase as the creation of the element, yet not having a layout should qualify as part of the rooting period.

Inherited from NodeGroupBase

Nodes : IList of Node ux

Nodes to add to the Parent when this trigger is any non-deactivated state (Progress > 0)

Inherited from Node

ContextParent : Node uno

The context parent is the semantic parent of this node. It is where non-UI structure should be resolved, like looking for the DataContext, a Navigation, or other semantic item.

FindNodeByName(Selector, Predicate<Node> (Node)) : Node uno

Finds the first node with a given name that satisfies the given acceptor. The serach algorithm works as follows: Nodes in the subtree are matched first, then it matches the nodes in the subtrees ofthe ancestor nodes by turn all the way to the root. If no matching node is found, the function returns null.

IsRootingStarted : bool uno

Whether rooting of this node has started. Note that even if this property returns true, rooting may not yet be completed for the node. See also IsRootingCompleted.

Name : Selector ux

Run-time name of the node. This property is automatically set using the ux:Name attribute.

OnRooted uno

If you override OnRooted you must call base.OnRooted() first in your derived class. No other processing should happen first, otherwise you might end up in an undefined state.

Inherited from PropertyObject

Inherited from object

Attached UX Attributes

GlobalKey (attached by Resource) : string ux

The ux:Global attribute creates a global resource that is accessible everywhere in UX markup.

Implemented Interfaces

IScriptObject uno

Interface for objects that can have a script engine representation