title: How to center an ImageView in Xamarin.Forms 4.0 Shell.TitleView?
body: <p>I am using Xamarin.Forms 4.0 with a shell having a flyout at the left. I am trying to display an Image at the center of Shell.TitleView, however, I have no idea how to achieve this correctly. And the result is like what is suggest in the official page that the Image is not really at the center (but a bit at the right-hand side). This is probably because of the hamburger menu icon at the left, maybe(?)</p>
  
  <p><a href="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/configuration#display-views-in-the-navigation-bar" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/configuration#display-views-in-the-navigation-bar</a></p>
  
  <p>I have tried to calculate the width of the hamburger menu icon after the view has been rendered and compensate at the margin of the Image, but since there is no page loaded event, at this moment I can only hard code a delay in the constructor of the ContentPage. But this is considered to be quite dirty and there will be a problem when there is an icon on the right-hand side.</p>
  
  <pre><code>public SomeContentPage()
  {
      InitializeComponent();
      Device.StartTimer(new System.TimeSpan(0, 0, 0, 0, 500), () =&gt;
              {
                  var titleViewBound = Shell.GetTitleView(this).Bounds;
                  DisplayInfo displayInfo = DeviceDisplay.MainDisplayInfo;
                  double leftButtonWidth = displayInfo.Width / displayInfo.Density - titleViewBound.Width;
                  TitleImage.Margin = new Thickness(0, 0, leftButtonWidth, 0);
                  return false;
              });
  }
  </code></pre>
  
  <p>I expect there will be some better way to center an image in the TitleView no matter there is a hamburger menu icon or other icons at the right-hand side. Thanks in advance!</p>
  
  <p>---Added sample for reference ---</p>
  
  <p>I have white labelled the app and put it on Github for everyone reference. Thanks!
  Sample for reference: <a href="https://github.com/ltin071/XFShellFlyoutSample" rel="nofollow noreferrer">https://github.com/ltin071/XFShellFlyoutSample</a></p>
  
  <p>The TitleImage is not at the center until pressing the adjust button underneath (which do the calculation mentioned above). I hope that I have missed some standard way to achieve that.</p>