How can I create my own ListView UserControl? - c#

Ok so I have a table cell that I would like to use in this custom ListView UserControl, so I was wondering how exactly do you set one of these up and how do you call the cells to be my custom ones? Any help would be greatly appreciated :)

The ListView control is a b**ch, so if you are really planning to get your hands dirty with it, be prepared for a great big mess.
If you would prefer a ready-made solution, I will point you to this one: CodeProject - ObjectListView

We at ComponentOwl made custom ListView control called Better ListView. (Or maybe you can be interested in the freeware edition Better ListView Express).
You can also try the suggested ObjectListView.
The ListView control is -very- complex and contains myriads of little features all we had to implement. So I recommend you to look for a finished 3rd party control, since coding this is challenging (the BetterListView hit 40K lines of code only to meet requirements of ListView, now having about 80K+ lines of code!)

Related

How to show many statuses in a windows form

The program I'm making will need to show many statuses and websites information. I need to know the best way to go about doing this. I have had 0 luck with tableLayoutPanel.
I would like it to be similar to how these are on iOS, but can't find anything similar for C#.
Any help or tips would be VERY appreciated.
You could use a TableLayoutPanel. The catch is that you will need to add the rows, and then the controls to the rows, on the fly. You will also have to reorder the rows manually if a row is deleted or moved.
You could also style a datagridview control to look like this, and the datagridview has already done most of the heavy lifting of the databinding for you.
Finally, you may just be able to get away with the ListView control, depending on the functionality you need. This should be the easiest approach

Visual objects that change size in c# displayed in a linear list

Please forgive any silly words I may say. I am coming from a Actionscript3 background.
I am using "Visual C# 2010 Express".
I have a simple Form, in a WindowsForm Project, which currently holds just a Listbox. (Which I presume I will have to change to something else).
And I made myself a different display object (User Control) that is currently a Checkbox a title. (More will be added once I get over the hurdle below)
But I can't even get as far as Displaying the UserControl as a list.
I can't seem to find anywhere on the listbox to say "User this displayobject as the visual for listbox". I see tutorials saying "ItemsPanelTemplate" but I get error saying there is no such property for a Listbox.
I even tried making the Form in Design view and it is not in the list down the side of the GUI when I dragged as Listbox on screen.
Now I know how I would do this in pure Actionscript, but I dont know how to do this in Pure C#. Tutorials are not helping, as all the Microsoft site seems to try to give me is XAML (XML). and I am looking for C# code. So I have thrown in the towel and pleading for outside help.
Thank you for any help you can give.
It sounds like you want a list of items, each with a CheckBox and some descriptive text. Try using the CheckedListBox control. MSDN link.
This question also answers the question of how to do custom image drawing for each item in a ListBox. It may be helpful.
Edit after clarification:
Try embedding the UserControl in a ListView, rather than a ListBox.
References on embedding controls in ListViews:
C# listview - embedding controls
Adding button into a Listview in WinForms
You could also use a list of Panels, with each Panel hosting a UserControl.
C# List of Panels
But the real answer, as seen in the question's comments, is that Winforms doesn't have a convenient way to do this. This is a task much better suited to WPF.
You may check out freeware component Better ListView Express from ComponentOwl. It supports simple Details view without columns, two and three-state checkboxes, images and more...
They also offers full version with even more nice features like hierarchical and multi-line items.

Free Windows Forms Components Similar to jQuery UI Draggables

EDIT:
So, I ended up making my own basic solution to this problem, and it can be found in my own answer to the question below. Or, here's a link.
Original Post
I'm doing some UI programming for a small .NET application. The application has some collections of items that need to be displayed in a grid sort of format (X columns by Y rows) and the grid elements need to be able to get dragged around to different grid locations, and possibly out of the grid all together.
The most comparable sort of UI design elements I can think of are the jQueryUI Draggables.
Do I have to roll my own or are there components people have already written to act like this? Even better, are there any free components? Or is there an easy way to do this that I just don't know about (don't do a lot of .NET UI programming..)
Also these "grid items" need to be able to include windows form components. The DataRepeater control is close to what I need, except it only supports horizontal or vertical alignments, not grids of items.
Here's a visual example of what I'm looking for:
I tried to stick with a halloween theme here.
Well I rolled my own solution and hosted it on GoogleCode:
draggableitemorderedpanel- A .NET Winforms Component... Kinda like jQuery UI Draggables (not really, maybe someday)
here's a screenshot:
(source: googlecode.com)
and another just resized:
(source: googlecode.com)
Hope this helps someone else out. Also it's super basic and pretty sucks right now but gets the job done.
Anyone that wants project access can have it.
The System.Windows.Forms.TableLayoutPanel control supports dragging and dropping, you just have to handle the right events. You could make your own "GridItem" user control, with the icon, caption, background color, etc displayed on a Panel, and then plop a bunch of them in the tablelayoutpanel, and wire up some event handlers. Here's something similar:
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/1cade626-b76d-40c5-9e5a-101cf2a5e412

DataGridView Control with Grouping Capabilities

I've seem some other posts regarding datagrids that allows grouping. I've downloaded the DevExpress DataGrid for Windows Forms but it really looks complicated. I actually need a Datagrid that derives from DataGridView as a lot of my data binding is code driven and uses the DatagridView classes.
I've managed to find this OutLookgrid on CodeProject, I was wondering if anyone used this before?
http://www.codeproject.com/KB/grid/OutlookGrid.aspx
I've downloaded the DevExpress
DataGrid for Windows Forms but it
really looks complicated.
Looking really complicated and being really complicated are not the same thing. I use the DX XtraGrid everyday and I can assure you its as complicated as:
gridControl1.DataSource = myDataTable;
.. if you want just a standard grid out of the box.

Editable data grid for C# WinForms

I need to present the user with a matrix of which one column is editable. What is the most appropriate control to use?
I can't use a ListView because you can only edit the first column (the label) and that's no good to me.
Is the DataGridView the way to go, or are there third party alternative components that do a better job?
DataGridView is the best choice as it is free and comes with .NET WinForms 2.0. You can define editable columns or read-only. Plus you can customize the appearance if required.
DataGridView is good.
If you prefer a prettier interface, Telerik controls are better.
If DataGridView will handle your needs, it's the right answer. Another option (although it seems to be unpopular around these parts!) is Infragistics NetAdvantage. The downsides to Infragistics are primarily a high cost and somewhat steep learning curve; the upsides are that these are some of the most powerful controls you'll ever find -- so if you need their flexibility, go for it.
I don't have experience with Telerik (which has been mentioned by others here), but they do seem quite good. Being that my company has invested fairly heavily in Infragistics, we're not liable to switch any time soon ...

Categories