title: Change ImageButton source based on Theme in xaml
body: <p>I want to change the Source of an ImageButton in xaml based on the Theme (i.e. Light vs Dark).  I get a System.NullReferenceException 'Object reference not set to an instance of an object.' when I use the following:</p>
  <pre><code>&lt;ImageButton
          Grid.Row=&quot;1&quot;
          Margin=&quot;10&quot;
          Command=&quot;{Binding CreateCommand}&quot;
          Source=&quot;{AppThemeBinding Light=add_box_black_48dp.svg, Dark=add_box_light_48dp.svg}&quot;
          HorizontalOptions=&quot;End&quot;
          VerticalOptions=&quot;End&quot;/&gt;
  </code></pre>
  <p>If I change the Source to the following everything works</p>
  <pre><code>Source=&quot;add_box_white_48dp&quot;
  </code></pre>
  <p><strong>Can I use AppThemeBinding to change the ImageButton Source in this way</strong>?</p>
  <p><em>&lt;Edited on 6/4/2022 to show xaml for cases that work and those that do not work.  Also changed the names of the svg files to reflect light and dark cases&gt;</em></p>
  <p>I am using Visual Studio Community 2022 (64-bit) - Preview
  Version 17.3.0 Preview 1.1</p>
  <p>This ImageButton xaml throws the exception:</p>
  <pre><code>&lt;ImageButton
      Margin=&quot;10&quot;
      Command=&quot;{Binding CreateNewAccountCommand}&quot;
      Source=&quot;{AppThemeBinding Light=add_light.svg, Dark=add_dark.svg}&quot;
      HorizontalOptions=&quot;End&quot;
      VerticalOptions=&quot;End&quot;
      BackgroundColor=&quot;#376489&quot;
      CornerRadius=&quot;8&quot;
      WidthRequest=&quot;36&quot;
      HeightRequest=&quot;36&quot;&gt;
  &lt;/ImageButton&gt;
  </code></pre>
  <p>This ImageButton xaml works and does not throw an exception</p>
  <pre><code>&lt;ImageButton
      Margin=&quot;10&quot;
      Command=&quot;{Binding CreateNewAccountCommand}&quot;
      Source=&quot;add_light.svg&quot;
      HorizontalOptions=&quot;End&quot;
      VerticalOptions=&quot;End&quot;
      BackgroundColor=&quot;#abdbe3&quot;
      CornerRadius=&quot;8&quot;
      WidthRequest=&quot;36&quot;
      HeightRequest=&quot;36&quot;&gt;
  &lt;/ImageButton&gt;
  </code></pre>
  <p>This also works and does not throw an exception</p>
  <pre><code>&lt;ImageButton
      Margin=&quot;10&quot;
      Command=&quot;{Binding CreateNewAccountCommand}&quot;
      Source=&quot;add_dark.svg&quot;
      HorizontalOptions=&quot;End&quot;
      VerticalOptions=&quot;End&quot;
      BackgroundColor=&quot;#376489&quot;
      CornerRadius=&quot;8&quot;
      WidthRequest=&quot;36&quot;
      HeightRequest=&quot;36&quot;&gt;
  &lt;/ImageButton&gt;
  </code></pre>
  <hr />