title: Xamarin Custom Renderer for Button (iOS)
body: <p>I've declared a custom renderer for iOS (and Android - working fine).</p>
  
  <p>The custom renderer is primarily setting the background color and text color.</p>
  
  <p>Setting the text color works fine for the enabled and disabled states, but I'm having trouble setting the background color for the button in different states.</p>
  
  <p>I've not been able to find any documentation for Xamarin custom renderers covering this, and it is a known bug with Xamarin that I cannot get any intellisense working for iOS classes in Visual Studio, so far I've used what resources I <em>can</em> find on the topic.</p>
  
  <pre><code>    public class MyButtonRenderer : ButtonRenderer
      {
          protected override void OnElementChanged(ElementChangedEventArgs&lt;Button&gt; e)
          {
              base.OnElementChanged(e);
  
              if (Control != null)
              {
                  Control.BackgroundColor= UIColor.FromRGB(235, 115, 17);
  
                  Control.SetTitleColor(UIColor.FromRGB(255, 255, 255),UIControlState.Normal);
                  Control.SetTitleColor(UIColor.FromRGB(0, 0, 0),UIControlState.Disabled);
              }
          }
      } 
  </code></pre>
  
  <p>I'd like to be able to change the background color to something other than what I've set - if the buttons <code>UIControlState</code> is <code>Disabled</code>.</p>
  
  <p>In this image, the buttons are using the custom renderer. The top button is disabled, and the bottom is enabled. As you might guess, I'd like to make the disabled button grey. </p>
  
  <p><a href="https://i.stack.imgur.com/wrF44.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wrF44.png" alt="The top button is disabled, bottom enabled."></a></p>
  
  <p>I'm confident this must be quite straightforward, but the lack of documentation and no-intellisense issue are hindering my efforts.  </p>