Click here to Skip to main content
15,890,557 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Data Binding Multiple Values Pin
Pete O'Hanlon25-May-10 7:12
mvePete O'Hanlon25-May-10 7:12 
GeneralRe: Data Binding Multiple Values Pin
#realJSOP27-May-10 5:09
mve#realJSOP27-May-10 5:09 
GeneralRe: Data Binding Multiple Values Pin
Manish V Mahajan29-Jul-11 11:07
Manish V Mahajan29-Jul-11 11:07 
QuestionGrid not updating while swaping element[modified] Pin
Tripathi Swati24-May-10 20:22
Tripathi Swati24-May-10 20:22 
QuestionSetting a textbox based on listbox selection. Pin
jhoga24-May-10 10:51
jhoga24-May-10 10:51 
AnswerRe: Setting a textbox based on listbox selection. Pin
Abhinav S25-May-10 3:02
Abhinav S25-May-10 3:02 
GeneralRe: Setting a textbox based on listbox selection. Pin
jhoga25-May-10 12:28
jhoga25-May-10 12:28 
GeneralRe: Setting a textbox based on listbox selection. Pin
Jürgen Röhr27-May-10 7:10
professionalJürgen Röhr27-May-10 7:10 
Hi,

you must convert the SelectedItem of the ListBox into the string you need. You can do this by binding it to another property (of your viewmodel) and in the new property's setter, you can transfer the converted string-value to your TextBox.Text-property. Alternatively you must code the SelectionChanged-event of the ListBox.

The type of the SelectedItem depends on the given Items (sounds a bit stupid, I know). If you fill the ListBox at designtime, you will probably have something like
<ListBox ... >
   <ListBox.Items>
      <ListBoxItem Content="one" />
      <ListBoxItem Content="two" />
      <ListBoxItem Content="three" />
   </ListBox.Items>
</ListBox>

In this case, the SelectedItem is of type ListBoxItem. If you e. g. provide a List<string> as ItemsSource, you get a string as SelectedItem.

As mentioned by Abhinav S you might want to consider using the IsSynchronizedWithCurrentItem property.

Cheers
Jürgen
QuestionWrap panel in WPF List Box Pin
Hema Bairavan24-May-10 1:30
Hema Bairavan24-May-10 1:30 
AnswerRe: Wrap panel in WPF List Box Pin
Pete O'Hanlon24-May-10 3:19
mvePete O'Hanlon24-May-10 3:19 
GeneralRe: Wrap panel in WPF List Box Pin
Jammer26-May-10 7:54
Jammer26-May-10 7:54 
QuestionWPF Datagrid export to excel Pin
kartheesh23-May-10 19:34
kartheesh23-May-10 19:34 
QuestionHow can I create an oddly shaped GUI ? Pin
Enochs23-May-10 8:36
Enochs23-May-10 8:36 
QuestionWCF web.config is getting overwritten after every compilation? Pin
mittalpa22-May-10 6:24
mittalpa22-May-10 6:24 
AnswerRe: WCF web.config is getting overwritten after every compilation? Pin
Kunal Chowdhury «IN»24-May-10 2:34
professionalKunal Chowdhury «IN»24-May-10 2:34 
QuestionFolderBrowserDialog in WPF Pin
dan!sh 22-May-10 4:13
professional dan!sh 22-May-10 4:13 
AnswerRe: FolderBrowserDialog in WPF Pin
Abhinav S22-May-10 5:28
Abhinav S22-May-10 5:28 
GeneralRe: FolderBrowserDialog in WPF Pin
dan!sh 22-May-10 5:34
professional dan!sh 22-May-10 5:34 
AnswerRe: FolderBrowserDialog in WPF Pin
Daniel Grunwald22-May-10 6:44
Daniel Grunwald22-May-10 6:44 
GeneralRe: FolderBrowserDialog in WPF Pin
dan!sh 22-May-10 7:14
professional dan!sh 22-May-10 7:14 
QuestionHow to you generate itemized lists in a RichTextBox? [NO SOLUTION POSSIBLE] Pin
fjparisIII22-May-10 4:12
fjparisIII22-May-10 4:12 
AnswerRe: How to you generate itemized lists in a RichTextBox? Pin
Kunal Chowdhury «IN»24-May-10 8:37
professionalKunal Chowdhury «IN»24-May-10 8:37 
GeneralRe: How to you generate itemized lists in a RichTextBox? Pin
fjparisIII24-May-10 9:17
fjparisIII24-May-10 9:17 
QuestionHow do you adjust leading between paragraphs in RichTextBox? [SOLVED THROUGH A KLUDGE] Pin
fjparisIII22-May-10 4:10
fjparisIII22-May-10 4:10 
AnswerRe: How do you adjust leading between paragraphs in RichTextBox? [SOLVED THROUGH A KLUDGE] Pin
Abhinav S24-May-10 17:28
Abhinav S24-May-10 17:28 

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.