VincentH-Net / CSharpForMarkup

Concise, declarative C# UI markup for .NET browser / native UI frameworks
MIT License
748 stars 43 forks source link

Create additional help for FontFamily #27

Closed scottcg closed 2 years ago

scottcg commented 2 years ago

FontFamily should allow strings (as XAML does)

.FontFamily(new FontFamily("Segoe UI"))

Could be

.FontFamily("Segoe UI")
VincentH-Net commented 2 years ago

Currently this is supported; all properties that have a TypeConvertor attribute in the UI framework get an extension method that accepts strings and converts them using the UI framework's convertors. There are also additional manual conversions for specific types from other types, e.g. TimeSpan(double seconds) or Size((double width, double height))

The supported conversions - both generated and manual - are implemented in the to namespace, e.g. CSharpMarkup.WinUI.to.FontFamily.

E.g. for WinUI see WinUI.cs and _TypeConvertors.cs