C
C#4mo ago
katonaut

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
canton7
canton74mo ago
Can you tell us what is wrong with your code snippet?
katonaut
katonaut4mo ago
get null at first line ... but I have already changed the code now Im trying other way