I am creating stackpanel inside the gridview cell dynamically and placing a image control inside stackpanel but on the window only blank space coming, not the image
here is what i am doing
StackPanel Stkpnl = new StackPanel();
Image BgImg = new Image();
BitmapImage Img = new BitmapImage(new Uri(
"Images/cellbg.png", UriKind.Relative));
BgImg.Source = Img ;
Stkpnl.Children.Add(BgImg );
You need to use a Pack URI. See https://stackoverflow.com/a/1651397/486660
If you have a question as to what your Pack URI should look like, then temporarily add an Image
control to your WPF page then goto the Source
property and click the "..." button and navigate to your image. The property's text box will have the Pack URI in it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With