Update add-and-layout-controls.md

Margin should be added to Button not to Panel
This commit is contained in:
Deniz 2023-05-08 00:12:04 +02:00 коммит произвёл GitHub
Родитель 3521ef5477
Коммит 75bfa337bb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -66,12 +66,12 @@ Place the `<Button>` element inside a simple `<Panel>` element.
The simplest way to control the layout of a control is with the `HorizontalAlignment`and `VerticalAlignment` properties.
```markup
<Panel Margin="40">
<Button Content="Buy Music" Command="{Binding BuyMusicCommand}" HorizontalAlignment="Right" VerticalAlignment="Top" />
<Panel>
<Button Content="Buy Music" Margin="40" Command="{Binding BuyMusicCommand}" HorizontalAlignment="Right" VerticalAlignment="Top" />
</Panel>
```
We also add a `Margin` of 40 to the `Panel` so that the button is not right at the edge of the Window.
We also add a `Margin` of 40 to the `Button` so that the button is not right at the edge of the Window.
You may prefer to have an icon or image instead of text inside your button. The are a few ways to do this, let's grab a store icon from [Avalonia - Fluent Icons](https://avaloniaui.github.io/icons.html)