Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Finding the toolbar of a modal NavigationPage in Xamarin.forms >> Android

$
0
0

I've asked this a couple of weeks ago on stack overflow, but with no success, so I try here.

My intention is to get a handle to the toolbar in Android native (on a xamarin forms Project). This, in order to be able to do some custom painting (a badge) on an Icon.

So... I have an Android native method doing this
var toolbar = CrossCurrentActivity.Current.Activity.FindViewById(Resource.Id.toolbar) as Android.Support.V7.Widget.Toolbar;
It works fine, as long as it's the toolbar of my main page I'm after. It also works fine if I, from my main page do something like
Navigation.PushAsync(new MySecondPage());
Then it will find the correct toolbar for the second page.
My problem comes when I push a Modal page, with a toolbar, like this
Navigation.PushModalAsync(new NavigationPage(new MySecondPage()));
Now, if the native Android code is called, the toolbar returned is STILL the one from my main page. (Not the one currently showing on screen).
So, my question: Is there a way to find the toolbar of a modal pushed navigationpage?


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>