dittodhole / dotnet-Svg.Contrib.Render

Other
26 stars 5 forks source link

Adding strongly typed properties in Svg.Contrib.Render.ViewModel #13

Open dittodhole opened 6 years ago

dittodhole commented 6 years ago

ViewModelGenerator.tt contains following code for SvgTextBase-detection:

      var svgTextBase = svgElement as SvgTextBase;
      if (svgTextBase != null)
      {
#>

    public virtual string <#= safeMemberName #>
    {
      get
      {
        return this.GetText("<#= memberName #>");
      }
      set
      {
        this.SetText("<#= memberName #>", value);
      }
    }
<#
      } // svgTextBase

This detection should also cope with some primitive types (ie DateTime and int, float, ...), to transpose the responsibility of formatting to Svg.Contrib.Render.ViewModel.

Therefore, following XML attributes should be used:

Additionally, view model classes must contain a CultureInfo-property (cf resources culture):

[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
    get {
        return resourceCulture;
    }
    set {
        resourceCulture = value;
    }
}
dittodhole commented 6 years ago

https://msdn.microsoft.com/en-us/library/ms764635 https://msdn.microsoft.com/en-us/library/ms172725 https://msdn.microsoft.com/en-us/library/ms991957