Image in silverlight datagrid

I'm a Siliverlight newbie.

I want to create a datagrid with a different photo for each row.  These photos will reside in the c:\Photos\xxx\ directory on the web server, where xxx represents a unique ID for each data row.

This xaml works, where I've just used a test file for the photo:

                            <Image x:Name ="TestImage" Source ="100_0117.JPG" Height ="50"/>

But what is the syntax to make that image path vary for each row?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ReeseWattAuthor Commented:
I solved this myself. It required a converter. Add a converter as a static resource and then use that converter to bring in the data. In this case, I named my photo files ItemID.jpg, so that I could bring in the appropriate by just knowing the ItemID of the current row.  Here's the applicable XAML and C# code

<HMSRemnants_svcSayHello:RemnantsTest x:Key="RemnantsTestDS" d:IsDataSource="True"/>
<local:SlabID2ImageConverter x:Key="SlabID2ImageConverter"/>

<StackPanel x:Name="OurStack" Orientation="Vertical">
<TextBox x:Name="InputText"/>
<TextBlock x:Name="OutputText"/>
<Button x:Name="CallServiceButton" Content="Call WCF" Click="CallServiceButton_Click"/>
<data:DataGrid x:Name="theDataGrid" AlternatingRowBackground="Beige" Grid.Row="2" Grid.Column="1" Height=" 600" Width="800" CanUserResizeColumns="True" AutoGenerateColumns="False">
<data:DataGridTextColumn Header="InventTypeID" Width="100" Binding="{Binding InventTypeID}" />
<data:DataGridTemplateColumn Header="ImageColumn" DisplayIndex="1" > 
<Image Source="{Binding ItemID, Converter={StaticResource SlabID2ImageConverter}}" Height="50" />
<?xml:namespace prefix = local />

public class SlabID2ImageConverter : IValueConverter
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Uri uri = new Uri("/Photos/" + value.ToString()+ ".jpg", UriKind.Relative);
return new BitmapImage(uri);
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
throw new NotImplementedException();


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.