title: Problem setting Icon image source in Context Menu from code behind
body: <p>I have a DataGrid in a UserControl and I have added a ContextMenu to the DataGrid.</p>
  
  <p>The XAML is as follows:</p>
  
  <pre><code>&lt;sdk:DataGrid ItemsSource="{Binding Path=GridSource}"&gt;
      &lt;sdk:DataGrid.Columns&gt;
          &lt;sdk:DataGridTextColumn Binding="{Binding Path=Name, Mode=OneWay}" Header="Name"/&gt;
          &lt;sdk:DataGridTextColumn Binding="{Binding Path=Number, Mode=OneWay}" Header="Number"/&gt;
      &lt;/sdk:DataGrid.Columns&gt;
      &lt;toolkit:ContextMenuService.ContextMenu&gt;
          &lt;toolkit:ContextMenu Opened="ContextMenu_Opened"&gt;
              &lt;toolkit:MenuItem IsEnabled="False"&gt;
                  &lt;toolkit:MenuItem.Icon&gt;
                      &lt;Image x:Name="menuIcon"/&gt; 
                  &lt;/toolkit:MenuItem.Icon&gt;
              &lt;/toolkit:MenuItem&gt;
              &lt;toolkit:Separator /&gt;
              &lt;toolkit:MenuItem Header="View Agent Route" Click="AgentRoute_Click"/&gt;
              &lt;toolkit:MenuItem Header="Live Track" Click="LiveTrack_Click"/&gt;
          &lt;/toolkit:ContextMenu&gt;
      &lt;/toolkit:ContextMenuService.ContextMenu&gt;
  &lt;/sdk:DataGrid&gt;
  </code></pre>
  
  <p>If I set the source of the menuIcon Image in XAML using</p>
  
  <pre><code>&lt;Image x:Name="menuIcon" Source="../../Assets/Images/user_green.png"/&gt;
  </code></pre>
  
  <p>Then the icon is rendered fine but if I try to set it in the ContextMenu_Opened event handler using:</p>
  
  <pre><code>private void ContextMenu_Opened(object sender, RoutedEventArgs e)
  {
    menuIcon.Source = new BitmapImage(new Uri("../../Assets/Images/user_green.png", UriKind.Relative));
  }
  </code></pre>
  
  <p>Nothing shows up, I don't get an error or anything it just doesn't show.  I've used the same method to set an ImageSource (using the same actual *.png files) elsewhere in my application, any ideas what's happening here?</p>
  
  <p>Is this due to it being a ContextMenu?  On a grid?  I can't figure out what's going on.</p>