listbox

Adding a “Tag” property to a ListBox's items, like a TreeView's Nodes?

[亡魂溺海] 提交于 2019-12-31 05:11:21
问题 I'm making a Windows Form project that will search for files in the specified folders in my spare time. So far, I've got my TreeView that displays folders just like in the Windows Explorer. I also have a ListBox that will store all the search results. When I double click an item in that list, I want to have the option of opening the file. So far, I see three ways of doing this: Having the ListBox display the full path. Using a global List or Array to keep track of the full paths, while the

ASP.NET MVC ListBox does not show the selected list items

南楼画角 提交于 2019-12-31 04:57:10
问题 I am in a big trouble. I read 4 stackoverflow question and one blogpost. I have tried 5 different approach to view the selected items in a multiple selectlist. I have no success. The multiple selectlist is generated, but it does not select the items. I have no more idea. Model : public class EditableModel { public IList<Company> SelectedCompanies { get; set; } public IList<SelectListItem> SelectListCompanies { get; set; } } Controller : public ActionResult Edit(int id) { var service =

C# - Error “not all code paths return a value” with an array as out parameter

人走茶凉 提交于 2019-12-31 03:58:12
问题 I currently have the below code: public int GetSeatInfoString(DisplayOptions choice, out string[] strSeatInfoStrings) { strSeatInfoStrings = null; int count = GetNumOfSeats(choice); if ((count <= 0)) return 0; strSeatInfoStrings = new string[count]; int i = 0; for (int index = 0; index <= m_totNumOfSeats - 1; index++) { if (string.IsNullOrEmpty(m_nameList[index])) strSeatInfoStrings[i++] = m_nameList[index].ToString(); } } This code produces an error of, "...GetSeatInfoString.DisplayOptions,

Detect Scrolling Event of ListBox?

半城伤御伤魂 提交于 2019-12-31 00:57:51
问题 Is there an event fired when a ListBox begins to scroll? I currently have the following code to allow for a seamless drag and dropping from a listbox. <ListBox.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" Margin="-5" /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate > <DataTemplate> <Image ManipulationStarted="ListImage_ManipulationStarted" Tag="{Binding selfReference}" x:Name="ListImage" Margin="2.5" Stretch="Fill" Source="{Binding thumbnailURL}"

How can I implement incremental search on a listbox?

天大地大妈咪最大 提交于 2019-12-31 00:00:41
问题 I want to implement incremental search on a list of key-value pairs, bound to a Listbox. If I had three values (AAB, AAC, AAD), then a user should be able to select an item in the available list box and type AAC and this item should be highlighted and in focus. It should be also in incremental fashion. What is the best approach to handle this? 回答1: I realize this is extremely late... however, having just implemented this, I'll leave it here in the hope that it will help someone. Add a handler

why listbox1.Items.Add use Equals Method of my Object?

倖福魔咒の 提交于 2019-12-30 16:07:12
问题 i'm scrutinizing Windows Forms ListBoxCollection Add Method, during the analyzing i found that the method "add" calls Equals method in base Object why this method do this action ? I Have used "Call Stack" and I have Find This Answer : We Call :System.Windows.Forms.ListBox.ObjectCollection.Add(object item) and it will Call : System.Windows.Forms.ListBox.ObjectCollection.AddInternal(object item) and it will Call : System.Windows.Forms.ListBox.NativeAdd(object item) and it will call : System

C# - Adding Button inside ListBox

跟風遠走 提交于 2019-12-30 08:51:59
问题 I'm writing an C# App (WinForm) with a ListBox having content added by the user. Now, I could have a ordinary button under the ListBox to remove items, but I would like to have the button right next to the content, thus being inside of the ListBox. Like this: Content 1 | X Content 2 | X ... Content 5 | X The problem is that I lack experience in .NET so I have no clue on how this would be possible with all the automated controls going on. I've googled it, but came up with no meaningful results

ListBox and Datasource - prevent first item from being selected

≯℡__Kan透↙ 提交于 2019-12-30 08:06:26
问题 Hey. I've got the following code that populates my list box UsersListBox.DataSource = GrpList; However, after the box is populated, the first item in the list is selected by default and the "selected index changed" event fires. How do I prevent the item from being selected right after the list box was populated, or how do I prevent the event from firing? Thanks 回答1: To keep the event from firing, here are two options I have used in the past: Unregister the event handler while setting the

Can't fully style a ListBox/Scrollviewer in WPF

北城以北 提交于 2019-12-30 08:04:55
问题 I'm using custom Scrollbars we created using standard ControlTemplates, however when I apply them to a ListBox there is a corner in the bottom right which I am unable to find any way to override. Unfortunately I can't post a picture until I get more points. But the corner I'm referring to is when both a vertical and horizontal scrollbar appear, there is a space in the bottom right that is filled with an off-white color that I am unable to ovrerride 回答1: this is the part of the template code i

Can't fully style a ListBox/Scrollviewer in WPF

我是研究僧i 提交于 2019-12-30 08:04:24
问题 I'm using custom Scrollbars we created using standard ControlTemplates, however when I apply them to a ListBox there is a corner in the bottom right which I am unable to find any way to override. Unfortunately I can't post a picture until I get more points. But the corner I'm referring to is when both a vertical and horizontal scrollbar appear, there is a space in the bottom right that is filled with an off-white color that I am unable to ovrerride 回答1: this is the part of the template code i