Skip to content

Commit

Permalink
added PathIcon (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miticcio committed Jan 8, 2024
1 parent f81fb04 commit f0dfd39
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Avalonia.FuncUI/Avalonia.FuncUI.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
<Compile Include="DSL\Viewbox.fs" />
<Compile Include="DSL\SelectableTextBlock.fs" />
<Compile Include="DSL\DataGrid.fs" />
<Compile Include="DSL\PathIcon.fs" />
<Compile Include="DSL\DragDrop.fs" />
</ItemGroup>

Expand Down
19 changes: 19 additions & 0 deletions src/Avalonia.FuncUI/DSL/PathIcon.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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

0 comments on commit f0dfd39

Please sign in to comment.