Windows Vista Forums

Binding Question
  1. #1


    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!




      My System SpecsSystem Spec

  2. #2


    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.



      My System SpecsSystem Spec

  3. #3


    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.



      My System SpecsSystem Spec

Binding Question problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding to DL Bart Perrier VB Script 2 17 Mar 2009
Binding inside binding question Yoavo Avalon 0 03 Dec 2007
Binding to a Foreign Key Binding? -=B3N=- Avalon 0 14 Jun 2007
Binding Question (Binding in General) Jason Avalon 2 09 May 2007
Cmdlet Parameter Binding Question Keith Hill [MVP] PowerShell 13 10 Dec 2006