itemssource

Update ListView's ItemsSource Constantly?

I have a ListView that I set it's ItemsSource to list all the Assignments (a table in my SQL Database, ORM is LINQ to SQL) like so: ltvAssignments.ItemsSource = _repo.ListAssignments(); (This bit of code is exactly after InitializeCompenent() is called) And for the heck of it, I added a sample: Assignment sample1 = new Assignment() ...

WPF Grid/WrapPanel AutoSize Animation

Hi, I have the following layout in WPF <grid> <row height=auto> <border> <listbox> <border? </row> <row height=*> <othercontent> </row> </grid> Using MVVM and have listbox itemsource bound. I am using a wrapPanel in the grid, and have scrolling disabled so the Grid row height will grow and shrink based on the list box contents. Thi...

Styling TabItem when populated with ItemsSource

Hi. I'm using a WPF Tabcontrol populated with a collection using Itemssource. <TabControl x:Name="_tabControl" ItemsSource="{Binding TabViewModelList}"> <TabControl.ItemContainerStyle> <Style TargetType="TabItem"> <Setter Property="Header" Value="{Binding TabCaption}"/> ...

WPF derived ComboBox SelectedValuePath issue

In our application we have a very large set of data that acts as our data dictionary for ComboBox lists, etc. This data is staticly cached and keyed off of 2 variables, so I thought it wise to write a control that derived from ComboBox and exposed the 2 keys as DPs. When those 2 keys have proper values I set the ItemsSource of the Comb...

How to create WPF listBox template

Hello, I've got an application, which uses many listBoxes with data attached to them using listBox.ItemsSource. The problem is it creates entries like [namespace].[class_name]. How can I create a template, which will replace entries with, eg. class "Name" field? I look forward to hear from you soon, MattheW ...

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. How can I add a large amount of ViewModels without making the UI Thread hang? I suppose ...

How to store an ItemsSource for an ItemsControl (ListBox, ComboBox) in the app.config?

After much research and trial and error I found how to store the items for a ListBox and ComboBox in the app.Config. I am heavily indebted to Jon Rista, who wrote a series of articles about the Net 2.0 Configuration classes. I constructed a (large!) code snippet that will generate all the code you need by just inserting three strings! En...

Binding list of objects to WPF ListView

Hi all, I have a list of objects which i want to bind to a ListView control in my WPF application. The Objects have a DataTemplate already, so no need to define that. The list of objects is a property in the codebehind file in the format list<object> When i add one object programatically, it appears fine. But when i try to bind the ItemS...

WPF BindingListCollectionView to ListCollectionView for DataTable as ItemsSource

Hi everyone, I want to do custom sorting on a ListView which has a DataTable as ItemsSource: myListView.ItemsSource = (data as DataTable); And this are the first lines of my sorting function: DataView view = (myListView.ItemsSource as DataTable).DefaultView; ListCollectionView coll = (ListCollectionView)CollectionViewSource.GetDefa...

MVVM Property for datagrid itemssource

I have a datagrid whose itemsSource is bound to a multiconverter which uses a converter. <toolkit:DataGrid AutoGenerateColumns="False"> <toolkit:DataGrid.ItemsSource> <MultiBinding Converter="{StaticResource ProfileConverter}"> <Binding ElementName="ComboBoxProfiles" Path="SelectedValue" /> ...

Trouble binding WPF Menu to ItemsSource

I would like to avoid having to build a menu manually in XAML or code, by binding to a list of ICommand-derived objects. However, I'm experiencing a bit of a problem where the resulting menu has two levels of menu-items (i.e. each MenuItem is contained in a MenuItem): My guess is that this is happening because WPF is automatically gen...

Binding DataTemplates (or another aproach)

Hi all, I'm having some troubles trying to dynamically generate content in WPF and after it bind data. I have the following scenario: TabControl - Dynamically generated TabItems through DataTemplate - inside TabItems, I have dynamic content generated by DataTemplate that I wish to bind (ListBox). The code follows: ::TabControl <Ta...

Problem in ListBox ItemTemplate binding using XML as itemssource

I'm having a bit o' trouble... Here is my "mappings.xml" file... <?xml version="1.0" encoding="utf-8"?> <mappings> <mapping QID="info1"> <empty></empty> </mapping> <mapping QID="info2"> <empty></empty> </mapping> </mappings> My method that loads the XML and sets it as the ItemsSource for the listbox: (Note: I didn't ...

SelectedValue explicit binding updates when ItemsSource change..why?

I have a ListBox with an Explicit binding set to SelectedValue. SelectedValue="{Binding Path=Property, UpdateSourceTrigger=Explicit}" the ItemSource of ListBox is an ObservableCollection. When I select an item of ListBox and press 'Enter' I update the property value in this way: BindingExpression be = listBox.GetBindingExpression(Li...

Difference between ItemsSource and DataContext as pertains to ListBox

I am not quite grokking the difference between ItemsSource and DataContext. Can someone explain it and back it up with examples? When would I use one or the other. I am reading the docs and it says that I can bind using DataContext, but I throw an ObservableCollection at it and nothing shows up in the list. If I throw the same collec...

WPF Merge ItemsSource Lists

I am working with a 2 lists in a backend class. Each list is a different type. Would like to present the user with a single list (containing a union of both lists) of which when an item in this list is selected the item's details appear. The code will look something like: My backend class looks somethings like this public ObservableC...

WPF - Best way to remove an item from the ItemsSource

Hi, 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,...

wpf datagridview combobox colmun ItemsSource binding problem

Hi, I cant seem to bind the datagridview's comboBoxColumn's ItemsSource Property the way I want. My Class hierachy used for this application is like this, I have a class called "PrescriptionViewModel" Inside it I have set the userControls (the view) data context to an object of "PrescriptionPresenter". Inside the "PrescriptionPresente...

Unreasonable WPF DataGrid Loading Time

I've always had long loading times with WPF DataGrids, and I cannot find any similar reports online, so I suspected that I was doing something wrong. Now I am sure of it, since adding layout complexity considerably slows down execution. In a very simple layout, the DataGrid populates instantaenously, whereas the code below takes around...

WPF, nothing shows up in ListBox

I don't know what I'm doing wrong here. I have a ListBox whose DataContext and ItemsSource are set, but there is nothing in the ListBox when I run my app. When debugging, the first line of my method for getting items for the ListBox never gets hit. Here's what I have: // Constructor in UserControl public TemplateList() { _templat...