Bug 22621 - Setting the ToolbarItem Icon property causes the native UIBarButtonItem Title property to be null
Summary: Setting the ToolbarItem Icon property causes the native UIBarButtonItem Title...
Status: RESOLVED FEATURE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Mac OS
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-03 17:43 UTC by John Miller [MSFT]
Modified: 2016-05-28 00:37 UTC (History)
6 users (show)

Tags: ac ios customrenderer
Is this bug a regression?: ---
Last known good build:


Attachments
Test Case (5.01 MB, application/zip)
2014-09-03 17:43 UTC, John Miller [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description John Miller [MSFT] 2014-09-03 17:43:41 UTC
Created attachment 7908 [details]
Test Case

**Overview:**

   When setting the Icon property of a ToolBarItem in XAML, the native UIBarButtonItem.Title property is null on iOS. 

**Steps to Reproduce:**

   1. Run the attached project in Visual Studio. 
   2. Deploy to an iOS 7.1 iPad Simulator. 
   3. Press the Navigate to Second View button.

**Actual Results:**

   The app crashes in CustomPageRenderer.cs Line 37 because "info" is null. info is null because the Title property was null for the ToolbarItem that has the Icon property set in SecondView.Xaml. 

**Expected Results:**

   No crash. 

**Build Date & Platform:**

   XF 1.2.3-pre1
Comment 1 Rajneesh Kumar 2014-09-05 01:48:46 UTC
I have checked this issue and able to reproduce it. I have followed the steps to reproduce it:

1. Open given sample in Visual Studio
2. Set break point in line 37 in "CustomPageRenderer.cs" file
3. Build an deploy the application on iOS 7.1 iPad Simulator. 
4. Application will launch successfully
5. Click on Navigate to Second View button.
6. Break point will hit, and application crash 
7. Observe the value of "info" that is null

Screencast: http://www.screencast.com/t/yiW3rBub

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Xamarin   3.5.55.0 (2db5ccd228887372e207e112bc3b5f1b16b24293)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android
Comment 2 Seth Rosetter 2015-06-01 17:54:03 UTC
UIBarButtonItem expects an image or a title in its constructor. Currently, we do not set the title on the button as it serves no functional purpose if you provide an image. However, we will consider changing this and it will be marked as an enhancement.
Comment 3 Samantha Houts [MSFT] 2016-05-28 00:37:55 UTC
Thank you for taking the time to submit this feature request. We like this idea and have added it to our internal feature tracking system.

Warm regards,
Xamarin Forms Team