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
8
votes
1 answer

Unselect all items when the SelectedItem is bound to something that doesn't exist in the list

I have two lists with different ItemsSource but with SelectedItem bound to the same property - "Name". First i'm choosing the item "c" in the right list so the item "c" in the left list is selected as well. Than I selected another item in the right…
Erez
  • 6,405
  • 14
  • 70
  • 124
8
votes
4 answers

WPF ListView Show selected item

I want to show the selected item in a list view automatically(it isn't possible to show all items without scrolling). this.listView.SelectedIndex = 999; selects of course an item, but it doesn't show it. what can I use to show it automatically…
Jeffrey
  • 1,392
  • 4
  • 11
  • 18
7
votes
4 answers

Remove SelectedItem from TreeView

Is there a simple way to set a TreeView's SelectedItem to null or equivalent? Also, I need to do this in C# and not in XAML. Best regards, Gabriel
Gabriel
  • 464
  • 1
  • 5
  • 17
7
votes
2 answers

Set background color for selected items in a ListBox

I cannot set the background color for the selected item on a list box. I don't want the alternating colors in this example. I put them in as a test and they work. Trigger IsSelected is firing as the fontweight goes to bold and the foreground goes…
paparazzo
  • 44,497
  • 23
  • 105
  • 176
7
votes
1 answer

DataGridComboBoxColumn loses its content when selection changes

When I click a cell in my DataGridComboBoxColumn the ComboBox gets visible and I can select items. When I have selected an item its visible at the top thats fine. But when the cell aka ComboBox loses its focus because I click something different in…
msfanboy
  • 5,273
  • 13
  • 69
  • 120
7
votes
1 answer

Getting ValueMember from selected item in a ListBox with C#

I'm trying to get all the selected items ValueMember from a ListBox with C#. For ex.: I've a list like this: ID | Name and Lastname ---------------------- 1 | John Something 2 | Peter Something2 3 | Mary Smith This structure is part of my…
Lucas
  • 383
  • 1
  • 5
  • 17
7
votes
7 answers

WPF ComboBox SelectedItem

Ok been working with WPF for a while but I need some help. I have a ComboBox like below:
Jose
  • 10,891
  • 19
  • 67
  • 89
7
votes
1 answer

WPF Binding SelectedItem in DataGrid

So, I have a TabControl binded to a list of projects (each tab is a one project) - that works fine. The content of each tab is a DataGrid with a list of project's employees - that works fine as well. Now, I want to show some information on employee…
kcz
  • 71
  • 1
  • 1
  • 4
7
votes
1 answer

How do I get the selected item from a Gridview with ImageAdapter? (Android)

I had used a ListView to show some data (String) retrieved from the database...quite simple, but one of my cooworkers decided to put an image in front of the text in the screen. We were not able to do it with Listview, but we found some example with…
user1419496
  • 73
  • 1
  • 1
  • 4
7
votes
2 answers

Confused about CollectionViewSource (SelectedItem not working in combos)

I have a bunch of combos that all share the same available choices. These choices are provided in a collection exposed from my ViewModel. All fine and dandy. I now want these choices sorted, so I decided to expose an ICollectionView from my…
GazTheDestroyer
  • 20,722
  • 9
  • 70
  • 103
6
votes
2 answers

How do I highlight a treeview selected item with some color?

I have a treeview in WPF. I want a different color when i select the treeviewitem.
ibrahimkhan
6
votes
1 answer

how to select and de-select an item in RecyclerView? How to Highlight selected item only in recycler view?

@Override public void onBindViewHolder(final mainscreenspecializationadap.MyViewHolder holder, final int positionz) { this.position = holder.getAdapterPosition(); final specializationpojo album =…
6
votes
5 answers

getItemAtPosition() How to get readable data from the selected item in a ListView

I have a listView of contacts that I got from the Android ContactManager sample. This list is showing up fine, but I can't figure out how to get info from the selected item, like "name" and "phone number". I can get the selected position, but the…
b-ryce
  • 5,752
  • 7
  • 49
  • 79
6
votes
1 answer

Trigger for TabItem.IsSelected doesn't work

I want to have selected tab background set to red and unselected to green. However only unselected tab is colored on green when changing. Selected remains white.
stanwar
  • 181
  • 1
  • 8
6
votes
2 answers

WPF How to change the listbox selected item text color when the list box loses focus

I've been searching for how to change the text color of a selected item in a list box that has lost focus.