Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PathIcon Control #382

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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