List controls C# - c#

I'm working on something like a download manager on C#, and I need to implement a download list that has to support the following features:
1] The list should support scrolling2] All the list elements have a url, and some other data + icon
3] Selection, and multiple selection.
How can I implement this kinda of list? I there an already created control I can use?
I started to implement it using a flowLayoutPanel and custom controls for all the list items and handling the Click events of the custom control. I'm not sure that custom creating this would be the right way to go.
Any help would be highly appreciated.

If you're using WinForms, you can use a ListView control, which supports these features as standard.

Use DataGridView and implement custom cells/columns for it by inheriting from DataGridViewColumnand DataGridViewCell.

If you decide to use WPF, you can use a ListView, with scrolling options enabled, with a GridView on top of it.
http://msdn.microsoft.com/en-us/library/system.windows.controls.listview.aspx

Related

C# telerik winforms radDropDownList multiselect

I have enabled multiple selections in the radDropDownList with below code.
radDropDownList1.DropDownListElement.SelectionMode = SelectionMode.MultiExtended;
This list has 10 options and each user can choose one to 10 of them
Now I want to retrieve the user selection that I saved in an array list
ArrayList UserChoose = new ArrayList();
UserChoose = getUserChoose("username");
How can I through the code,Return user selections to the radDropDownList?
radDropDownList.Select = UserChoose ?
There is 2 ways how you can achive that. It will be little complex but it will work for you I believe.
Way 1:
As I think, you might not able to do that using only radDropDownList. If still you want to do that using radDropDownList then you have to customized radDropDownList like in the telerik dicussion forum. Source code link is here.
Way 2:
You can use RadMultiColumnComboBox. It will be easy to implement. At the same time it has more features. Check link of telerik over here=>RadMultiColumnComboBox Documentation.
Note: Personally I support the latter one rather than the former one.So, way 2 is much more effective.
The easiest replacement for a Windows Forms dropdown with multiple selection using Telerik is the RadCheckedDropDownList control, that is intended to provide that particular functionality.
It is available since version 2018.1.116.

How to make in C# a ListView with custom content just like Android's ListView?

Is there a way in C# where you can design ListView items and use and adapter just like Android has?
I have a UI proposal for my project and it requires this kind of feature.
The look is like this: Project GUI
The RED area indicates the ListView and it has these items which have custom layouts.
Here is the layout of the item: Item Layout
So, every time that the program detects an object it will create an item to the ListView with the preview of the Object.
Yes there is a way. It's not easy but you can. You must set the OwnerDraw property to true. You can then handle the DrawItem event and do your own implementation. Alternatively, use a control like this.
In WPF that job would be much more easy :)

adding a windows form object to listbox

I'm creating a twitter client in C#.
I want to put every tweet as an element of a listbox.
I created a windows form that represents a tweet(it has a picture, and labels).
My problem is that when i can't see the tweets when i add them to the listbox. After adding 3 tweets(windows form objects), the listbox has 3 blank elements in them, but i can't see anything of it.
How can i add a windows form object to a listbox?
(these forms are working fine, because i can see them if i use the ShowDialog method)
please help
You can add a Form object to the ListBox.Items collection but the only thing you'll ever see is the type name of the form. ListBox is not capable of rendering controls as its items.
The efficient solution is to implement the ListBox.DrawItem event and custom draw the tweet. There's a good example of such an event handler in the MSDN Library documentation for the event.
The slow solution is to add controls to a Panel's Collection property with its AutoScroll property set to true. That cannot be a form, it must be a UserControl.
You may want to look into implementing it using WPF. Where you can pretty much put anything inside a listbox.
Some thoughts:
You'd do better to work with custom controls, rather than a whole form
A listbox can't have controls on it... consider a ListView: http://www.codeproject.com/KB/list/ListViewEmbeddedControls.aspx
Some example code of what you're trying will help us zoom in on what you're doing
HTH,
James
I don't think ListBox can display anything but a text string for each element, so you won't be able to see an image of each form if that's what you were hoping for. You might try using FlowLayoutPanel instead to manage a list of controls.

Is it possible to nest a listview inside another one?

Using a C# 3.5 Winforms -
Is it possible to nest one listview inside another? The idea is to a list of lists - The higher level list would be groupings and the lower level list would be the details.
UPDATE:
Nesting does not appear to be possible. However using a FlowLayoutPanel I can add many listview controls into it and the panel takes care of automatic layout control. Using grouping in each listview helps to identify what each list is.
I don't believe it is possible (and certainly not recommended) to nest a WinForms listview inside another. However you can enable grouping as described here.

Dynamic top down list of controls in WindowsForms and C#?

In our project, SharpWired, we're trying to create a download component similar to the download windows in Firefox or Safari. That is, one single top down list of downloads which are custom controls containing progress bars, buttons and what not.
The requirements are that there should be one single list, with one element on each row. Each element must be a custom control. The whole list should be dynamically re-sizable, so that when you make it longer / shorter the list adds a scroll bar when needed and when you make it thinner / wider the custom controls should resize to the width of the list.
We've tried using a FlowLayoutPanel but haven't gotten resizing to work the way we want to. Preferably we should only have to set anchoring of the custom controls to Left & Right. We've also thought about using a TableLayoutPanel but found adding rows dynamically to be a too big overhead so far.
This must be quite a common use case, and it seems a bit weird to me that the FlowLayoutPanel has no intuitive way of doing this. Has anyone done something similar or have tips or tricks to get us under way?
Cheers!
/Adam
If you don't want to use databinding (via the DataRepeater control, as mentioned above), you could use a regular Panel control and set its AutoScroll property to true (to enable scrollbars).
Then, you could manually add your custom controls, and set the Dock property of each one to Top.
.NET 3.5 SP1 introduced a DataRepeater Windows Forms control which sounds like it'd do what you want. Bind it to the list of "downloads" (or whatever your list represents) and customize each item panel to include the controls you need.

Categories

Resources