Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Binding Question

 
 
Old 12-04-2006   #1 (permalink)
Bree


 
 

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 SpecsSystem Spec
Old 12-04-2006   #2 (permalink)
Keith Patrick


 
 

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 SpecsSystem Spec
Old 12-06-2006   #3 (permalink)
Bree


 
 

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 SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Cmdlet Parameter Binding Question PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46