开发者

add row note to a particular cell in datagridview

I want to add a comment to a particul开发者_运维百科ar cell of datagridview as the image below. Can it be done?

add row note to a particular cell in datagridview


You can add a RowDetailsTemplate with a TextBlock in it and databind its Text property.

<sdk:DataGrid ItemsSource={Binding Items}>
  <!-- Put your columns here -->
  <sdk:DataGrid.RowDetailsTemplate>
     <DataTemplate>
        <TextBlock Text="{Binding Note}" />
     </DataTemplate>
  </sdk:DataGrid.RowDetailsTemplate>
</sdk:DataGrid>

Hope this helps.


I dount that is possible to add text over multiple cells in a row (in dgv control). Especilly if you want to keep the current text in cells, and add an extra text over these cells (like this comment). So my answer s no, its not possible. But on the other hand, everything is possisble. You could create a new Label control, and position it on the right place, and add text into it. This means that the label would be actualy placed over the dgv control. This is one of thr idea.

I think if you wanna do something like you want to, you would have to do something extra (something unusual).


After quite some time I discovered the exact solution to prove that Matt is right. Following is a beautiful link to do the same.

http://msdn.microsoft.com/en-us/library/85kxk29c.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜