Home > Software engineering >  How to ExportRenderer Multiple TabbedPage in Xamarin
How to ExportRenderer Multiple TabbedPage in Xamarin

Time:02-25

I'm wondering about the Custom TabbedPageRenderer issue. I have created a file MyTabbedPageRenderer.cs in Xamarin iOS. Everything I set up in this is fine. Until I used enter image description here

  1. Everything works fine if I don't use: [assembly: ExportRenderer(typeof(TabbedPage), typeof(BadgedTabbedPageRenderer))]

enter image description here

  1. ---> And this is what I want:

enter image description here

Ask for help from everyone. Thanks

CodePudding user response:

I have tested it on my side.The badge effect works well,below is the step that might give you some insights.

As you mentioned, it could be achieved by creating a custom renderer for TabbedPage:

Step1: Move what is in BadgedTabbedPageRenderer.cs here into MyTabbedPageRenderer.cs

Step2: Add [assembly: ExportRenderer(typeof(TabbedPage), typeof(MyTabbedPageRenderer))] in AssemblyInfo.cs and MyTabbedPageRenderer.cs.

Step3: Add two lines in the page you want to achieve the badge effect in the child page.

plugin:TabBadge.BadgeColor="Red" 
plugin:TabBadge.BadgeText="1"
  • Related