AxesArrayConverter.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. //
  5. // Purpose: Converter for the Axes array.
  6. //
  7. using System;
  8. using System.Collections;
  9. using System.ComponentModel;
  10. using System.Globalization;
  11. namespace FastReport.DataVisualization.Charting
  12. {
  13. /// <summary>
  14. /// Converter object of axes array
  15. /// </summary>
  16. internal class AxesArrayConverter : TypeConverter
  17. {
  18. #region Converter methods
  19. /// <summary>
  20. /// Subproperties NOT suported.
  21. /// </summary>
  22. /// <param name="context">Descriptor context.</param>
  23. /// <returns>Always false.</returns>
  24. public override bool GetPropertiesSupported(ITypeDescriptorContext context)
  25. {
  26. return false;
  27. }
  28. /// <summary>
  29. /// Overrides the ConvertTo method of TypeConverter.
  30. /// </summary>
  31. /// <param name="context">Descriptor context.</param>
  32. /// <param name="culture">Culture information.</param>
  33. /// <param name="value">Value.</param>
  34. /// <param name="destinationType">Destination type.</param>
  35. /// <returns>Converted object.</returns>
  36. public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
  37. {
  38. // Convert collection to string
  39. if (destinationType == typeof(string))
  40. {
  41. return (new CollectionConverter()).ConvertToString(new ArrayList());
  42. }
  43. return base.ConvertTo(context, culture, value, destinationType);
  44. }
  45. #endregion
  46. }
  47. }