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.
Related
I have a xaml which contains a tab control (Name="MyTabControl"). I'm a beginner with wpf and in code and I want to dynamically add tab items that I then add a list box to each created tab item. Below is the code I have so far.
ListBox listbox = new ListBox()
TabItem tab = new TabItem()
tab.AddChild(listbox)
MyTabControl.Add(tab)
My issue is that I can't figure out how dynamically create new tabs that also would add a list box to each new tab and the new tabs then added to MyTabControl.
Then, I would want to be able to access each list box control, individually, in each tab to edit the list box content.
How is this done in code? How can i access the created list box controls to edit them?
WPF/UWP and XAML are designed with the MVVM pattern in mind. While you can use other approaches, doing so will miss about 90% of it's power and run into issues at every other corner.
In MVVM this would be simply a mater of Exposing a Collection and having a Tempalte targetting that type. ListBoxes might even have a custom Template system, but using ListBoxes might no longer be nessesary - any container can expose a Collection.
If you plan on learning MVVM, mid to longertem you should learn MVVM. I wrote a short intro a few years back, that should help you going. Help for people not following MVVM is parse on the Forum.
In general, it's a violation of the MVVM principles WPF is built around to build a UI in this way. Instead, consider a solution similar to the one proposed in the answers to this question. They do a good job of explaining both what to do, and why we do it this way.
I want my ListBox to have columns, and one of those columns have to be a clickable URL.
How can I achieve this?
You can't do it in a ListBox. You can create your own control, or settle for another existing one. Based on the question, I'd guess you're not yet at the stage where you're creating your own controls. That takes a pretty good understanding of existing controls and the way they work under the covers (but a google search for creating Winforms Controls should yield plenty of instructions.) Edit added It looks like te 4th and 5th links in combination on that google search should get you what you need. You can create your own user control and then do an array of them)
As far as for other possible alternatives, have you considered a DataGridView? A DataGridView can have a hyperlink and it can have checkbox columns, so this would be one possible alternative.
Here's a link for having a Hyperlink column in a DataGridView.
Well, it is possible by using the CustomTabOffsets property (unreliable) or the DrawItem event. And implementing the MouseDown event to find out if that particular 'column' was clicked.
But there's little point, a ListView control with View = Details gives you the same functionality.
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
Need to represent a two column table. Maybe just for reference at this stage - or with the functionality that a double click presents a combobox essentially on that field with all the possible values that can be entered.
Is datagridview the best option for this in WPF or what else could I do to represent the data?
Cheers,
I'd say datagridview is the way to go. You can create your own custom columns. Here's a quick example:
http://www.code-magazine.com/Article.aspx?quickid=0707061
Or if you want to use something that's already available and pretty easy to use, check out SourceGrid. I've used it in WinForms and WPF applications, though the latter requires using WindowsFormsHost.
SourceGrid: http://sourcegrid.codeplex.com/
This question is for C# 2.0 Winform.
For the moment I use checkboxes to select like this : Monday[x], Thuesday[x]ΒΈ... etc.
It works fine but is it a better way to get the day of the week? (Can have more than one day picked)
Checkboxes are the standard UI component to use when selection of multiple items is allowed. From UI usability guru Jakob Nielsen's article on
Checkboxes vs. Radio Buttons:
"Checkboxes are used when there are lists of options and the user may select any number of choices, including zero, one, or several. In other words, each checkbox is independent of all other checkboxes in the list, so checking one box doesn't uncheck the others."
When designing a UI, it is important to use standard or conventional components for a given task. Using non-standard components generally causes confusion. For example, it would be possible to use a combo box which would allow multiple items to be selected. However, this would require the user to use Ctrl + click on the desired items, an action which is not terribly intuitive for most people.
checkbox seems appropriate.
You can also use a ListView with CheckBoxes on...
for a little less hard coding.
Checkboxes would work fine, and there is a preexisting paradigm of that usage in Windows Scheduled Tasks. To see that example, create a scheduled task and select Weekly for the frequency.