Josh-CO Dev

Solving the worlds problems one line of code at a time.

Silverlight Image Source Binding

Leave a comment


I figured out something that just happened to be a life saver yesterday. I have been working on a more social tool for my workout tracking program. One thing I wanted was a comment system that would show the user’s profile picture. I spend forever trying to think of a way to loop through the list box. What I ended up with was much more simple:

 Here is the XAML:

<StackPanel Orientation=”Horizontal”>

<Image Grid.Row=”1″ Height=”64″ Source=”{Binding ImagePath}” HorizontalAlignment=”Left” Margin=”5,5,0,0″ x:Name=”imgProfileImage” Stretch=”Fill” VerticalAlignment=”Top” Width=”64″ />

</StackPanel>

The backend code simply sets the ImagePath binding to a path that is stored in the database.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s