listbox

Is possible to get a index from a item in a list?

江枫思渺然 提交于 2019-11-30 20:03:07
问题 I mean, I've got a listBox, and I'm putting in itemsSource property the list. And I want to show also the index in the binding of it. I have no idea if this is possible in WPF. Thanks. 回答1: There are a few methods for doing this including some workarounds using the AlternationIndex. However, since I've used the AlternationIndex for other purposes I like to get a binding for the element index with the following: <MultiBinding Converter="{StaticResource indexOfConverter}"> <Binding

Multi Select List Box

时光毁灭记忆、已成空白 提交于 2019-11-30 16:23:39
I have a list box on a form and it works fine for what I want to do. I am wanting to edit items on the form, this means populating the listbox and then selecting the relevant items. My listbox contains a list of item sizes, i want to select the sizes which belong to the item being edited. PLease can someone give me some pointers. I tried me.lstItemSizes.SetSelected(i,true) but this only works for a single item. Any help wil be much appreciated. My Code: Private Sub SelectItemSizes(ByVal itemID As Integer) Dim itemSizes As IList(Of ItemSize) = _sizeLogic.GetItemSizes(itemID) Me.lstItemSizes

WPF Listbox remove selection by clicking on a blank spot

拈花ヽ惹草 提交于 2019-11-30 16:11:16
I have a wpf listbox with a custom item template which contains a rectangle. The each item in the listbox can be selected (only one at a time). I want to add a behavior in which when a user clicks on a place which isn't the item (for instance, a blank spot on the listbox , which is not an item), the selected item will become deselected. Any ideas? Thanks. For example with a simple listbox: item 1 item 2 The behavior that I'm looking for is when the user clicks on pixel 500 (which is a part of the listbox but not on an item), the currently selected item will be deselected. The simple solution

Trying to Make an Efficient Calendar in Microsoft Access

这一生的挚爱 提交于 2019-11-30 16:01:22
I'm working on an equipment management system using a MS Access .mdb file for the front end, and SQL Server 2008 for the back end. If needed I can convert the front end to a MS Access 2010 file. I created a calendar form, where the users can see what equipment is booked, signed out, or over due. It looks like this: I made this using 42 subforms, which is unfortunately slow. With the data shown above, it only takes about 5 seconds to load, but as soon as I use real data, it starts to really bog down unacceptably. I tried to make this more efficient by keeping the source object of the subforms

ListBox is selecting many items even in SelectionMode=“Single”

拜拜、爱过 提交于 2019-11-30 15:14:07
问题 I have encountered something very strange, simple WPF application <Window x:Class="ListBoxSelection.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <ListBox ItemsSource="{Binding Path=Strings}" SelectionMode="Single"/> </Grid> </Window> with code behind public class ViewModel { public List<string> Strings { get; set; } public ViewModel () { Strings = new

Filter ListBox with TextBox in realtime

大憨熊 提交于 2019-11-30 14:49:06
I am trying to filter an listbox with text from a textbox, realTime. Here is the code: private void SrchBox_TextChanged_1(object sender, EventArgs e) { var registrationsList = registrationListBox.Items.Cast<String>().ToList(); registrationListBox.BeginUpdate(); registrationListBox.Items.Clear(); foreach (string str in registrationsList) { if (str.Contains(SrchBox.Text)) { registrationListBox.Items.Add(str); } } registrationListBox.EndUpdate(); } Here are the issues: When I run the program i get this error: Object reference not set to an instance of an object If I hit backspace, my initial list

Filter ListBox with TextBox in realtime

柔情痞子 提交于 2019-11-30 14:17:26
问题 I am trying to filter an listbox with text from a textbox, realTime. Here is the code: private void SrchBox_TextChanged_1(object sender, EventArgs e) { var registrationsList = registrationListBox.Items.Cast<String>().ToList(); registrationListBox.BeginUpdate(); registrationListBox.Items.Clear(); foreach (string str in registrationsList) { if (str.Contains(SrchBox.Text)) { registrationListBox.Items.Add(str); } } registrationListBox.EndUpdate(); } Here are the issues: When I run the program i

primefaces datatable rowedit not updating cell element

不想你离开。 提交于 2019-11-30 14:06:28
I have a datatable with rowedit. One column of my table is a cell with a listbox in, the items of the listbox are dynamically retrieved (depending on the value in another cell) I use rowEditInit to set the selectedrow item. And I want to update the listbox to retrieve the correct values. This does not work. When I do <p:ajax event="rowEditInit" listener="#{workOrderDetail.onEdit}" update="orderitemstable" /> Then when I click the pencil icon, the I can see the row switch to edit mode and retriving the listbox items. But it directly swithced back to non edit mode. But when I do <p:ajax event=

How to see if a widget exists in Tkinter?

依然范特西╮ 提交于 2019-11-30 13:59:20
Now, I know that you can check to see if a window exists by: x.winfo_exists() Which returns a Boolean. Now I have searched but haven't been able to find exactly what I need. More specifically I need to check the existence of my buttons, labels, list boxes, sliders etc. winfo_exists returns 1 unless you have destroyed the widget, in which case it returns 0. This method can be called on any widget class, not only the Tk root or Toplevels. Alternatively, you can get all the children of a widget with winfo_children : >>> import Tkinter as tk >>> root = tk.Tk() >>> label = tk.Label(root, text=

How do I add items to GWT ListBox in Uibinder .ui.xml template ?

余生长醉 提交于 2019-11-30 12:42:21
问题 How to add the listbox items using UiBinder? 回答1: This is a listbox of translations of an enumeration, I suppose this also works for a listbox with string values (version of GWT: 2.1.0) You only need the renderer for translating the enumeration values. //UI XML <g:ValueListBox ui:field="requesterType"/> //JAVA CODE @UiField(provided = true) ValueListBox<RequesterType> requesterType = new ValueListBox<RequesterType>(requesterTypeRenderer); static EnumRenderer<RequesterType>