combobox

Combobox selectedvalue

﹥>﹥吖頭↗ 提交于 2019-12-23 15:11:42
问题 I have a combobox on my form (winforms). In the properties I have set the DisplayMember and the ValueMember. DisplayMember = Name and ValueMember = ID. The Combobox is populated with the following objects: public class MyObj { public string Name { get; set; } public int ID { get; set; } } The Name displays fine in the dropdown(so DisplayMember is working) however, when I do: mycombobox.SelectedValue it is ALWAYS null. Does anyone know if I've forgotten to do anything? 回答1: Have you set the

How can I prevent auto-select in ComboBox on drop-down except for exact matches?

家住魔仙堡 提交于 2019-12-23 12:25:58
问题 I have a ComboBox that is part of a detail display related to a data grid containing rows from a database. No binding to the ComboBox exists, I am doing this manually. The ComboBox allows manual entry, as if it were a text field, while still providing a drop-down of choices. My issue is that if I have manually entered text in the field, and the drop-down is clicked, the ComboBox apparently wants to seek out a match. Also, it appears that the search is simple, so KG matches KG/Day . I must

Adding event listener to several comboboxes

旧城冷巷雨未停 提交于 2019-12-23 12:24:32
问题 I'm basically trying to display different sets of textboxes on a userform depending on the value taken by a combobox. I have created a class module called CControlEvents in which I describe the events that should occur when I change the value of the combobox : Private WithEvents mclsCbx As MSForms.ComboBox Private WithEvents UnitmclsTbx As MSForms.TextBox Private WithEvents UnitmclsTbxLabel As MSForms.Label Private WithEvents SpecMinMoymclsTbxLabel As MSForms.Label Private WithEvents

Show ComboBox group header for Silverlight

对着背影说爱祢 提交于 2019-12-23 12:22:45
问题 I want to show a ComboBox with OPTGROUP style header gruopings in Silverlight. Every website I find (including questions on SO) that sovle this link to an outdated link and, handily, show no code snippets for me to work from. E.g.: So how do I do this? 回答1: See my similar question: How to show group header for items in Silverlight combobox? I put dummy entries in collection source to indicate the group header and then modified DataTemplate to show the group headers in different way and normal

UWP change ComboBox position when opening

邮差的信 提交于 2019-12-23 12:15:57
问题 I have a ComboBox in c# XAML and when nothing is selected and the PlaceHolderText is shown and I click on it to open, the normal behavior is to open it in the middle. I want the dropdown to open on top instead. Let's say I have a ComboBox and fill it with the number 1-100 , then I want it to display beginning from 1 . If there are seven items shown in the dropdown, then the numbers 1-7 should be visible. Normal behavior would be showing the numbers 47-53 . An old workaround would be using a

adding text to a combobox with a datasource

做~自己de王妃 提交于 2019-12-23 10:09:56
问题 I have a vaadin combobox that is filled with a containerdatasource setContainerDataSource(container); I now want to insert a static text somewhere in the list of results. For example: A Combobox that is filled with a container of and the first entry that pops up in the result list is some kind of header: Persons: Thomas S. Lucas B. Alex X. Can i achieve that by either manipulating the container or the combobox? I just tried to set the container source and add a String/Label via addItem() to

Default value DataSource in ComboBox C#

跟風遠走 提交于 2019-12-23 10:07:08
问题 I have a ComboBox, and that is how I fill the data in it: SectorCollection sectorCollection = sectorController.SearchAll(); comboSector.DataSource = null; comboSector.DataSource = sectorCollection; comboSector.DisplayMember = "titleSector"; comboSector.ValueMember = "idSector"; What I want is to set a pre data, like a text in the combobox without a value. Like "Select a Sector." So the user can knows what does he is selecting. 回答1: If you are using a WinForm combobox then you should code

WPF Editable Combobox IsFocused problem

若如初见. 提交于 2019-12-23 08:50:06
问题 I am developing a Watermarked ComboBox by modifying the ComboBox ControlTemplate . Everything is fine when the ComboBox is not in an editable mode, but when I change the edit mode to True, the IsFocused property is never set to True. This is because in edit mode, the ComboBox is using a TextBox . This is an exact copy of this StackOverflow question: . There are no responses to that question. Please drop a line if you know how to solve this, or please point me to links that provide a Watermark

C# - How to set a ComboBox selectedItem from specific value?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 08:49:49
问题 I have this already populated ComboBox and all I want to do is to set it to a specific selectedItem knowing its value. I'm trying this, but nothing happens: comboPublisher.SelectedValue = livre.Editeur; Considering the fact that I already implemented Equals(..) method in my class Editeur, this way: public bool Equals(IEditeur editeur) { return (this.Nom == editeur.Nom); } This is how I populate my ComboBox: foreach (Business.IEditeur editeur in _livreManager.GetPublishers()) { comboPublisher

WPF datagrid combobox column: how to manage event of selection changed?

前提是你 提交于 2019-12-23 08:30:09
问题 I have a datagrid, with a combobox column <DataGridComboBoxColumn x:Name="DataGridComboBoxColumnBracketType" Width="70" Header="Tipo di staffa" SelectedValueBinding="{Binding type, UpdateSourceTrigger=PropertyChanged}"> </DataGridComboBoxColumn> I want an event that is fired only when the user changes the value into the combobox. How can I resolve this? 回答1: I found a solution to this on CodePlex. Here it is, with some modifications: <DataGridComboBoxColumn x:Name="Whatever">