Button
to the MainWindow
. The button will allow the user
to purchase music in order to add to their collection.MainWindow.axaml
change the code as follows, adding a Button inside the Panel.Content
property of the Button
to Buy Music
, and we also set a property called Command
to {Binding BuyMusicCommand}
.Views
use Bindings
to talk to the ViewModel
.Binding Expression
is saying, when the button is clicked
, then execute
the command
called BuyMusicCommand
on the ViewModel.MainWindowViewModel.cs
and add the following code:Debug Button
again to run the program we can see we have a button and when clicked setting a breakpoint inside the BuyMusicCommand
code we can see that the code is executed when it's hit.<Button>
element inside a simple <Panel>
element.HorizontalAlignment
and VerticalAlignment
properties.Margin
of 40 to the Panel
so that the button is not right at the edge of the Window.store_microsoft_regular
.Add
β Avalonia Styles
Icons
when prompted and press Enter
.xaml
file will be created that we can put styles or icons inside.Style
element as a resource like so.App.axaml
and add a StyleInclude
so that the Icons.axaml
can be loaded.MainWindow.axaml
, we can add the Icon to the Button like so...