user1919915
user1919915

Reputation: 13

Get image uri from Source

How do I get the image url? My xaml is:

<toolkit:HubTile Name="Demo" Title="Demo" Source="demo\0.png"  Margin="15" Tap="Demo_Tap"/>

and in c# I try to get the url from the sender (because I have a lot of entry's in the same tap) my c# so far

((Microsoft.Phone.Controls.HubTile)(sender)).Source 

and I get errors

what I need rests inside

System.Windows.Media.Imaging.BitmapImage m_string;

but how do I access that?

Upvotes: 2

Views: 5044

Answers (2)

sa_ddam213
sa_ddam213

Reputation: 43636

If Source is a BitmapImage you can just cast the sender source as BitmapImage

(((Microsoft.Phone.Controls.HubTile)(sender)).Source as BitmapImage).UriSource.OriginalString

Upvotes: 4

Josh
Josh

Reputation: 10624

Source

Source is a dependency property of type ImageSource. It gets or sets the image source of the HubTile control.

Are you casting to an ImageSource when getting the value? Also, it would help if you displayed the error message.

Update

Per your update, casting to a BitmapImage and getting the UriSource would probably get you what you want:

(BitmapImage).UriSource

Upvotes: 0

Related Questions