Click here to Skip to main content
12,512,068 members (53,611 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# WPF
I've a listbox. I've to add a list of items to it from the database. Then at runtime when the window is loaded, I want the preveously selected item to be seen selected. Now the first task is working. But for getting the selection process I've to bind another observable collection to the ItemsSource property of the listbox. How can I bind it??? Can anyone help???
I'm attaching the code down here:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;

namespace WpfApplication1
public class Class1 : INotifyPropertyChanged

private ObservableCollection
Posted 27-Dec-12 19:43pm
Updated 27-Dec-12 21:35pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

                      new Binding { Source = f1  });
Juhi saf 28-Dec-12 3:36am
But, I want to bind it in the listbox.
Oleksandr Kulchytskyi 28-Dec-12 3:40am
So what a problem ??? Any issues with replacing instead of combobox to put listbox??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100