ICustomPropertyValueConverterAttribute<T>.ConvertFromString(String) Method
Converts a custom property value declared in metadata from a string to its original type.
Namespace: DevExpress.DashboardCommon
Assembly: DevExpress.Dashboard.v24.2.Core.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
value | String | A custom property’s value in string format. |
Returns
Type | Description |
---|---|
T | A custom property’s value. |
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