![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Binding Question I have a combo box that I want to bind by calling a method in another class. This class calls a web service which retrieves the data I need in the form of a collection.. I have found very simple binding examples, but these involve creating the data source in the xaml file itself. Any example for what I am trying to do would be greatly apprecitated. Thanks! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Binding Question Closest I've tried is binding to a method declared by the window you are in: <Window Name="MainWin"> <ComboBox ItemsSource="{Binding ElementName=MainWin, Path=Journal}" Style="{StaticResource Journal}"> </ComboBox> </Window> where public class MainWindow : Window { protected IList<String> Journal {get { return new String[] {"one", "two", "three"}; }} } You should be able to adapt it with the ElementName/Path stuff, but I've had some problems with the binding stuff not throwing errors when I've misdeclared some of the path; it just binds to an empty list, which makes figuring it out by trial and error a royal pain. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Binding Question Thanks for the help Keith. I figured out how to do it a different way, using an xml data source. Keith Patrick wrote: > Closest I've tried is binding to a method declared by the window you are in: > <Window Name="MainWin"> > <ComboBox ItemsSource="{Binding ElementName=MainWin, Path=Journal}" > Style="{StaticResource Journal}"> > </ComboBox> > </Window> > > where > > public class MainWindow : Window { > protected IList<String> Journal {get { return new String[] {"one", "two", > "three"}; }} > } > > You should be able to adapt it with the ElementName/Path stuff, but I've had > some problems with the binding stuff not throwing errors when I've > misdeclared some > of the path; it just binds to an empty list, which makes figuring it out by > trial and error a royal pain. |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Cmdlet Parameter Binding Question | PowerShell | |||