views:

21

answers:

2

I want to use the Silverlight DataGrid to show notes. When they select an item in the grid I am going to show the note in a different area of the screen. However, I am hoping to also do something similar to Outlook AutoPreview, where the first few lines of the note are shown beneath each row in the grid.

What is the best way to accomplish this with the Silverlight DataGrid? Or, is there an alternative third party tool that would be better suited?

This is Silverlight 4 if it helps.

A: 

Is it not possible to simply change the contents of the DataGrid row to include not just the 'title' of the note, but also the first few lines of the node, prior to binding?

p.s. this assumes that you want to have all the rows in the DataGrid show the first few lines of the note, and not just the one which is selected (this makes more sense to me, since once it's selected, you already show the entire contents of the node in a separate control)

vlad
Well I don't know if it is possible. I guess that's what I'm asking. Can you provide more details on what you are suggesting?
jkohlhepp
Can you provide an example of how you populate the DataGrid? What do you bind to it?
vlad
A: 

I am answering my own question because I ended up figuring it out. I dropped a DataGrid in Blend, and edited a copy of the RowStyle template. There is a part of the template where you can find this control:

<sdk:DataGridDetailsPresenter x:Name="DetailsPresenter" .../>

All of the contents of the row are rendered inside that control. Initially that control also has Grid Row and Column properties in it. I surrounded that control in a StackPanel and moved the grid properties to that new StackPanel. Then, after that control I created a TextBlock control with TextWrapping="Wrap" and TextTrimming="WordEllipsis". I also gave it the right colors, font, height, margins, etc. to make it look right.

In the end it looks almost exactly like Outlook AutoPreview.

jkohlhepp