tags:

views:

128

answers:

0

Hi,

I have a Textbox in my Main form what i am trying to achieve is when i enter some text in the textbox and click on the button it should popup a window which has a listbox and on selecting some item in listbox the selected item should get displayed in the Parent form textbox.

I am stucked while setting the SetBidding Property for Listbox. I dont know where i am going workng ...Please Help

//Following is the method which is called on click of the button.
private void OpenSearchDialog(object parameter)

{
        SearchList sl = new SearchList();
       sl.txtSearch.Text = parameter.ToString();
      Binding b = new Binding();
      b.Mode = BindingMode.OneWay ;
      b.Source =GetData(parameter.ToString());
      b.Path = new PropertyPath("SelectDataCommand");
   sl.ListBox1.SetBinding(ListBox.ItemsSourceProperty, new Binding{ Source = GetData(parameter.ToString()) });
     sl.ListBox1.SetBinding(ListBox.SelectedValueProperty, new Binding(){Source=this,Path = new PropertyPath("SelectDataCommand")}) 

        sl.ShowDialog();

}

    }