listbox

ListBox content not completely stretching across listbox

北战南征 提交于 2019-12-24 09:49:47
问题 I am trying to make a list box where I have complete control over the look of each item in the list box. I can make the item horizontally stretch. However, there's this thin sliver of blue to the left of a selected item. (In the picture, the middle item is selected). Can I make this blue strip go away? alt text http://img44.imageshack.us/img44/949/boundlistboxdisplay.jpg Here's the complete code. <Window x:Class="SimpleListTemplate.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml

Select an item two or more times

不羁岁月 提交于 2019-12-24 07:46:56
问题 I have a Listbox with its DataContext. When I select an item, I can't select the same again. This is not a problem when there are many objects, but sometimes, a post-service return me a list with only one element, and if the user select the element and he wants select it again, he will not can do it. Anyone knows how to resolve this problem Anyway, thanks! 回答1: Try this, it works for me.. :) public void OnSelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox listBox = sender

WPF Adding an object to ListBox with existing ItemsSource

烂漫一生 提交于 2019-12-24 06:46:06
问题 Hey I have a list box that I set the ItemsSource to be an ObservableCollection of objects from my database, and I need to add a single object at the end of this list. However I keep getting an invalid operation exception. Somehow my listbox is in use (which in my mind is a given as it is displayed and already have items inside.) Here is my code for the list box: <ListBox x:Name="CarList" SelectionChanged="ItemSelected" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Background="{x:Null}

Error when empty listbox

China☆狼群 提交于 2019-12-24 06:34:50
问题 Im having two issues with the code below; it works just fine until there is nothing to show on the listbox, the I get an error message; and the second is I cant get It the refresh the data on the listbox. Heres what Ive got. Private Sub UserForm_Initialize() Dim tiempoa As Date Dim tiempob As Date Dim tiempoc As Date Dim seguimiento As Long, i As Long Dim Data() As Variant Dim cell As Range With Me.ListBox1 .ColumnCount = 6 .ColumnWidths = "40;82;117;117;60;180" End With i = 1 With Hoja2 With

Is there a way to iterate in a ListBox Items templates?

拈花ヽ惹草 提交于 2019-12-24 06:04:08
问题 I have a list box that contains items that are represented by a single textbox. When the user clicks a button, I want to iterate thru all these text boxes and check if their binding expressions are clean of errors; Should be something like: Dim errCount = 0 For Each item In MyListBox.ListBoxItems 'There is no such thing ListBoxItems which is actually what I am looking for. Dim tb As TextBox = item '.........Dig in item to extract the textbox from the visual tree. errCount += tb

How to remove the left-hand blue line on custom selected styled Listbox items?

℡╲_俬逩灬. 提交于 2019-12-24 05:44:08
问题 I found this code which replaces the default select style with a custom style for the select ListBoxItem in a ListBox. However, there is still a little blue line on the left from the default style which I can't remove with any padding or margin changes. How can I remove that blue line and completely determine the style of the selected ListBoxItem? alt text http://tanguay.info/web/external/blueLineLeft.png <Window x:Class="CodingContext.Window1" xmlns="http://schemas.microsoft.com/winfx/2006

Loading Different DataTemplate for each item in ListBox

≯℡__Kan透↙ 提交于 2019-12-24 05:37:26
问题 I am trying to create a learn application and I would like to load data template for based on Question type as explained below. If Question Type is TYPE1 load InstructionTemplate_Type1.xaml load ChoiceTemplate_Type1.xaml load QuestionTemplate_Type1.xaml If Question Type is TYPE2 load InstructionTemplate_Type2.xaml load ChoiceTemplate_Type2.xaml load QuestionTemplate_Type2.xaml If Question Type is TYPE3 load InstructionTemplate_Type3.xaml load ChoiceTemplate_Type3.xaml load QuestionTemplate

Removing an item from a WPF binding listbox

♀尐吖头ヾ 提交于 2019-12-24 04:01:14
问题 I have a WPF application with a ListBox (called listMyItems) which is successfully bound to a class of MyItems that I created. I have a List of MyItems called currentMyItems which is then assigned as ItemSource to the ListBox. It all works fine, if I add an item to the currentMyItems it pops up on the list, etc. The problem occurs when I try to remove the selected item in the ListBox. This is the code that I use: currentMyItems.Remove((MyItem)listMyItems.SelectedItem); The item disappears

Tkinter listbox that scrolls with arrow keys

我们两清 提交于 2019-12-24 03:53:05
问题 I'm trying to get my listbox to have the first object highlighted (which happens with self.e1.select_set(0) . I am now trying to scroll through the listbox highlighting the next item down when hitting the down arrow, or select the next item up by hitting the up arrow. I thought that I could do this with binding but no luck. Any ideas? def body(self, master): self.e1 = tk.Listbox(master, selectmode=tk.SINGLE, height = 3, exportselection=0) self.e1.insert(tk.END, "1") self.e1.insert(tk.END, "2"

How to select multiple value from a listbox

雨燕双飞 提交于 2019-12-24 03:38:32
问题 I have a below code where if I select one value, it works fine, but now I need such that when I select multiple values from the listbox, i have to get the value of selected values. How do i go about it? Here is the code, HTML Code: <select id="attributeNames" name="attributeNames" size="5" multiple="multiple" onchange="getUniqueValues(value)"> <option value="Apple"> Apple </option> <option value="Mango"> Mango </option> <option value="Orange"> Orange </option> <option value="Banana"> Banana <