Bind textbox to listbox?

Up vote 0 down vote favorite share g+ share fb share tw.

There is a listBox named as listB_addRemove. I tried to bind a textbox to that listBox but I failed and nothing has shown in textbox. Below is what I tried: Where is the problem?

C# wpf xaml data-binding link|improve this question edited Mar 14 at 16:40H.B.43k61645 asked Mar 14 at 16:29Shibli2747 72% accept rate.

You are not binding the Text, look up how the DataContext works. If you keep this you need to add Text="{Binding . }".

Also note that if you do not bind via Path directly in the Text you cannot bind two-way, so if you want that you should move the DataContext binding to Text.

Your binding is on the DataContext attribute of the TextBox and it should be on the Text attribute instead.

Set the DataContext of the Page to your Viewmodel or this.

I'm binding a list to a ListBox, but the data does not show up. And C# code goes as: var q = from h in xmlDoc. Descendants("City") select new { CityName = h.

Element("Name") }; listCities. ItemsSource = q; Any help there. Thanks windows-phone-7 link|improve this question asked Feb 1 at 15:38Pyush111.

– Ku6opr Feb 1 at 15:58 q does contain values. Also q.ToList() did not help – Pyush Feb 1 at 16:56.

Set the DataContext of the Page to your Viewmodel or this. DataContext = this; Make sure your List is an ObservableCollection.

Awesome downvote for no reason – MyKuLLSKI Feb 1 at 16:39 I appologize. That was by mistake – Pyush Feb 1 at 16:57 @Pyush - So undo it? – MyKuLLSKI Feb 1 at 17:00 This is only half the answer, as you're not showing the binding of the ListBox, the ObservableCollection property, etc – willmel Feb 1 at 17:39.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions