Update README.md
This commit is contained in:
Родитель
f62d952ee9
Коммит
cd245f27a0
41
README.md
41
README.md
|
@ -14,25 +14,38 @@ https://user-images.githubusercontent.com/2297442/132313187-32f18c4b-e894-46db-9
|
|||
```
|
||||
|
||||
```C#
|
||||
Window Build() => Window().Content(Label().Content("Minimal Avalonia"));
|
||||
|
||||
AppBuilder.Configure<Application>()
|
||||
.UsePlatformDetect()
|
||||
.UseFluentTheme()
|
||||
.StartWithClassicDesktopLifetime(desktop => {
|
||||
desktop.MainWindow = new Window {
|
||||
Content = new Label { Content = "Minimal Avalonia" }
|
||||
};
|
||||
}, args);
|
||||
.UsePlatformDetect()
|
||||
.UseFluentTheme()
|
||||
.StartWithClassicDesktopLifetime(Build, args);
|
||||
```
|
||||
|
||||
```C#
|
||||
var count = 0;
|
||||
|
||||
Window Build()
|
||||
=> Window(out var window)
|
||||
.Title("MinimalAvalonia").Width(400).Height(300)
|
||||
.Content(
|
||||
StackPanel()
|
||||
.Children(
|
||||
Button(out var button)
|
||||
.Content("Welcome to Avalonia, please click me!"),
|
||||
TextBox(out var tb1)
|
||||
.Text("Minimal Avalonia"),
|
||||
TextBox()
|
||||
.Text(window.BindTitle()),
|
||||
Label()
|
||||
.Content(button.ObserveOnClick().Select(_ => ++count).Select(x => $"You clicked {x} times."))))
|
||||
.Title(tb1.ObserveText().Select(x => x?.ToUpper()));
|
||||
|
||||
AppBuilder.Configure<Application>()
|
||||
.UsePlatformDetect()
|
||||
.UseFluentTheme()
|
||||
.StartWithClassicDesktopLifetime(desktop => {
|
||||
var window = new Window { Title = "Minimal Avalonia" };
|
||||
window.Content = new TextBox { [!!TextBlock.TextProperty] = window[!!Window.TitleProperty] };
|
||||
desktop.MainWindow = window;
|
||||
}, args);
|
||||
.UsePlatformDetect()
|
||||
.UseFluentTheme()
|
||||
.WithApplicationName("MinimalAvalonia")
|
||||
.StartWithClassicDesktopLifetime(Build, args);
|
||||
```
|
||||
|
||||
# Generate
|
||||
|
|
Загрузка…
Ссылка в новой задаче