combobox

wpf combobox selected item

I have a wpf app with a combobox like this <ComboBox name="cmbBx1"> <ComboBoxItem Name=Jan">January</ComboBoxItem> <ComboBoxItem Name=Feb">February</ComboBoxItem> </ComboBox> In the code behind I need to get the value of the item that was selected to pass to a stored procedure. I can get part of the way by doing this: ComboBoxIt...

WPF IsEditable=true ComboBox filled with objects displays the ToString() as the selected item

The Wpf combo box allows editing, and this is fine if all your combo box items are strings, or have a ToString() method defined on them. When you select an item, it is displayed as Text, it does not use a DataTemplate, it just calls ToString() on the item that is selected. I get a list of items in my combo drop down that are formatted...

WPF Combobox behavior weird

Hi guys, I have 2 comboboxes which we will call cbo1 and cbo2. Now, there is a relationship between cbo1 and cbo2. when i select an item at cbo1, the cbo2 ItemsSource is updated (since it is bound to the SelectedItem) anyway, below is the sample XAML code for it. <ComboBox x:Name="cbo1" Grid.Row="0" Grid.Column="1" Margin="5" SelectedIt...

Can't get Value from ComboBox

Hey, I have a simple comboBox with some Value/Text items in it. I have using ComboBox.DisplayMember and ComboBox.ValueMember to correctly set the value/text. When I try to get the value, it returns an empty string. Here's my code: FormLoad event: cbPlayer1.ValueMember = "Value"; cbPlayer1.DisplayMember = "Text"; SelectIndexChanged o...

Silverlight ComboBox source code

Where can I get the source code for this? I need to extend it. ...

Referencing a base types control template in xaml

I have a control derived from ComboBox, i want to use the ComboBox ControlTemplate, and just set a few values on it in xaml, namely the ItemContainerStyle. The code below doesnt work, the last setter, which im intending to apply the base ComboBox control template to this one, doesnt do anything. <Style TargetType="{x:Type local...

Sortable combo box with columns

Hi, I have a combo with more than one value in it (different bindings from the same source) I would like to create a combo box where the user could sort by those columns and also include a header to clarify the informations Example : Item No | Name | Rank 00 | foo | 0 01 | bar | 2 02 | too | 1 We could sort by Item ...

Silverlight - how do I get the text of the selected item in a combobox

Easy one for you all... I'm new to Silverlight and really missing stuff like DataTables and things. What I'm also currently struggling with is how to get the text of my combobox's currently selected item. In winforms I would have done: ComboBox myCombo = new ComboBox....... string selected = myCombo.Text; I'm struggling how to get th...

Custom .NET ComboBox control

Hey guys. I'm working in WinForms and trying to create a ComboBox control that hosts a ListView when it's dropped down. I'm using ToolStripDropDown and ToolStripControlHost to accomplish this. My problem is that i cannot display selected ListView item in the ComboBox when i set its DropDownStyle to DropDownList. Obviously this behavior...

WPF disable click on ComboBoxItem

I have a ComboBoxItem that acts strictly as a section title. Visually, I have it set but how do I eat the click when something is selected? I would prefer to accomplish this in xaml, if possible. TIA ...

WPF: PopUp on MouseOver of a ComboBoxItem

Does anyone know of an example of how to display a PopUp on MouseOver of a ComboBoxItem? TIA EDIT: I know how to create, style and position the PopUp but not how to display it! I may be retired. ...

Disabling/Disallowing items in ComboBox to be selected depending on selection ( C# )

I have two comboBoxes, one that lists the 7 days of the week and the other with a set of times (7 different times, each as a string). The problem i'm having is i want to be able to stop the user from being able to select certain items depending on the day/time selected. An example being that on a Monday the 7-9am comboBox option shoul...

CSharp .NET 3.5 Windows Form DataBinding ComboBox to a List<>

Hi there, Ok, firstly I have the following code working.. although my question is this; should I code the combobox databinding like the following example, or is there an easier/more efficient way? Firstly, I needed to manipulate the results back from the database to show a more descriptive meaning: (I am using a basic class for the ke...

Use ComboBoxItem text as value for a Property Setter

Hey guys! Here is the deal... I have a ComboBox defined in my window. The content of this comboBox, is only a string list with all values in Brushes class. Nothing special so far... But what I'm trying to achieve is a way to change the combobox background color when the user changes the color. The color would be the value selected in t...

how to tell is user selected the first index in a combobox in javascript

i have this code: $('#categories').change(function() { var myCars = new Array("Saab", "Volvo", "BMW"); addRowToTable(this.value, myCars); $('#listings').hide(); }); but i dont want it to call the addRowToTable method if the user selects the first item because the first element says "Plea...

SortDescriptions

Hi all, I'm using c# in combination of WPF. I've used an CollectionView with a single SortDescription. But in certain cases the SortDescription is not used. Yet I couldn't find out why this is happening. The combobox isn't sorted for some reason. When I add a second sortdescription with the same sorting option it also happens. No cv....

C# - how do I prevent mousewheel-scrolling in my combobox?

I have a combobox and I want to prevent the user from scrolling through the items with the mousewheel. Is there an easy way to do that? (C#, VS2008) ...

WPF: Eating a click on a ComboBoxItem

I have a ComboBoxItem [Line Color] that displays a PopUp on IsHighlighted and I want to eat the click on the ComboBoxItem. I know how to do it programmatically but I was wondering if there's any way to accomplish this in XAML? ...

C# binding a combobox to a growing list

WinForms, .NET 3.5 I have a ComboBox that needs to display a growing list of items -- there is a long running process fetching items, and I want to be able to display items to the user as they build up over time. Setting the DatSource property to a naive Array/List doesn't work since subsequent additions are not registered by the Combo...

WPF MVVM combobox update problem

Hi everybody! I 'm going mad!! Created a "MainVM" (VM stands for ViewModel) in which there is defined a SelectedItem of type "EditVM". There is also another property (let's call it) excavations (this is an app for archaeologists) and its corresponding excavationsCollectionView (hope the type is clear, to not get into details). This e...