In This Article

DoubleAverageConverter Class

Represents a value converter that returns an average of the values that are passed to the converter.

[ValueConversion(typeof(double), typeof(double))]
public class DoubleAverageConverter : DependencyObject
Inheritance:
object object

Constructors

DoubleAverageConverter()

Initializes an instance of the class.

public DoubleAverageConverter()

Properties

ValueCount

Gets or sets the number of values used to calculate the average. This is a dependency property.

public int ValueCount { get; set; }

Property Value

int:

The number of values to use to calculate the average, or -1 for a running average.

Methods

Convert(object, Type, object, CultureInfo)

Converts the specified value to an average based on the previous values converted.

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Parameter Type Description
value object

The value produced by the binding source.

targetType Type

The type of the binding target property.

parameter object

The converter parameter to use.

culture CultureInfo

The culture to use in the converter.

Returns

object:

An average of the specified value and previous values.

ConvertBack(object, Type, object, CultureInfo)

This method always throws a NotImplementedException exception and should not be used.

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Parameter Type Description
value object

Not used.

targetType Type

Not used.

parameter object

Not used.

culture CultureInfo

Not used.

Returns

object

Fields

ValueCountProperty

Identifies the ValueCount dependency property. This field is read-only.

public static readonly DependencyProperty ValueCountProperty