listbox

Changing text foreground color on mouseover and selection with Silverlight 4 ListBox

会有一股神秘感。 提交于 2019-12-11 17:17:41
问题 I'm trying to accomplish the following scenario with a Silverlight ListBox: Normal items have a foreground text color of black and background color of white Selected items have a foreground text color of white and a background color of dark blue On mouse-over the background becomes a orangish and the foreground text color is black I have each of those pieces working individually but can't get them all working together. I started by retemplating the ListBoxItem, wrapping the ContentPresenter

.NET Delete actual files from listbox

老子叫甜甜 提交于 2019-12-11 16:44:32
问题 This code is intended to delete the actual files from the system when it is selected from the system: Dim file As String() file = System.IO.Directory.GetFiles("C:\Users\User\Desktop", "lalala.txt", IO.SearchOption.AllDirectories) If ListBox1.SelectedIndex = -1 Then MsgBox("No files selected") Else System.IO.File.Delete(ListBox1.Items(ListBox1.SelectedIndex).ToString()) ListBox1.Items.RemoveAt(ListBox1.SelectedIndex) End If However, only the items in the listbox are deleted. The actual file

Getting selected listbox items values to display in another listbox using vb 2008

北战南征 提交于 2019-12-11 16:21:18
问题 I have a form with a 2 listboxes. Here, listbox1 is populated with names of actors and actresses. If a name is selected from listbox1, listbox2 should show the title(s) of movie(s) where that name is involved. If another name is selected, listbox2 will show title(s) of movie(s) that 2 name is involved. Call Connect() With Me STRSQL = "select mTitle from selectmovie where cName = '" & lstNames.SelectedItem & "'" Try myCmd.Connection = myConn myCmd.CommandText = STRSQL myReader = myCmd

c# MeasureItemEvent handler: e.ItemHeight not changing

﹥>﹥吖頭↗ 提交于 2019-12-11 15:33:39
问题 Is it me or can I only set the itemheight - e.ItemHeight - once for a listbox? Although I handle the MeasureItemEvent on my ownerdrawn listbox and set the e.ItemHeight to the right value, only the first height that is set will be used. Oops, I am new to this, sorry about that. This is the code (DrawItemHandler is of course in the actual program): // Add eventhandler to draw and measure items this.listBox1.DrawItem += new DrawItemEventHandler(this.DrawItemHandler); this.listBox1.MeasureItem +=

How can I change selected item's background color in Windows Phone?

血红的双手。 提交于 2019-12-11 15:01:51
问题 How can I change selected item's background color that in listbox which has datatemplate in Windows Phone? I have seen that it can be with Setter Properties. Where I will write them? Thanks. Code <ListBox x:Name="listLocs" HorizontalAlignment="Left" Height="605" VerticalAlignment="Top" Width="250" SelectionChanged="listLocs_SelectionChanged" Margin="10,155,0,0" BorderBrush="#FF030042" BorderThickness="2" Foreground="#FF030042"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation=

How to customize the color of the currently selected item of a listbox?

纵饮孤独 提交于 2019-12-11 14:50:03
问题 This question results out of my last question here in stackoverflow. The problem to scroll automatically to a specific item is solved, but now i want to set the selected item background to transparent or white. How can i do this?? Update 1 <ListBox ItemsSource="{Binding SomeData}" SelectedIndex="{Binding SomeIndex}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Orientation="Vertical" /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <SomeChart

Keep ListBox sorted, but with a particular entry always pinned to the top

泪湿孤枕 提交于 2019-12-11 14:48:17
问题 I have a ListBox filled with Countries (which I take from the Active Directory). I want the list to be sorted, but also I want one entry "All" to be at the very top. How can I do this? 回答1: If you are binding the data in code behind you can insert a Listitem at index 0. ListItem myItem=new ListItem("ALL","value"); myListbox.Items.Insert(0, myItem); 回答2: I would sort the list items first before binding to you ListBox. There are several options for doing this depending on what your data source

Selecting values simultaneously from different Tkinter Listbox widgets in Python 3.5

时光总嘲笑我的痴心妄想 提交于 2019-12-11 14:12:38
问题 I want my program to work in a way that: when I click an element from either of the 3 listboxes to select the adjacent values (example: if i select 0 in the first listbox, it should select the value "hello" in the second listbox and "world" in the third listbox Thanks to This question/answer I managed to make them move simultaneously the code is the following: from tkinter import * class fase3(Frame): def __init__(self, master): Frame.__init__(self,master) self.master=master self.frame=Frame

ObservableCollection Bound from ViewModel Does Not Update View

依然范特西╮ 提交于 2019-12-11 13:49:24
问题 I am allowing a user to delete an item via ContextMenu menu item within the view, and I would like the effect to be seen automatically in the view. As of now, the item in the view remains until the app is restarted, in which case it is then no longer visible. This is very confusing to the user who believes the item has been removed completely from the application. My question is, what am I doing wrong that would fix this issue? App.xaml.cs //PictureRepository is a class that gathers pictures

ListBox items remains after replace by empty array in jQuery

試著忘記壹切 提交于 2019-12-11 13:42:44
问题 I have a list box which I want to clear by jQuery without page refresh. <asp:ListBox ID="lbComplaints" runat="server" ClientIDMode="Static" SelectionMode="Multiple" placeholder="Select Complaints" Style="width: 280px;" AppendDataBoundItems="True"> in a button click $('input[type="submit"]').click(function (e) { e.preventDefault(); $("#lbComplaints").val([]); )}; It does not show any error but the items remain in previous selection. I tried $("#lbComplaints").empty(); but all the data of the