New to Telerik UI for .NET MAUIStart a free 30-day trial

Represents an IValueConverter that converts TimeOnly to TimeSpan and converts back TimeSpan to TimeOnly.

Definition

Namespace:Telerik.Maui.Controls

Assembly:Telerik.Maui.Controls.dll

Syntax:

C#
public class TimeOnlyToTimeSpanConverter : IValueConverter

Inheritance: objectTimeOnlyToTimeSpanConverter

Implements: IValueConverter

Constructors

C#
public TimeOnlyToTimeSpanConverter()

Methods

Converts a TimeOnly value to a TimeSpan.

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

The value to convert. Should be a TimeOnly instance.

targetTypeType

The type to convert to.

parameterobject

An optional parameter (not used).

cultureCultureInfo

The culture to use for conversion (not used).

Returns:

object

A TimeSpan representation of the TimeOnly value, or the original value if conversion is not possible.

Converts a TimeSpan value back to a TimeOnly.

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

The value to convert back. Should be a TimeSpan instance.

targetTypeType

The type to convert back to.

parameterobject

An optional parameter (not used).

cultureCultureInfo

The culture to use for conversion (not used).

Returns:

object

A TimeOnly representation of the TimeSpan value, or the original value if conversion is not possible.