Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
In XAML, I learned to specify image source with below code:
<Image Source="/WaivePadBankAnim;component/Images/Consumer/search_button_full.png" />
How would I do it in C# .cs?
Try this
Image image = new Image(); image.UriSource = new Uri("/WaivePadBankAnim;component/Images/Consumer/search_button_full.png")
Adding WPF Controls Progrrammatically
Add a comment
M working on Windows phone 8 and i used this.
OrderImage1.Source = new BitmapImage(new Uri("///Assets/images/order_bread.png"));
Image img = new Image(); img.Source = new Uri("<your path here>");
I hope this helps.
please check this
just use a class "ImageSourceConverter"
img1.Source = (ImageSource)new ImageSourceConverter().ConvertFromString("/Assets/check.png");
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.