itemssource

How to get cell level ComboBox for WPF DataGrid?

帅比萌擦擦* 提交于 2019-11-29 10:49:40
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 event. However, it doesn't work as desired. Initially, all cells in this column is empty. Once I populate the ItemsSource for this column's ComboBox, all related cells (with the same items source) are showing values. However, if I click another type of cell (a different items source is populated), all values disappear and the new type cells show values

Bind DataGridTextColumn Visibility Property in WPF

那年仲夏 提交于 2019-11-29 05:16:00
I have a datagrid whose ItemsSource binds to a CollectionViewSource . In each column I specify the Path property of the binding to get the specific information to display. What I'd like to do is toggle some of the columns with a checkbox if the user wants more info. To do this, I need to bind the visibility property to the value of the checkbox (with a converter) but I'm pretty sure the data context of the column is interfering with the binding. <DataGrid ItemsSource="{Binding Source={StaticResource cvs}}" ....> <DataGrid.Columns> <DataGridTextColumn Header="First Name" Binding="{Binding Path

WPF - Best way to remove an item from the ItemsSource

我们两清 提交于 2019-11-29 04:52:46
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 databound. So I have to remove it from the ItemsSource , which can be anything ( ICollection , DataTable , DataSourceProvider ...). In the context of my application, I know what the actual type of the ItemsSource will be, but I want that control to be more generic so that I can reuse it later. So I'm looking for a way to remove an item from a data source,

ItemsControl.ItemsSource MVVM performance

孤人 提交于 2019-11-29 04:01:16
问题 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. How can I add a large amount of ViewModels without making the UI Thread hang? I suppose the UI Thread hangs because each time a new item is added the ItemsControl needs to update itself and does layout etc. over and over again. Should I suspend

Why are DataContext and ItemsSource not redundant?

烂漫一生 提交于 2019-11-28 17:13:29
In WPF Databinding, I understand that you have DataContext which tells an element what data it is going to bind to and ItemsSource which "does the binding". But e.g. in this simple example it doesn't seem that ItemsSource is doing anything useful since, what else would you want the Element to do to the DataContext except bind to it ? <ListBox DataContext="{StaticResource customers}" ItemsSource="{Binding}"> And in more complex examples of ItemsSource , you have Path and Source which seems to be encroaching on the territory of DataContext . ItemsSource="{Binding Path=TheImages, Source=

How to get cell level ComboBox for WPF DataGrid?

故事扮演 提交于 2019-11-28 04:03:59
问题 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 event. However, it doesn't work as desired. Initially, all cells in this column is empty. Once I populate the ItemsSource for this column's ComboBox, all related cells (with the same items source) are showing values. However, if I click another type

WPF - Best way to remove an item from the ItemsSource

老子叫甜甜 提交于 2019-11-27 22:33:28
问题 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 databound. So I have to remove it from the ItemsSource , which can be anything ( ICollection , DataTable , DataSourceProvider ...). In the context of my application, I know what the actual type of the ItemsSource will be, but I want that control to be

Bind DataGridTextColumn Visibility Property in WPF

自闭症网瘾萝莉.ら 提交于 2019-11-27 19:01:36
问题 I have a datagrid whose ItemsSource binds to a CollectionViewSource . In each column I specify the Path property of the binding to get the specific information to display. What I'd like to do is toggle some of the columns with a checkbox if the user wants more info. To do this, I need to bind the visibility property to the value of the checkbox (with a converter) but I'm pretty sure the data context of the column is interfering with the binding. <DataGrid ItemsSource="{Binding Source=

Display properties of the ListBox.ItemsSource

隐身守侯 提交于 2019-11-27 16:14:22
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 (Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem). Is there a way to make the list display WorkItem.Title? You have two options. The simplest method is to set the DisplayMemberPath property of your ListBox to "Title". If you want to set not only what gets displayed, but the type of control that is used to display it, then you would set the ListBox's ItemTemplate . For what your goal

Why are DataContext and ItemsSource not redundant?

非 Y 不嫁゛ 提交于 2019-11-27 10:17:50
问题 In WPF Databinding, I understand that you have DataContext which tells an element what data it is going to bind to and ItemsSource which "does the binding". But e.g. in this simple example it doesn't seem that ItemsSource is doing anything useful since, what else would you want the Element to do to the DataContext except bind to it ? <ListBox DataContext="{StaticResource customers}" ItemsSource="{Binding}"> And in more complex examples of ItemsSource , you have Path and Source which seems to