-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- to .Net 5.0 - to Avalonia 0.10 RC 1 (includes required fixes) - add standalone menu to sample
- Loading branch information
Showing
19 changed files
with
95 additions
and
52 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
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
54 changes: 54 additions & 0 deletions
54
src/Avalonia.FuncUI.ControlCatalog/Views/Tabs/WindowMenuDemo.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,54 @@ | ||
namespace Avalonia.FuncUI.ControlCatalog.Views | ||
|
||
open Avalonia.Controls | ||
open Avalonia.FuncUI.DSL | ||
open Avalonia.FuncUI.Components | ||
open Avalonia.FuncUI.Elmish | ||
open Elmish | ||
|
||
module WindowMenuDemo = | ||
type State = { color: string } | ||
|
||
let init = { color = "gray" } | ||
|
||
type Msg = | ||
| SetColor of string | ||
|
||
let update (msg: Msg) (state: State) : State = | ||
match msg with | ||
| SetColor color -> { state with color = color } | ||
|
||
let view (state: State) (dispatch) = | ||
StackPanel.create [ | ||
StackPanel.background state.color | ||
|
||
StackPanel.children [ | ||
Menu.create [ | ||
Menu.viewItems [ | ||
MenuItem.create [ | ||
MenuItem.header "Red" | ||
MenuItem.viewItems [ | ||
MenuItem.create [ | ||
MenuItem.header "Light" | ||
MenuItem.onClick (fun _ -> "#e74c3c" |> SetColor |> dispatch) | ||
] | ||
MenuItem.create [ | ||
MenuItem.header "Dark" | ||
MenuItem.onClick (fun _ -> "#c0392b" |> SetColor |> dispatch) | ||
] | ||
] | ||
] | ||
] | ||
] | ||
] | ||
] | ||
|
||
|
||
type Host() as this = | ||
inherit Hosts.HostControl() | ||
do | ||
Elmish.Program.mkSimple (fun () -> init) 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
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
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
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
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
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
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
Oops, something went wrong.