Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Binding Question

Closed Thread
 
Thread Tools Display Modes
Old 12-04-2006   #1 (permalink)
Bree
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!

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


Old 12-04-2006   #3 (permalink)
Keith Patrick
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.


Old 12-06-2006   #4 (permalink)
Bree
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.


Old 12-06-2006   #5 (permalink)
Bree
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.


Closed Thread

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








Vistax64.com 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 2005-2008

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 47 48 49 50