listbox

How to add Double Click mouse event to listbox?

回眸只為那壹抹淺笑 提交于 2019-11-29 16:49:26
I would like to add a double click mouse event to a listbox. When I double click an item I'd like to get the specific item and assign a method. I have been searching for tuturials in this field, but tried but somehow wasn't working. Thank you for helping ! <%@ Page Language="C#" %> <script runat="server"> void Page_Load(Object sender, EventArgs e){ if(Request.Params["ListBox1Hidden"] != null && (string)Request.Params["ListBox1Hidden"] == "doubleclicked" { //This means It was double click Response.Write("Double Click was fired selected item is " + ListBox1.SelectedItem.Text); } } void Button1

Items in ObservableCollection<string> do not update when bound to a WPF ListBox

时光毁灭记忆、已成空白 提交于 2019-11-29 16:31:46
I should like to manipulate an ObservableCollection of string s by binding it to the ItemsSource property of a ListBox and setting the item template to a TextBox . My problem is that the items in the ObservableCollection do not get updated when I edit them in the TextBox items that the ListBox contains. What am I doing wrong? The XAML of the minimum working example is <Window x:Class="ListBoxUpdate.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ListBoxUpdate" Height="300" Width="300" > <Grid> <Grid

How to get Selected items in WPF CheckBox ListBox

不问归期 提交于 2019-11-29 16:24:41
Am Using the checkbox in listbox items, how to get the selected checkboxes from the list <ListBox ItemsSource="{Binding NameList}" HorizontalAlignment="Left" Margin="16,68,0,12" Name="listBox1" Width="156" IsEnabled="True" SelectionMode="Multiple" Focusable="True" IsHitTestVisible="True" IsTextSearchEnabled="False" FontSize="12" Padding="5" SelectionChanged="listBox1_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <CheckBox Content="{Binding Path=CNames}" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> I tried to loop thru the

How to create a picklist in JSF? Tried moving items using JS/jQuery, but submit errors with “Validation Error: Value is not valid”

丶灬走出姿态 提交于 2019-11-29 16:09:34
I am creating web application using JSF 2.0 where I am assigning users to view projects. For that I have two list. First list that have users who are not assigned that project and list B have users who have assigned that project. And we can interchange the data. Code I have is <t:selectManyListbox id="sourceCars" style="width: 40%;" value="#{PersonalInformationDataBean.listOfUsers}" size="10"> <t:selectItems value="#{PersonalInformationDataBean.showAllMyRemData()}" var="t" itemLabel="#{t.title}" itemValue="#{t.status}"/> </t:selectManyListbox> <span> <input type="button" value=" >> " id=

How to get the last selected item in multiselect ListBox?

泪湿孤枕 提交于 2019-11-29 15:34:42
How to get the last selected item in a .Net Forms multiselect ListBox? Apparently if I select an item in the listbox and then select another 10 the selected item is the first one. I would like to obtain the last element that I selected/deselected. I would take this general approach: Listen for the SelectedIndexChanged event and scan through the SelectedIndices collection every time. Keep a separate list of all selected indices, appending ones that have not been in the list, removing those that have been de-selected. The separate list will contain the indexes in the chronological order they

Loading text file into listbox

夙愿已清 提交于 2019-11-29 15:15:31
What I am wanting to achieve is loading a text file into a listbox. It seems simple enough but I need to recognise in the text file when there is a new line, and each new line needs to be a new item in the listbox. If this is possible, a reply would be much appreciated. This will work List<string> lines = new List<string>(); using (StreamReader r = new StreamReader(f)) { string line; while ((line = r.ReadLine()) != null) { lines.Add(line); } } OpenFileDialog f = new OpenFileDialog(); if (f.ShowDialog() ==DialogResult.OK) { listBox1.Items.Clear(); List<string> lines = new List<string>(); using

Drag and drop from list to canvas on windows phone with MVVM

那年仲夏 提交于 2019-11-29 14:35:49
I have an app where a user can manipulate around with elements chosen from a list, this is done by clicking the list element and the element is added to a canvas. During a user testing of the app. People found it not to be intuitive since they wanted drag and drop. I have found several links describing how to implement this for WPF, i.e. not for windows Phone. Trying to replicate the code from a msdn project i ended up with problems that I cannot get the same information about the elements from DragEventArgs. So what I want to accomplish is user can drag an element in a listbox to a canvas. I

Deselection on a WPF listbox with extended selection mode

醉酒当歌 提交于 2019-11-29 14:11:05
I have a simple listbox with extended selection mode. Selection works almost perfectly fine like it works in explorer. But deselection doesn't really work all that well. What I want is that when I click on something outside the range of elements in the listbox I want all elements to be deselected. I doesn't seem to behave that way by default and I did a dirty hack involving selectionchanged and mouseup to hack it up. But there has to be a better way. Any ideas? It isn't that dirty to add in the deselection functionality, and you're on the right track. The main issue is that by default the

How do I get at the listbox item's “key” in c# winforms app?

瘦欲@ 提交于 2019-11-29 13:55:51
I am writing a winforms app in which a user selects an item from a listbox and edits some data that forms part of an associated object. The edits are then applied from the object list to an underlying file. In ASP.Net assigning a different system value to a list item than the display text the user sees is trivial. In a winforms app you have to set the "Displaymember" and the "Valuemember" of each item in a slightly more complicated (and not oft related on the internet) process. This I have done. In debug mode I have confirmed that every item now has a value which is the display member (a

WPF ListBox not updating with the ItemsSource

风流意气都作罢 提交于 2019-11-29 13:46:23
I have what I believe should be simple two-way databinding in WPF setup, but the listbox (target) is not updating as the collection changes. I'm setting this ItemsSource of the ListBox programmatically: lstVariable_Selected.ItemsSource = m_VariableList; And the ListBox is declared as follows: <ListBox Margin="5" Name="lstVariable_Selected"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel Orientation="Horizontal"/> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <Border BorderBrush="Gray" BorderThickness="1" Margin="0"> <TextBlock FontSize="25