question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clicked event don't fire inside of Shell.TitleView in IOS

See original GitHub issue

This issue has been moved from a ticket on Developer Community.


[severity:I’m unable to use this version] When i add a button inside of Shell.TitleView the Clicked Event will don’t fire. Steps to reproduce:

Create a MAUI App in Visual Studio 2022 17.3.6 with Net 6.0

Modify code like this: Mainpage.xaml:

<?xml version=“1.0” encoding=“utf-8” ?>
<ContentPage xmlns=“http://schemas.microsoft.com/dotnet/2021/maui”
xmlns:x=“http://schemas.microsoft.com/winfx/2009/xaml”
x:Class=“MauiApp8.MainPage”>

<Shell.TitleView>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=“*”/>
<ColumnDefinition Width=“Auto”/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height=“{OnPlatform Android=Auto, UWP=Auto, iOS=40, MacCatalyst=Auto}”></RowDefinition>
</Grid.RowDefinitions>
<Label Text=“MAUI” FontAttributes=“Bold” Grid.Column=“0” VerticalOptions=“Center” Margin=“{OnPlatform Android=0, UWP=20, iOS=0, MacCatalyst=0}”></Label>
<StackLayout Grid.Column=“1” HorizontalOptions=“EndAndExpand” Orientation=“Horizontal” VerticalOptions=“Center” Margin=“0,0,5,0”>
<Button
Text=“Click me”
SemanticProperties.Hint=“Counts the number of times you click”
Clicked=“CounterBtn_Clicked”
HorizontalOptions=“Center” />
</StackLayout>
</Grid>
</Shell.TitleView>

<ScrollView>
<VerticalStackLayout
Spacing=“25”
Padding=“30,0”
VerticalOptions=“Center”>

     <Image
         Source="dotnet_bot.png"
         SemanticProperties.Description="Cute dot net bot waving hi to you!"
         HeightRequest="200"
         HorizontalOptions="Center" />

     <Label
         Text="Hello, World!"
         SemanticProperties.HeadingLevel="Level1"
         FontSize="32"
         HorizontalOptions="Center" />

     <Label
         Text="Welcome to .NET Multi-platform App UI"
         SemanticProperties.HeadingLevel="Level2"
         SemanticProperties.Description="Welcome to dot net Multi platform App U I"
         FontSize="18"
         HorizontalOptions="Center" />

     <Button
         x:Name="CounterBtn"
         Text="Click me"
         SemanticProperties.Hint="Counts the number of times you click"
         Clicked="OnCounterClicked"
         HorizontalOptions="Center" />

 </VerticalStackLayout>
</ScrollView>

</ContentPage>

Mainpage.xaml.cs:

namespace MauiApp8;

public partial class MainPage : ContentPage
{
int count = 0;

public MainPage()
{
	InitializeComponent();
}

private void OnCounterClicked(object sender, EventArgs e)
{
	count++;

	if (count == 1)
		CounterBtn.Text = $"Clicked {count} time";
	else
		CounterBtn.Text = $"Clicked {count} times";

	SemanticScreenReader.Announce(CounterBtn.Text);
}


private void CounterBtn_Clicked(object sender, EventArgs e)
{
    count++;

    if (count == 1)
        CounterBtn.Text = $"Clicked {count} time";
    else
        CounterBtn.Text = $"Clicked {count} times";

    SemanticScreenReader.Announce(CounterBtn.Text);
}

Original Comments

Feedback Bot on 10/13/2022, 06:55 PM:

(private comment, text removed)


Original Solutions

(no solutions)

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:9

github_iconTop GitHub Comments

5reactions
bmclanecommented, Nov 30, 2022

A Temporary Solution add negative margin to bottom: Margin=“0,0,0,-50”

<Grid Margin="0,0,0,-50"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="{OnPlatform Android=Auto, UWP=Auto, iOS=40, MacCatalyst=Auto}"/> </Grid.RowDefinitions> <Label Text="MAUI" FontAttributes="Bold" Grid.Column="0" VerticalOptions="Center" Margin="{OnPlatform Android=0, UWP=20, iOS=0, MacCatalyst=0}"/> <StackLayout Grid.Column="1" HorizontalOptions="EndAndExpand" Orientation="Horizontal" VerticalOptions="Center" Margin="0,0,5,0"> <Button Text="Click me" SemanticProperties.Hint="Counts the number of times you click" Clicked="OnCounterClicked" HorizontalOptions="Center" /> </StackLayout> </Grid>

2reactions
andrea-gaviolicommented, Apr 20, 2023

Buttons on iOS are also not working on Grid and Stack layout using the Navigation page.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clicked event don't fire inside of Shell.TitleView in IOS
Clicked event don't fire inside of Shell.TitleView in IOS #5494. Sign in to view logs · Sign in to view logs. Summary. Clicked...
Read more >
Titleview not visible on IOS - Maui
I'm using Maui to create a cross-platform app. To navigate through the app the appshell is used. On Android everything is working fine,...
Read more >
Maui: Why the content inside the Shell.TitleView ...
Here is a workaround. The problem with the disappearing of the TitleView does not happen, when you reorganise the menu navigation.
Read more >
Button in Shell.TitleView is not clickable
The command exists and I'm importing / calling it just like any other of my buttons. Clicking does nothing. I've set a breakpoint...
Read more >
Xamarin.Forms 5.0.0.2125 (5.0.0 Service Release 5) ...
Release notes detailing new features, improvements, and issues fixed in Xamarin.Forms 5.0.0.2125 (5.0.0 Service Release 5)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found