Questions tagged [selecteditem]

selecteditem is a property used to identify the currently selected item in a collection

selecteditem is used to check the state of the associated UI control in several APIs

References

1008 questions
28
votes
8 answers

ComboBox ItemsSource changed => SelectedItem is ruined

Ok, this has been bugging me for a while now. And I wonder how others handle the following case: The DataContext object's code: public ObservableCollection
Jefim
  • 3,017
  • 4
  • 32
  • 50
25
votes
8 answers

WPF Datagrid set selected row

How do I use the Datagrid.SelectedItem to select a row programmatically? Do I first have to create a IEnumerable of DataGridRow objects and pass the matching row to this SelectedItem property or how do I do it? EDIT: I need to match the cell content…
Tony The Lion
  • 61,704
  • 67
  • 242
  • 415
22
votes
4 answers

WPF ComboBox SelectedItem - change to previous value

I have a ComboBox that has the SelectedItem bound to the ViewModel. When the user selects a new Item in the View ComboBox, I want to display a prompt and…
Rob Buhler
  • 2,469
  • 4
  • 27
  • 35
22
votes
4 answers

Select item programmatically in WPF ListView

I'm unable to figure out how to select an item programmatically in a ListView. I'm attempting to use the listview's ItemContainerGenerator, but it just doesn't seem to work. For example, obj is null after the following operation: //VariableList is…
Paul Prewett
  • 2,003
  • 3
  • 23
  • 35
21
votes
5 answers

Get Selected TreeViewItem Using MVVM

So someone suggested using a WPF TreeView, and I thought: "Yeah, that seems like the right approach." Now, hours and hours later, I simply can't believe how difficult it has been to use this control. Through a bunch of research, I was able to get…
Bob Horn
  • 33,387
  • 34
  • 113
  • 219
17
votes
1 answer

How to get selected option using Selenium WebDriver with Python?

How to get selected option using Selenium WebDriver with Python: Someone have a solution for a getFirstSelectedOption? I'm using this to get the select element: try: FCSelect = driver.find_element_by_id('FCenter') self.TestEventLog =…
Mattman85208
  • 1,858
  • 2
  • 29
  • 51
17
votes
3 answers

WPF Listview Access to SelectedItem and subitems

Ok, I am having more problems with my C# WPF ListView control. Here it is in all its glory:
Dave
  • 1,065
  • 2
  • 10
  • 16
16
votes
1 answer

wpf: how to make ComboBoxItems hold integers in xaml

ok, I must be having a brain freeze here... I have a ComboBox with 6 items and I'm trying to bind the selected item to an integer value. Its not working, I suspect its because the ComboBoxItem's are strings. I don't feel like making a list in code…
Shaboboo
  • 1,347
  • 1
  • 16
  • 35
14
votes
2 answers

WPF ListBox - Getting UIElement instead of of SelectedItem

I created a ListBox that has a DataTemplate as Itemtemplate. However, is there an easy way to access the generated UIElement instead of the SelectedItem in codebehind? When I access SelectedItem, I just get the selected object from my ItemsSource…
Joachim Kerschbaumer
  • 9,695
  • 7
  • 49
  • 84
14
votes
2 answers

Mvvm-Light Silverlight, using EventToCommand with a Combobox

I've hooked up a ComboBox's SelectedItemChangeEvent to a ICommand in my view model. Everything seems to be working fine however I do not know how to get the SelectedItem of the ComboxBox. I think I need to use the CommandParameter of the…
handles
  • 7,639
  • 17
  • 63
  • 85
14
votes
6 answers

Programmatically set ComboBox SelectedItem in WPF (3.5sp1)

I have been confused while setting SelectedItem programmaticaly in wpf applications with Net Framework 3.5 sp1 installed. I have carefully read about hundred posts \topics but still confused(( My xaml:
Victor
  • 177
  • 1
  • 1
  • 6
14
votes
3 answers

Set SelectedItem on a combobox bound to datasource

List _customers = getCustomers().ToList(); BindingSource bsCustomers = new BindingSource(); bsCustomers.DataSource = _customers; comboBox.DataSource = bsCustomers.DataSource; comboBox.DisplayMember = "name"; comboBox.ValueMember =…
mdc
  • 1,161
  • 6
  • 22
  • 37
13
votes
2 answers

WPF - Combobox SelectedItem not getting set?

I have a ComboBox that has its ItemsSource bound to a static List of options. The ComboBox is part of a form which is bound to a CustomObject class, and one of the properties on that class is a CustomSettingProperty. I would like to…
Rachel
  • 130,264
  • 66
  • 304
  • 490
13
votes
3 answers

WPF ListView SelectedItem is null

I have a Listview that has a checkbox as one of the columns. If I click anywhere but the actual checkbox the SelectedItem of the ListView is set to the current selected row, as expected. If, on the other hand I click onto the checkbox (without…
ozczecho
  • 8,649
  • 8
  • 36
  • 42
13
votes
5 answers

Reset combobox selected item on set using MVVM

I am using a ComboBox in my WPF application and following MVVM. There is a list of strings which I want to show in my ComboBox. XAML: View Model: public…
fhnaseer
  • 7,159
  • 16
  • 60
  • 112
1
2
3
67 68