wpf set image source in code behind

Code Example - wpf set image source in code behind

                
                        myImage.Source = new BitmapImage(new Uri(@"/Images/foo.png", UriKind.Relative));