itemssource

Why does this simple databinding scenario not work? (ComboBox related)

Hi all, I've been scratching my head on this one for a while now and am stumped at the moment. The problem scenario is easier to explain as code so hopefully it speaks for itself. First of all, I have a silverlight application with the following in the XAML... <UserControl x:Class="SilverlightApplication2.Page" xmlns="http://schemas.m...

Is my ItemsSource syntax ok?

I have the following XAML. Let's say FruitList is a collection of Fruits, each of which has a collection of FruitSeeds. Is there a syntax to bind cbxFruitSeeds to a collection of FruitSeeds, depending on which Fruit is selected in cbxFruits? <GridView> <GridViewColumn Header="Fruits"> <GridViewColumn.CellTemplate> ...

WPF Databinding in XAML

Hello I have little problem with databinding in my current project. I have an ObservableCollection I want to bind to an ListBox. public ObservableCollection<GeoDataContainer> geoList = new ObservableCollection<GeoDataContainer>(); ...later... geoListBox.ItemsSource = geoList; This code works fine. The Listbox has a datatemplate an...

How to manually add data to a DataGrid in Silverlight

I have found that datagrid columns can be dynamically created and bound in Silverlight. However I can't find a way to bind data to those columns. If I try to bind any type of object with AutoGenerateColumns = true, then the names of each property of the object get added as columns and the object information is displayed in the grid in a...

ItemsSource + Converter + Treeview wont update

This one is fairly complex, hopefully I can make this clear enough for somebody to help me out. I have an object lets call it a Manager, the Manager has a collection of people that he manages, the people all implement IPerson, but different types of people have different properties. I want to display this manager in a tree, and under the...

WPF - Multibinding from Two Sources inside the ListBox DataTemplate

Hello everyone, I tried to look around to see if I am missing something basic, but I can't seem to understand what I am doing wrong. I have a listbox where I would like to bind the itemssource to a collectionview of photos from a dataset. The problem is, I need to take the directory where the images exist from the MasterView Collectio...

What should Binding Path property be set to?

Hi All, Assuming I have this struct definition in C#: public struct TimeSlotInfo { public int TimeSlotID; public int StartMin; public int CalcGridColumn; public string BackgroundCol; public bool ToDisable; } And I have a linq query as so: var TimeSlotsInfo = from ts in datacon.TimeSlots select new TimeSlotInfo { Ti...

Binding ItemsSource to a "proxy" collection. How to get DataContext?

We've got a Silverlight application with several listboxes and comboboxes that display data sorted incorrectly, which I need to fix. Most of their ItemSource properties are set through XAML. Their DataContext may not be set directly on the control, and instead were set on a parent. So I can't easily slap an "OrderBy" on the ItemSource or...

C# WPF datagrid: ItemsSource

I want to know how you can modify properties of columns of a WPF toolkit datagrid once the ItemsSource has been set (it is set in XAML)? For example I want to make a specific column have the property IsReadOnly equal to true. So basically there are two things I want to know: -How can I get access to a specific column once the ItemsS...

WPF DataContext vs ItemsSource Performance

Hi! Suppose we have an ItemsControl, which is bounded to a source. Is there any performance difference between ItemsControl.DataContext = resultSet; and ItemsControl.ItemsSource = resultSet; (In both cases correctly binded in XAML) ...

Strange XAML MenuItem DataBound ItemsSource Refresh Issue after empty ItemsSource

I have a XAML MenuItem DataBound ItemsSource that is working fine however there is a small issue. When I view the MenuItem and there is no databound items the ParentMenu will be disabled and it appears fine without binding errors (as expected the ItemsSource is empty). If the ObservableCollection is modified and an item added, the bind...

I have some performance related questions about Silverlight Enterprise app development.

I have some performance related questions about SL Enterprise app development. -We have 10.000 rows binding to an ItemsSource control. (A total of 100.000+ UIElements when databound) Q1.How to do this binding in another thread? Because Silverlight gets stuck while the binding happens. Q2.Any other ways to do this that you suggest wit...

WPF DataGrid: DataGridComboxBox ItemsSource Binding to a Collection of Collections

Situation: I've created a DataGrid in XAML and the ItemsSource is binded to an ObservableCollection of a certain class that contains properties. Then in C#, I create a DataGridTextColumn and a DataGridComboBoxColumn and binded these to the properties of the objects inside the ObservableCollection. I can bind the DataGridComboBoxColumn...

Silverlight 3: Using list of UserControls as ItemsSource for TreeView

I want to populate a TreeView with UserControls, but I only want the Name property to show up, not the entire UserControl. The following code gives me weird crashes as soon as I add something to myUCs: C#: var myUCs = new ObservableCollection<UserControl>(); MyTreeView.ItemsSource = myUCs; XAML: <controls:TreeView x:Name="MyTreeView...

IsSynchronizedWithCurrentItem attribute and current item updates

Hello I have a view model to manage a dialog type of view that allows filtering of a listing (if necessary) and selection of an item. The code works fine whether I set IsSynchronizedWithCurrentItem to true or not. My understanding is that this property is not true by default in a ListView, so I'd like to better understand this property....

Set ItemsSource of a ComboBox to an Array of Integers?

Set ItemsSource of a ComboBox to an Array of Integers? ...

WPF - Bound treeview not updating root items

I'm using a WPF TreeView control, which I've bound to a simple tree structure based on ObservableCollections. Here's the XAML: <TreeView Name="tree" Grid.Row="0"> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Path=Children}"> <TextBlock Text="{Binding Path=Text}"/> </Hierarc...

Applying MVVM to an ItemsControl populated with UserControls

As I knock off more and more MVVM-related issues with my current application, more just keep popping up. :) The current implementation that I am trying to replace involves a StackPanel whose children are more or less dynamically generated (via looking in a configuration file). Each child is an instance of a UserControl. Before, what ...

HierarchicalDataTemplate when ItemsSource is not a collection

I am trying to define a HierarchicalDataTemplate. The ItemsSource I want to bind to will only ever have one item in it so I don't want it to be a collection, just a single item. How do I do this as it will only work if the path of ItemsSource points to a collection? ...

WPF ComboBox a better way to format ItemsSource

Morning Guys, I have a few ComboBoxes bound to List of TimeSpan. I am formatting the TimeSpans using IValueConverter and ItemTemplate. I was wondering if there were an easier way to format the TimeSpans. Here's what I'm currently doing. public class TimeSpanConverter : IValueConverter { #region IValueConverter Members public o...