![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | 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! |
| | #2 (permalink) |
| Guest | 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. |
| | #3 (permalink) |
| Guest | 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. |
| | #4 (permalink) |
| Guest | 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. |
| | #5 (permalink) |
| Guest | 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. |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Binding inside binding question | Yoavo | Avalon | 0 | 12-03-2007 08:24 AM |
| Binding to a Foreign Key Binding? | -=B3N=- | Avalon | 0 | 06-14-2007 06:45 AM |
| Binding Question (Binding in General) | Jason | Avalon | 2 | 05-09-2007 04:41 AM |
| Cmdlet Parameter Binding Question | Keith Hill [MVP] | PowerShell | 13 | 12-10-2006 10:22 PM |
| Two-Way Xml Binding? | Nick Howell | Avalon | 0 | 03-05-2006 07:11 PM |