Questions tagged [itemssource]

374 questions
9
votes
3 answers

WPF: How do I hook into a ListView's ItemsSource CollectionChanged notification?

I have a ListView that is databound to an ObservableCollection ... I can't seem to find any event that are triggered when the collection changes, so I'm thinking that somehow I need to hook…
9
votes
3 answers

Change ListBox.ItemsSource Binding property on Button.Click?

Quick question... I have a ListBox with its ItemsSource property bound to a collection property in a viewmodel like so: I also have two Button objects in the same…
Sheridan
  • 68,826
  • 24
  • 143
  • 183
9
votes
3 answers

ListBox.ItemsSource binding in code and in xaml

I wrote simple code like public ObservableCollection Names … public Window1() { PutInDataIntoNames(); InitializeComponent(); this.listBox1.ItemsSource = Names; } and in xaml
Kirill Lykov
  • 1,293
  • 2
  • 22
  • 39
9
votes
1 answer

Binding multiple ComboBoxes to the same ItemsSource causes problems

I have 2 ComboBoxes whose ItemsSource is bound to the same ObservableCollection: public ObservableCollection MyTypeCollection { get; set; } I have defined 2 different SelectedItem properties which in turn are bound to the correct…
DeMama
  • 1,134
  • 3
  • 13
  • 32
8
votes
3 answers

How to get the current 'item' in an ItemsSource binding

I have a user control that has one dependency property. In my window I have a list of objects, and I am creating a uniform grid consisting of my user control. I am setting the ItemsSource to my list of objects, but I need to pass each respective…
Sherlock
  • 5,557
  • 6
  • 50
  • 78
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
7
votes
2 answers

WPF DataGrid ItemsSource Binding Issue

I have a DataGrid in a WPF application that binds itself to an ObservableCollection of objects, and everything works fine. Now if I modify a cell in the datagrid during runtime, and delete the content, leave the cell empty. The…
Ling Xing
  • 181
  • 2
  • 14
7
votes
2 answers

WPF: Setting ItemSource in XAML vs. code-behind

Since this is WPF, it may look like lots of code, but don't be frightened, the question is really simple! I have the following XAML:
Deniz Dogan
  • 25,711
  • 35
  • 110
  • 162
7
votes
3 answers

Set ItemsSource of a ComboBox to an Array of Integers?

Set ItemsSource of a ComboBox to an Array of Integers?
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
6
votes
1 answer

Custom collection crashes DataGrid on Edit

Im currently trying to bind the DataGrid.ItemsSource to a custom RowCollection, which implements IList and INotifyCollectionChanged: Public Class RowCollection(of T) Implements IList(Of T) Implements INotifyCollectionChanged Private _List As…
Federico Berasategui
  • 43,562
  • 11
  • 100
  • 154
6
votes
2 answers

How to get cell level ComboBox for WPF DataGrid?

It looks WFP DataGridComboBoxColumn is using a single ItemsSource for all cells in this column. I have a case where the ComboBox items are dependent on the other cell in the same row. I managed to populate the ItemsSource in PreparingCellForEdit…
newman
  • 6,841
  • 21
  • 79
  • 126
6
votes
4 answers

WPF - Best way to remove an item from the ItemsSource

I'm writing a custom ItemsControl (a tabbed document container), where each item (tab) can remove itself from the UI when the user closes it. However, I can't remove it directly from the ItemsControl.Items collection, because the items can be…
Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758
6
votes
2 answers

ItemsControl.ItemsSource MVVM performance

I have an (non-virtualized) ItemsControl that binds its ItemsSource to a ObeservableCollection of ViewModel instances. Now once the large amount Model instances is loaded all the ViewModel complemnents needs to be added to that ObservableCollection.…
bitbonk
  • 48,890
  • 37
  • 186
  • 278
6
votes
2 answers

Display properties of the ListBox.ItemsSource

I am new to WPF. I have a ListBox that has its ItemSource set to a instance of WorkItemCollection. (A collection of WorkItem objects.) When the list is displayed it only displays the type of each object…
Vaccano
  • 78,325
  • 149
  • 468
  • 850
6
votes
2 answers

WPF DataGrid ItemsSource Issue

Please let it be known that I am relatively new to WPF. I am creating a new ObservableCollection with the type of my simple data class, and assigning that to the ItemsSource property of my DataGrid. Before I go into my problem here is the…
Logan B. Lehman
  • 4,867
  • 7
  • 32
  • 45
1
2
3
24 25