MainWindow. The button will allow the
userto purchase music in order to add to their collection.
MainWindow.axamlchange the code as follows, adding a Button inside the Panel.
Contentproperty of the
Buy Music, and we also set a property called
Bindingsto talk to the
Binding Expressionis saying, when the button is
BuyMusicCommandon the ViewModel.
MainWindowViewModel.csand add the following code (the
System.Windows.Inputbut you'll need the additional namespaces, specified at the top, later on in the tutorial):
Debug Buttonagain to run the program we can see we have a button and when clicked setting a breakpoint inside the
BuyMusicCommandcode we can see that the code is executed when it's hit.
<Button>element inside a simple
Marginof 40 to the
Panelso that the button is not right at the edge of the Window.
Iconswhen prompted and press
xamlfile will be created that we can put styles or icons inside.
Styleelement as a resource like so.
App.axamland add a
StyleIncludeso that the
Icons.axamlcan be loaded.
MainWindow.axaml, we can add the Icon to the Button like so...