Questions tagged [itemssource]

374 questions
0
votes
0 answers

How to populate WPF Datagrid with Linq to SQL

Hi so i'm using linq to sql through table mapping. Which works. But as I'm new to C# as well as WPF I seem to be incapable of finding a way to populate a datagrid with IQueryable. My Query looks like this. var STL = new…
WouldBeNerd
  • 629
  • 11
  • 29
0
votes
1 answer

Binding to a new IENumerable declared in XAML NOT CodeBehind

The XAML below is incorrect, but it represents what I'm trying to do. I'm fairly new to WPF, but I want to know if something like this doable without instead declaring the instance in the code behind?
Interminable
  • 1,338
  • 3
  • 21
  • 52
0
votes
0 answers

ComboBox or Mahapps dropdownbutton doesn't update when once opened

I've create a dummy WPF application with a dropdownbutton from Mahapps (called ddbTest) and a button (called btnAddExtra) Update: The same issue occurs when using a combobox instead of a dropdownbutton. This is the code behind: public List
Gert Hermans
  • 769
  • 1
  • 9
  • 30
0
votes
1 answer

DependencyProperty Setter called After OnItemsSourceChanged

I need to access some Data when my ItemsSource changes so that I can correctly generate columns and bind in my DataGrid. To do this I need to bind different templates and choose them (Unfortunately CellTemplateSelector doesn't really work for me in…
Asheh
  • 1,547
  • 16
  • 25
0
votes
0 answers

Why is binding this DataGrid's ItemsSource to collection of anonymous types not working?

I have a collection of anonymous types that I wish to bind to the ItemsSource property of a DataGrid. I confirmed the collection has items, but my DataGrid is empty. I created a Debug converter and it does not hit my breakpoint in there so it…
Ashley Grenon
  • 9,305
  • 4
  • 41
  • 54
0
votes
1 answer

Why an exception when I add a DataGridCell style?

The following xaml gives the exception: "Items collection must be empty before using ItemsSource." In code behind we have simply: public MainWindow() { InitializeComponent(); DataContext = Customers; Customers.Add(new Customer {…
Gerard
  • 13,023
  • 14
  • 72
  • 125
0
votes
1 answer

Dynamic MenuItems with ItemsSource in xaml?

I'm crap atn english, so sorry.. I'm trying to create dynamic menu items that display something based on a collection (a list of object), here is my xaml, you can see the "ListBox" and the "MenuItem". As I said, I'm binding the header to the "name"…
user4291973
  • 55
  • 2
  • 8
0
votes
2 answers

Xaml Set SelecteIndex on itemSource updated on combobox

I want every time my itemssource of my combobox is changed, that the SelectedIndex is set. I have this so far: It sets the…
Patrick
  • 621
  • 2
  • 7
  • 21
0
votes
1 answer

How to get Items from ItemsSource?

I am using a custom control that has an ItemsSource. I have bound the ItemsSource to a CollectionViewSource in XAML. That CollectionViewSource is bound to a List. Now I want to get all the Items from the ItemsSource but that control doesn't have a…
0
votes
1 answer

Unselect WPF DataGrid when ItemsSource changed

I have the following DataGrid in WPF :
Lucifer
  • 2,317
  • 9
  • 43
  • 67
0
votes
1 answer

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!)…
Dabblernl
  • 15,831
  • 18
  • 96
  • 148
0
votes
2 answers

DataGrid don't update after changing the ItemsSource

I have a data grid which I binded to a ObservableCollection object. On an event, I clear the ObservableCollection and add new items to it. When finished, I try to update the DataGrid, but it still shows the old rows. What am I doing wrong? This is…
Smadar
  • 31
  • 1
  • 4
0
votes
2 answers

Stack Overflow while binding DataGrid WPF

I am trying to bind a ObservableCollection to DataGrid. CODE private void LoadData_Loaded(object sender, RoutedEventArgs e) { ObservableCollection LoadDataSet = new ObservableCollection(); var items = new…
0
votes
1 answer

WinPhone C# Send Id to a window with selector.SelectedItem

Hi i gave a list (named source) of objects (dog(Id, Name)) to my selector: selector.ItemsSource = source.Select(obj => obj.Name).ToList(); This code works and show dog names. Now i want to send Id of selected dog to the next windows which show my…
0
votes
1 answer

Display C#-array in XAML DataGrid

it should be simple, but I do not find the answer. I have any datadrid and in code-behind…
user3367867
  • 565
  • 1
  • 7
  • 19