-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...ia.FuncUI.ControlCatalog/Avalonia.FuncUI.ControlCatalog/Views/Tabs/HyperlinkButtonDemo.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
namespace Avalonia.FuncUI.ControlCatalog.Views | ||
|
||
open Elmish | ||
open Avalonia.Controls | ||
open Avalonia.FuncUI.DSL | ||
open Avalonia.FuncUI | ||
open Avalonia.FuncUI.Elmish | ||
|
||
module HyperlinkButtonDemo = | ||
|
||
let update _ _ = () | ||
|
||
let view _ _ = | ||
StackPanel.create [ | ||
StackPanel.children [ | ||
TextBlock.create [ | ||
TextBlock.text "Hyperlink samples" | ||
] | ||
|
||
HyperlinkButton.create [ | ||
HyperlinkButton.navigateUri (System.Uri("https://funcui.avaloniaui.net/")) | ||
HyperlinkButton.content "https://funcui.avaloniaui.net/" | ||
] | ||
] | ||
] | ||
|
||
type Host() as this = | ||
inherit Hosts.HostControl() | ||
do | ||
Elmish.Program.mkSimple id update view | ||
|> Program.withHost this | ||
|> Program.withConsoleTrace | ||
|> Program.run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace Avalonia.FuncUI.DSL | ||
|
||
[<AutoOpen>] | ||
module HyperlinkButton = | ||
open Avalonia.Controls | ||
open Avalonia.FuncUI.Types | ||
open Avalonia.FuncUI.Builder | ||
|
||
let create (attrs: IAttr<HyperlinkButton> list): IView<HyperlinkButton> = | ||
ViewBuilder.Create<HyperlinkButton>(attrs) | ||
|
||
type HyperlinkButton with | ||
|
||
/// <summary> | ||
/// Sets a value indicating whether the <see cref="navigateUri"/> has been visited. | ||
/// </summary> | ||
static member isVisited<'t when 't :> HyperlinkButton>(value: bool) : IAttr<'t> = | ||
AttrBuilder<'t>.CreateProperty<bool>(HyperlinkButton.IsVisitedProperty, value, ValueNone) | ||
|
||
/// <summary> | ||
/// Gets or sets the Uniform Resource Identifier (URI) automatically navigated to when the | ||
/// <see cref="HyperlinkButton"/> is clicked. | ||
/// </summary> | ||
static member navigateUri<'t when 't :> HyperlinkButton>(value: System.Uri) : IAttr<'t> = | ||
AttrBuilder<'t>.CreateProperty<System.Uri>(HyperlinkButton.NavigateUriProperty, value, ValueNone) |