WPF how do I get Uri from a image in a button
HI, how I can get the uri of an image Source in a button in wpf in code behind
Get null at first line
Image image = aud1.Content as Image;
BitmapImage bitmapImage = image.Source as BitmapImage;
if (bitmapImage != null)
{
Uri imageUri = bitmapImage.UriSource;
string uriString = imageUri.ToString();
// Now you have the URI string of the image source
}
2 Replies