Skip to main content
All docs
V24.1

ICustomPropertyValueConverterAttribute<T>.ConvertToString(T) Method

Converts a custom property value declared in metadata to a string.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v24.1.Core.dll

NuGet Package: DevExpress.Dashboard.Core

Declaration

string ConvertToString(
    T value
)

Parameters

Name Type Description
value T

A custom property’s value.

Returns

Type Description
String

A custom property’s value in string format.

Remarks

The following code snippet converts the value of the ShowLegend custom property declared in metadata from its original type to a string and vice versa:

using System;
using System.ComponentModel;
using DevExpress.DashboardCommon;

namespace TutorialsCustomItems {
    public class FunnelItemMetadata : CustomItemMetadata {
        // ...
        [ShowLegendCustom]
        public bool ShowLegend {
            get { return GetCustomPropertyValue<bool>(); }
            set { SetCustomPropertyValue(value); }
        }
        public class ShowLegendCustomAttribute : Attribute, ICustomPropertyValueConverterAttribute<bool>, ICustomPropertyHistoryAttribute<bool>{
            // ...
            public string ConvertToString(bool value){
                return value.ToString();
            }
            public bool ConvertFromString(string strValue){
                bool result;
                Boolean.TryParse(strValue, out result);
                return result;
            }
        }
    }
}
See Also