New to Telerik UI for WPFStart a free 30-day trial

Converts a file size in bytes (long) to a human-readable string (e.g. "1.5 MB").

Definition

Namespace:Telerik.Windows.Controls.ConversationalUI

Assembly:Telerik.Windows.Controls.dll

Syntax:

C#
public class FileSizeConverter : IValueConverter

Inheritance: objectFileSizeConverter

Implements: IValueConverter

Constructors

C#
public FileSizeConverter()

Methods

Converts a numeric byte count to a formatted file size string.

C#
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Parameters:valueobject

The file size in bytes.

targetTypeType

The type of the binding target property.

parameterobject

The converter parameter (not used).

cultureCultureInfo

The culture to use in the converter.

Returns:

object

A human-readable file size string such as "512 B", "1.5 KB", "3.2 MB", or "1.1 GB".

Not supported. Throws NotSupportedException.

C#
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Parameters:valueobjecttargetTypeTypeparameterobjectcultureCultureInfoReturns:

object