listbox

How to set multiple items as selected in ListBox?

烂漫一生 提交于 2019-12-04 06:31:55
I have one ListBox with selection mode of multiple. In code behind, I want to set some values as selected. These values are present in a ListItems[] named 'Names' . HTML code: <asp:ListBox ID="lbto" class="chosen" runat="server" Width="450px" Height="20px" SelectionMode="Multiple"> <asp:ListItem>Mandy</asp:ListItem> <asp:ListItem>Amit</asp:ListItem> <asp:ListItem>sundar</asp:ListItem> <asp:ListItem>ragu</asp:ListItem> <asp:ListItem>raju</asp:ListItem> </asp:ListBox> ListItem[] Names contains 'ragu' and 'raju' . Now, when the page loads, the ListBox should contain 'ragu' and 'raju' as selected

python tkinter listbox event binding

半世苍凉 提交于 2019-12-04 06:01:51
问题 I'm having trouble getting an event binding to work with python/tkinter. I'm simply trying to click and have the location printed, but every time I do this, "-1" is the result. Here's my code from Tkinter import * import Tkinter class make_list(Tkinter.Listbox): def __init__(self,master, **kw): frame = Frame(master) frame.pack() self.build_main_window(frame) kw['selectmode'] = Tkinter.SINGLE Tkinter.Listbox.__init__(self, master, kw) master.bind('<Button-1>', self.click_button) master

get value from DataTable

跟風遠走 提交于 2019-12-04 05:55:28
I want to get all column value from DataTable and store it to the ListBox. Here is my code If myTableData.Rows.Count > 0 Then For i As Integer = 0 To myTableData.Rows.Count Dim DataType() As String = myTableData.Rows(i).Item(1) ListBox2.Items.AddRange(DataType) Next End If but when I compile that code, I got error message like this : Unable to cast object of type 'System.String' to type 'System.String[]' so, how to resolve this problem?? Please help me.... You can try changing it to this: If myTableData.Rows.Count > 0 Then For i As Integer = 0 To myTableData.Rows.Count - 1 ''Dim DataType() As

styling HTML form list box with CSS or jQuery

自作多情 提交于 2019-12-04 05:53:28
问题 I want to simply change the colors and define the edges of a multiple line select box, or list box. I have seen a few threads on similar subjects, but not quite the solutions I am looking for. I need to be able to: Change hover color of elements Change select color of elements Change border Style side slider (not essential) I think I might have to use JS (via jQuery, if possible), but would much rather use CSS is I can. Here is what I mean by a list box 回答1: there is no possibility to do this

I need Horizontal view of list boxes

[亡魂溺海] 提交于 2019-12-04 05:27:24
问题 I am working on list boxes in WPF. I want to show the list boxes in horizontal direction. My code is <Grid> <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto"> <ItemsControl x:Name="list" > <ItemsControl.ItemTemplate> <HierarchicalDataTemplate> <Border Padding="5,0,0,2"> <WrapPanel Orientation="Horizontal"> <ListBox Name="mylistBox" Width="200" Height="200"> <Label Content="{Binding name}"/> <Label Content="{Binding phone}"/> <Label Content="{Binding email}"/> <TextBox Name=

How to show just filtered rows in my userform listbox

六眼飞鱼酱① 提交于 2019-12-04 05:26:41
问题 I have one Excel sheet, one userform and a listbox is in userform. Now when i filter my sheet and update listbox by click on button that is on my user form i see all rows in list box. I mean listbox1 show all cells (filter+no filter). I have a little in formation in VBA but i need the codes and it is so important for me. Please help me with detail and with file if possible. My code so far for updating the list box: Private Sub CommandButton1_Click() CommandButton10.Visible = True insertlist1

WPF TwoWay Binding of ListBox using DataTemplate [duplicate]

若如初见. 提交于 2019-12-04 04:40:38
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: How to make ListBox editable when bound to a List<string>? I'm trying to set a two-binding between a List named "ListStr" object and a ListBox WPF control. Besides I want the items to be editable, so I added a DataTemplate with TextBoxes expecting that it would modify the ListStr items straight away via TextBoxes. But when I'm attempting to edit one of them, it doesn't work... Any Idea ? PS: I've tried to add

Listbox datatemplate - item only selectable by clicking a subelement, not just anywhere on the item

妖精的绣舞 提交于 2019-12-04 04:17:53
I have a listbox with a datatemplate for the items. The problem is that selecting an item doesn't work by just clicking anywhere on the item; I have to click on a specific sub-element for it to actually work. My item has an image and a textblock. If I hover the mouse over the image or text-block, I actually see the hover-effect. If I hover the mouse over any of the 'empty' space of the item, no hover effect (and no selection when I click there). Example image : http://i33.tinypic.com/wvtleg.png If I click on (or hover over) the actual text or the image it works fine, but if i hover my mouse in

Putting ListBox in ScrollViewer: mouse wheel does not work

回眸只為那壹抹淺笑 提交于 2019-12-04 04:06:24
My mouse wheel does not work when putting a ListBox in a ScrollViewer . Does the ListBox somehow "steal" this event? <ScrollViewer VerticalScrollBarVisibility="Auto" Style="{StaticResource myStyle}"> <ListBox> <ListBoxItem>Test 1</ListBoxItem> <ListBoxItem>Test 2</ListBoxItem> <ListBoxItem>Test 3</ListBoxItem> <ListBoxItem>Test 4</ListBoxItem> <ListBoxItem>Test 5</ListBoxItem> <ListBoxItem>Test 6</ListBoxItem> <ListBoxItem>Test 7</ListBoxItem> </ListBox> </ScrollViewer> Edit: as requested by Joel, added the reason why I did this.. I did this because I don't like what the ListBox 's internal

How to show a divider between items in a ListBox?

别等时光非礼了梦想. 提交于 2019-12-04 03:49:19
问题 I am using a ListBox control in a Windows Phone 7 application, and I would like to show a divider/line between the list rows. I have not been able to find any information about this, although many (not wp7) ListBox examples seem to have a divider. 回答1: Got inspired by NestorArturo and found out about the Border control. It is very easy to wrap your ItemTemplate content in a Border control and specify the BorderThickness and BorderBrush. I went this way, because it doesn't require changes to