473,385 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Triangle indicator of sort order in column header of listview cont

I have windows form with ListView control. The ListView control has few
columns which user can sort by clicking the column header.

I want the column header have the small triangle indicator of sort order.
How can I implement that?

Thanks
Nov 17 '05 #1
3 5863
Steve,

There seems to be no managed way of doing this. While the underlying HEADER
control has dedicated Windows messages for adding icons to the column
headers, the managed wrapper does not utilize this possibility. However, as
long as you are comfortable with the Common Controls API and P/Invoke, you
can add the icons in a way you'd do it in C++.

Well, unless you really want this exercise in P/Invoking, check out this
CodeProject article:

http://www.codeproject.com/cs/miscctrl/aa_listview.asp

for an advanced (and FREE!) version of the ListView control.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Steve" <St***@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
I have windows form with ListView control. The ListView control has few
columns which user can sort by clicking the column header.

I want the column header have the small triangle indicator of sort order.
How can I implement that?

Thanks


Nov 17 '05 #2
Dmytro thank you for your response,

You wrote: "However, as long as you are comfortable with the Common Controls
API and P/Invoke, you can add the icons in a way you'd do it in C++."

Could you provide at least sketchy description and/or code sample which
shows how to access header control from C# using "Common Controls API and
P/Invoke"

Thanks

"Dmytro Lapshyn [MVP]" wrote:
Steve,

There seems to be no managed way of doing this. While the underlying HEADER
control has dedicated Windows messages for adding icons to the column
headers, the managed wrapper does not utilize this possibility. However, as
long as you are comfortable with the Common Controls API and P/Invoke, you
can add the icons in a way you'd do it in C++.

Well, unless you really want this exercise in P/Invoking, check out this
CodeProject article:

http://www.codeproject.com/cs/miscctrl/aa_listview.asp

for an advanced (and FREE!) version of the ListView control.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Steve" <St***@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
I have windows form with ListView control. The ListView control has few
columns which user can sort by clicking the column header.

I want the column header have the small triangle indicator of sort order.
How can I implement that?

Thanks


Nov 17 '05 #3
Steve,

Sorry but this is unlikely - I did that for a commercial project. Still, if
you download the source code for the article I mentioned in my previous
post, I think you should be able to find similar examples there.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Steve" <St***@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
Dmytro thank you for your response,

You wrote: "However, as long as you are comfortable with the Common
Controls
API and P/Invoke, you can add the icons in a way you'd do it in C++."

Could you provide at least sketchy description and/or code sample which
shows how to access header control from C# using "Common Controls API and
P/Invoke"

Thanks

"Dmytro Lapshyn [MVP]" wrote:
Steve,

There seems to be no managed way of doing this. While the underlying
HEADER
control has dedicated Windows messages for adding icons to the column
headers, the managed wrapper does not utilize this possibility. However,
as
long as you are comfortable with the Common Controls API and P/Invoke,
you
can add the icons in a way you'd do it in C++.

Well, unless you really want this exercise in P/Invoking, check out this
CodeProject article:

http://www.codeproject.com/cs/miscctrl/aa_listview.asp

for an advanced (and FREE!) version of the ListView control.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Steve" <St***@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
>I have windows form with ListView control. The ListView control has few
> columns which user can sort by clicking the column header.
>
> I want the column header have the small triangle indicator of sort
> order.
> How can I implement that?
>
> Thanks



Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bob Dankert | last post by:
Is there any way to maintain the sort order of a sort on a 2D array? For example: I have the array: 1,a 2,a 3,f 4,a 5,s 6,a 7,z 8,b and sort it by the second column, and I...
1
by: jrhoads23 | last post by:
Hello, I subclassed my own ListView which supports column sorting. It automatically draws the up/down sort arrows in the column header. The arrows that are used are drawn by me. I noticed that...
5
by: objectref | last post by:
Hi to all, i populate a ListView with data from a datareader and i just want to know the column name of the cell that the user clicks on. E.x., if the user clicks on the 2nd column, 3rd row in...
1
by: neelu | last post by:
I have four columns in listview. SR Number Part# DES Qty Weight 59 9410106800 Nut 10 0.03 60 90304ge800 Helmet 5 0.325 61 9635439604 ...
1
by: Leo | last post by:
Can someone tell me how to make the sorting triangle on datagrid column header always show up? And which property can change the color of the triangle ? The default color is white. Thanks
0
by: Frank Rizzo | last post by:
I've implemented sort via the well known method of assigning the an IComparer class to the .ListViewItemSorter property. It works fine except for one thing. If I had rearranged the column order...
2
by: Just Me | last post by:
Listview is Docked=Fill I set all column widths to -2 and it works as expected if the listview needs to be too wide for the window. That is, I get an H-scrollbar and the columns are the correct...
6
by: Samuel R. Neff | last post by:
I'm trying to put icons in the header of my ListView. All the .net posts I found refer to an example on thecodeproject which is no longer there (part of commercial package now). I converted the...
1
by: Dave Griffiths | last post by:
Hi All Using VB.Net 2005 pro When I click on a column header to sort my Listview I would like to have the sort order displayed like many programs dom with the small Icon pointing up or down....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.