0
votes

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.

2
What is wrong with a standard Grid and a GridSplitter?Aaron McIver
I can't envision how you can get the AutoPreview effect with that. If you can explain further maybe I'll get it. I'm referring to having each row in the grid have a section underneath it with the first few lines of the email showing in blue. I'm not referring to the view pane that shows the full email when it is selected.RationalGeek

2 Answers

0
votes

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)

0
votes

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.