Log In
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Collapse]Layout Management
   [Expand]Dock Windows
   [Expand]Tile and Layout
   [Expand]Tab Control
    [Expand]Getting Started
      Product Class Structure
      Attached Properties
      Basic Principles
      Functions and Parameters
    Book Control
    Workspace Manager
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Functions and Parameters

As described in Basic Principles, carousel works by binding item elements to Parameters, which are actually functions that take a position on a path as an argument. This mechanism is very flexible, because any representation aspect can be animated. In addition to flexibility, it is powerful and easy to use, because the resulting function can be a combination of three. This topic describes function types used in Carousel controls, and provides information on how they are combined to obtain the resulting function value at each path point.

Expanded Function Basics

Functions are FunctionBase descendants. This class provides a single public method (FunctionBase.GetValue) that accepts an argument and should return the bound property's value. Parameter values range from 0 to 1. Function values depend on the bound property type. For instance, if you need to change element opacity, you'll need to provide values between 0 and 255. If you'll need to customize more complex data structures, say colors, you'll need to use type converters when binding your properties. For an example, review the Conditional Item Parameters tutorial shipped with DXCarousel.

DXCarousel provides several built-in functions that you can use in your applications.

Function Class Description
EqualFunction Simply returns the argument.
LinearFunction A linear function in form of "K * Argument + B". K and B values can be specified using the corresponding properties of the LinearFunction class.
SquareFunction Returns the square of the argument.
SineFunction Allows you to emulate sine curves. The function returns "A * Sin (Argument * W)". You can specify the coefficients via the corresponding properties.
ZeroFunction Always returns zero.
ConstantFunction Always returns the same constant value specified via the Constant property.

If you want to declare a custom function, derive from FunctionBase and override its GetValueOverride method, called by FunctionBase.GetValue. See Lesson 4 - Using Functions and Parameters for an example.

Expanded Distribution Function

When you create a Parameter, its Distribution function is specified by the Parameter.DistributionFunction property. This function's argument changes from 0 to 1, where 0 is the starting point and 1 is the ending point of the path. For instance, if you want the element in the middle to be the biggest, provide a function that returns small values for boundary arguments, and gradually increase the result when the argument approaches 0.5.

Using Distribution Functions, you can control element settings depending on their position along the path. You can also provide non-uniform element positioning using the same technique. To see an example, see the Item Distribution tutorial shipped with DXCarousel.

Expanded Transition Animation Functions

When the carousel is scrolled, its items move from one static position to another. Animation Transition Functions are created to provide control over these movements. Their arguments also change from 0 to 1, 0 being the starting point of a transition and 1 being the ending point. For examples of effects based on these functions, see the Animation Effects demo shipped with DXCarousel.

You can specify two functions for animation transitions - using the Parameter.AnimationAddFunction and Parameter.AnimationMulFunction properties. See the following section for information on how they influence the resulting bound property value.


If you scroll the view by multiple items (e.g. by page), Transition Animation is applied only once.

Expanded Function Combination

As described above - for each property value you can specify three functions - one Distribution Function and two Transition Animation Functions. For each element position along the path, DXCarousel also calculates its position within the transition (if it's in progress). The resulting property value is calculated using the following formula.

Property Value = Distribution Function (position) * Animation Multiplier Function (transition position) + Animation Additional Function (transition position)

As you see, using transition animations you can both modify the distribution value by providing a coefficient, or by adding/subtracting from its value. Obviously, some of these functions can simply return 0 or 1, so as not to affect the result, if you don't need them.

Is this topic helpful?​​​​​​​