ListViewColumn Type not implemented...

0
1

Hi guys,

So it looks like the ListView ColumnHeader does not have something equivalent to the VWG ListViewColumnType property, which lets you indicate the type of data in a column.

Is this intentional? Is there something equivalent?

I need it for several things:

  1. Sorting listviews may need to treat some columns as numeric or date – you will get a different sort order treating everything as text.
  2. Exporting listviews to Excel lets you set the target column to the correct data type

 

http://screencast.com/t/QXnHsIxi

Thanks

Mitch

 

  • You must to post comments
0
0

Ok, fair enough.   I don’t disagree with your decision.

I had started using the Tag property to store this value.

Mitch

  • You must to post comments
0
1

Hi Mitch,

The ListViewColumnType is a VWG addition, it’s not present in WinForms. We used WinForm as the base class model while removing all items that would be obsolete on a web platform (like 3D borders) and adding a lot of additional web-css3-html5 features. While our main goal (and necessity) was to replace VWG we also didn’t want to replicate features that have probably been added over the years to cover various shortcomings (at least not from the start).

The ListViewColumnType is a strange property since it doesn’t specify just the data type (it has Icon and Control), it’s only used to render the cells, and the only value type that can be stored in ListViewItem is a always a string anyway – unlike the DGV which supports any type. It looks like VWG tried to use the LV as a DGV with mixed results. The enumeration is a mix of data type and visual widget type (limited to Icon and Control).

You can add a Type property (or any other property) to ColumnHeader or ListViewItem in two ways:

  • Extend ColumnHeader -> MyColumnHeader : ColumnHeder. The editor will automatically detect any subclass and will show you the list of subclasses at design time.
  • Or use the UserData property (all Wisej components have it and it’s a lot better that the Tag object) like this: this.columnHeader1.UserData.valueType = typeof(int), or like this this.columnHeader1.UserData[“valueType”] = typeof(int). The UserData property is a dynamic object that can store anything with any key.

Best,

Luca

 

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.