fsprojects / Avalonia.FuncUI

Develop cross-plattform GUI Applications using F# and Avalonia!
https://funcui.avaloniaui.net/
MIT License
889 stars 72 forks source link

Add PathIcon Control #381

Closed Miticcio closed 5 months ago

Miticcio commented 6 months ago

I noticed that the PathIcon control is missing in the DSL. Is this intentional or can it be added?

I tried including it in a local build and it works fine, it is similar to Shapes.Path

PathIcon.fs:

namespace Avalonia.FuncUI.DSL

[<AutoOpen>]
module PathIcon =
    open Avalonia.Media
    open Avalonia.FuncUI.Builder
    open Avalonia.FuncUI.Types
    open Avalonia.Controls

    let create (attrs: IAttr<PathIcon> list): IView<PathIcon> =
        ViewBuilder.Create<PathIcon>(attrs)

    type PathIcon with

        static member data<'t when 't :> PathIcon>(geometry: Geometry) : IAttr<'t> =
            AttrBuilder<'t>.CreateProperty<Geometry>(PathIcon.DataProperty, geometry, ValueNone)

        static member data<'t when 't :> PathIcon>(data: string) : IAttr<'t> =
            data |> Geometry.Parse |> PathIcon.data
JaggerJo commented 6 months ago

Happy to merge this if you create a PR