How does one translate the Microsoft ButtonBase.Click Event information for C++/WinRT into a prototype declaration and definition?
In Visual Studio Community 2017, version 15.9.5, I created a standard project, viz., Blank App (C++/WinRT), which has a button (myButton) as part of it. I want to learn how to add a second button. I have added the XAML code for a second button (myButton2), but thereafter I am stuck.
<Page
x:Class="X003.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:X003"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackPanel x:Name="stackPan" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Background="LightBlue">
<Button x:Name="myButton" Click="ClickHandler">Click Me</Button>
<Button x:Name="myButton2" Click="ClickHandler2">Click Me2</Button>
</StackPanel>
</Page>
I could just copy the code from the first button that the Blank App (C++/WinRT) provided. But, if I did not have the first button as an example, I would not know how I would translate the Microsoft documentation, viz.,
// Register
event_token Click(RoutedEventHandler const& handler) const;
// Revoke with event_token
void Click(event_token const& cookie) const;
// Revoke with event_revoker
Click_revoker Click(auto_revoke_t, RoutedEventHandler const& handler) const;
into a Click handler. The first line of the Microsoft documentation, viz.,
event_token Click(RoutedEventHandler const& handler) const;
is, I take it, the format to be used in creating the handler. It does not look like the handler already in the project, viz.,
void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
I thought that it could be added to the .idl file. But, the .idl file does not have the first button in it.
The example code with Microsoft provides is for C#, even when "C++/WinRT" is selected at the top-right of the page.
The new version of C++/WinRT has a lot of documentation, almost too much. Coming from having used C#/WPF/XAML, I cannot see my way clearly to doing similar work with C++/WinRT.
Finally, the project Properties tab is of no help. In C# the events were listed and choosing one would result in a declaration and basic definition being created in the code. For C++/WinRT, when the cursor is on the control in the XAML page, the events section of the Properties page shows the name of the control, myButton or myButton2, and indicates "The document item has no code-behind file. Add a code-behind file and a class definition before adding event handlers." But, there is no code-behind file for the existing button, myButton.