Sign in to follow this  
athono

[.net] How do I add an image to a dataset?

Recommended Posts

athono    132
How do I add an image to a dataset?

This is a C#/Silverlight question although I am trying to emulate what I see in Excel.

In the screen snapsot below, there is an excel file that has little arrow indicators inside the cells of one column. First of all, I do not know how even this can be done. For starters, that would be a good thing to learn. But I need to emulate this in a C# / Silverlight app. How would I put little graphics like this into a dataset/datagrid?


[img]http://i67.photobucket.com/albums/h292/Athono/Data_Arrows.jpg[/img]

Share this post


Link to post
Share on other sites
a_loho    106
In WPF/Silverlight you usually define a template to customize a control visual.For exemple a simple template to show an image and some text.


[code]
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="../Images/MyImage.png"/>
<TextBlock Grid.Column="1" Text="{Binding MyValue}"/>
</Grid>
</DataTemplate>
[/code]
Then you could use that template as a CellTemplate in your DataGrid.


Some materials you may want to read on this topics :

[url="http://msdn.microsoft.com/en-us/library/cc278068(v=VS.95).aspx"](MSDN) Control Customization[/url]

[url="http://www.wpftutorial.net/Home.html"]WPF Tutorial[/url]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this