Drag and Drop Column Headers for a custom grid

hi all,

I am working on WPF. i have few questions. Can any one please answer

1) how to implement drag and drop the column headers for my own custom data grid!!

2) How to select multiple rows and columns in my data grid?

thanks in advance

[277 byte] By [Nani] at [2008-3-5]
# 1

Your questions are way too general to get much of an answer. Each item described (drag and drop of headers, and management of row/column selection is a fairly major topic that would warrant one or more blog entries by someone that has already done this. Also, any such description is either going to have to assume a lot about the design of the grid control, or be pretty simple minded in nature.

There is nothing in the system that is goning to manage a selection for you. That is an application level thing. You need to keep track of what rows/columns are selected somewhere in your application data and change the display of those rows/columns in some way. For a general control those would all be decisions you would want to allow the application to deal with. For example I would use a separate style for selected row/column that is a property of the grid. But, since the contents may want their own styles you may want to apply the style to the row presenter rather than the contents. There is no matching column presenter so that is a bit more involved.

For drag and drop headers there is even less system support. You can initiate a drag in response to a mouse event using the DragDrop class. Each potential target of a drag requires attention to make it accept a drop and provide visual feedback, as well as feedback as the header is being dragged from one position to another. The MS Research group had an example of a multi-column tree control but I do not think it supported drag and drop of columns or rows.

Your best bet is to look for an existing example/sample in the docs or on the web, or wait for a book to be released with a good example.

MichaelLatta at 2007-9-10 > top of Msdn Tech,Visual Studio Orcas,WPF Designer (Cider)...

Visual Studio Orcas

Site Classified