Reputation: 3
I made a small UWP app which is meant to speak "Hello world!" when a button is clicked. But when I ran it I got these errors:
'MainPage does not contain a definition for 'Button_CL' and no accessible extension method 'Button_CL' accepting a first argument of type 'MainPage' could be found (are you <app_name> missing a using directive or an assembly reference?) two times and this error too:
The 'CompileXaml' task returned false but did not log an error.
Here is my code:
MainPage.xaml.cs:
https://ghostbin.com/paste/Lu7MU/hgdfjgdhfgkjldfhkjgfhosiudoasi
MainPage.xaml:
https://ghostbin.com/paste/kETpA/gdnlkgjdflgkjdslfkjsfdsgjdsopjgpdfs
Is there a way to fix this?
Upvotes: 0
Views: 1268
Reputation: 10354
Your declared event in XAML doesn't match the method you implemented in code-behind:
In XAML you have
Click="Button_CL"
while your C# code has the signature
Button_Click(object sender, RoutedEventArgs e)
The names must be the same.
Upvotes: 1