MAUI - Click event not found refered in AppShell.xaml.cs

Hi everyone I'm making a project with guidelines for University. problem being that the guide is a bit outdated and i cant reach the teacher at the moment due to holidays. I have a menu item in my AppShell Xaml with a Clicked event, but the event is not found in the cs file. (see screenshot if possible) Here is the code :
<?xml version="1.0" encoding="UTF-8"?>

<Shell
x:Class="KWops.Mobile.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Kwops.Mobile"
xmlns:views="clr-namespace:Kwops.Mobile.Views"
Shell.FlyoutBehavior="Flyout">

<FlyoutItem Title="Home" Icon="icon_home.svg">
<ShellContent ContentTemplate="{DataTemplate views:MainPage}"
Route="MainPage" />
</FlyoutItem>

<FlyoutItem Title="Teams" Icon="icon_teams.svg">
<ShellContent ContentTemplate="{DataTemplate views:TeamsPage}"
Route="TeamsPage" />
</FlyoutItem>

<MenuItem Text="Logout" IconImageSource="icon_logout.svg" Clicked="OnMenuItemClicked">
</MenuItem>

<!--
TabBar lets you define content that won't show up in a flyout menu. When this content is active
the flyout menu won't be available. This is useful for creating areas of the application where
you don't want users to be able to navigate away from. If you would like to navigate to this
content you can do so by calling
await Shell.Current.GoToAsync("//LoginPage");
-->
<TabBar>
<ShellContent Route="LoginPage" ContentTemplate="{DataTemplate views:LoginPage}" />
</TabBar>

</Shell>
<?xml version="1.0" encoding="UTF-8"?>

<Shell
x:Class="KWops.Mobile.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Kwops.Mobile"
xmlns:views="clr-namespace:Kwops.Mobile.Views"
Shell.FlyoutBehavior="Flyout">

<FlyoutItem Title="Home" Icon="icon_home.svg">
<ShellContent ContentTemplate="{DataTemplate views:MainPage}"
Route="MainPage" />
</FlyoutItem>

<FlyoutItem Title="Teams" Icon="icon_teams.svg">
<ShellContent ContentTemplate="{DataTemplate views:TeamsPage}"
Route="TeamsPage" />
</FlyoutItem>

<MenuItem Text="Logout" IconImageSource="icon_logout.svg" Clicked="OnMenuItemClicked">
</MenuItem>

<!--
TabBar lets you define content that won't show up in a flyout menu. When this content is active
the flyout menu won't be available. This is useful for creating areas of the application where
you don't want users to be able to navigate away from. If you would like to navigate to this
content you can do so by calling
await Shell.Current.GoToAsync("//LoginPage");
-->
<TabBar>
<ShellContent Route="LoginPage" ContentTemplate="{DataTemplate views:LoginPage}" />
</TabBar>

</Shell>
namespace Kwops.Mobile;

public partial class AppShell : Shell
{
public AppShell()
{
}

private async void OnMenuItemClicked(object sender, EventArgs e)
{
await Current.GoToAsync("//LoginPage");
}
}
namespace Kwops.Mobile;

public partial class AppShell : Shell
{
public AppShell()
{
}

private async void OnMenuItemClicked(object sender, EventArgs e)
{
await Current.GoToAsync("//LoginPage");
}
}
Error :
EventHandler "OnMenuItemClicked" with correct signature not found in type "KWops.Mobile.AppShell".
please ping me if you have an answer or an idea or more questions
No description
1 Reply
Absolem Jackdaw
Absolem JackdawOP4mo ago
solved 👍
Want results from more Discord servers?
Add your server