Click here to Skip to main content
15,913,570 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
Pete O'Hanlon21-Apr-11 10:04
mvePete O'Hanlon21-Apr-11 10:04 
GeneralRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
Jammer22-Apr-11 2:57
Jammer22-Apr-11 2:57 
GeneralRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
Pete O'Hanlon22-Apr-11 9:12
mvePete O'Hanlon22-Apr-11 9:12 
GeneralRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
Jammer22-Apr-11 10:38
Jammer22-Apr-11 10:38 
GeneralRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
Jammer25-Apr-11 22:38
Jammer25-Apr-11 22:38 
AnswerRe: Hmm ...MVVM ... Is this Bad? I can't decide [modified] Pin
BubingaMan28-Apr-11 1:59
BubingaMan28-Apr-11 1:59 
QuestionHow to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Rocky2320-Apr-11 2:24
Rocky2320-Apr-11 2:24 
AnswerRe: How to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Tarun.K.S20-Apr-11 3:05
Tarun.K.S20-Apr-11 3:05 
Can you tell what is the exception?

Anyway try this :

listdata.Remove((Directive)lbDirectiveList.SelectedItem);


I would like to suggest you to make few more changes.

You can remove the SelectionChanged event if you want to display the textboxes on selection. You should use the Binding concept of WPF. So you can use IsSynchronizedWithCurrentItem property of the ListBox. I will explain later its use.
This is how you can use it :

1) Set the DataContext of the panel(in your case its grid) to listdata, and remove the ItemsSource property that you have set earlier. So replace it with this :
myGrid.DataContext = listdata;


2) In the XAML of the ListBox, add this :
XML
<ListBox Grid.Row="1" ItemSource = "{Binding}" IsSynchronizedWithCurrentItem = "True" Grid.Column="2" ..../>


3) In the textboxes of your XAML, add this :

XML
<TextBox Name = "txtDirectiveDescription" Text = "{Binding Path = DirectiveDescription}"/>
<TextBox Name = "txtDirectiveName" Text = "{Binding Path = DirectiveName}"/>


4) Remove the SelectionChanged event, you won't be needing it!

With IsSynchronizedWithCurrentItem property, the current item of the DataContext selected on the ListBox will be set to the children of the Panel with which it has Binding. You will better understand by if you set this property to false.

Good luck!

People with high attitude deserve the standing ovation of our highest finger!

My Blog![^]

GeneralRe: How to read the data from listbox Itemsource datatemplate and display it in UI controls [modified] Pin
Rocky2320-Apr-11 3:28
Rocky2320-Apr-11 3:28 
GeneralRe: How to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Tarun.K.S20-Apr-11 3:59
Tarun.K.S20-Apr-11 3:59 
AnswerRe: How to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Ian Shlasko20-Apr-11 3:57
Ian Shlasko20-Apr-11 3:57 
GeneralRe: How to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Tarun.K.S20-Apr-11 4:09
Tarun.K.S20-Apr-11 4:09 
GeneralRe: How to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Ian Shlasko20-Apr-11 4:12
Ian Shlasko20-Apr-11 4:12 
GeneralRe: How to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Kunal Chowdhury «IN»20-Apr-11 22:44
professionalKunal Chowdhury «IN»20-Apr-11 22:44 
GeneralRe: How to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Rocky2327-Apr-11 19:49
Rocky2327-Apr-11 19:49 
GeneralRe: How to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Ian Shlasko28-Apr-11 1:41
Ian Shlasko28-Apr-11 1:41 
QuestionPulling controls from resources Pin
Jean-Louis Leroy19-Apr-11 2:51
Jean-Louis Leroy19-Apr-11 2:51 
AnswerRe: Pulling controls from resources Pin
Ian Shlasko19-Apr-11 5:56
Ian Shlasko19-Apr-11 5:56 
GeneralRe: Pulling controls from resources Pin
Jean-Louis Leroy19-Apr-11 23:00
Jean-Louis Leroy19-Apr-11 23:00 
GeneralRe: Pulling controls from resources Pin
Ian Shlasko20-Apr-11 2:40
Ian Shlasko20-Apr-11 2:40 
GeneralRe: Pulling controls from resources Pin
Jean-Louis Leroy20-Apr-11 3:00
Jean-Louis Leroy20-Apr-11 3:00 
QuestionHow To Create This Menu In WPF Pin
Kevin Marois18-Apr-11 10:49
professionalKevin Marois18-Apr-11 10:49 
AnswerRe: How To Create This Menu In WPF Pin
Pete O'Hanlon18-Apr-11 11:20
mvePete O'Hanlon18-Apr-11 11:20 
GeneralRe: How To Create This Menu In WPF Pin
Kevin Marois18-Apr-11 11:26
professionalKevin Marois18-Apr-11 11:26 
GeneralRe: How To Create This Menu In WPF Pin
Pete O'Hanlon18-Apr-11 11:31
mvePete O'Hanlon18-Apr-11 11:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.