WPF binding

WPF binding

Old forum URL: forums.lhotka.net/forums/t/3245.aspx


jtnjtnjtn posted on Sunday, July 22, 2007

I'm trying to bind an Infragistics xamDataGrid to a read only list base with no success. I've also tried a plain combo box with the same result.  The XMLDataProvider below works fine.  The CSLADataProvider does not.

I set up the following as a test:

          <Grid.Resources>
            <XmlDataProvider x:Key="JobDataXML" XPath="/Jobs">
              <x:XData>
                <Jobs xmlns="">
                  <Job JobNo="01356" jobTitle="in">
                    <AddressStreet>Street A</AddressStreet>
                    <PercentCompleted>100</PercentCompleted>
                  </Job>
                  <Job JobNo="01245" jobTitle="in">
                    <AddressStreet>Street B</AddressStreet>
                    <PercentCompleted>80</PercentCompleted>
                  </Job>
                  <Job JobNo="01357" jobTitle="out">
                    <AddressStreet>Street C</AddressStreet>
                    <PercentCompleted>0</PercentCompleted>
                  </Job>
                  <Job JobNo="0945" jobTitle="in">
                    <AddressStreet>Street D</AddressStreet>
                    <PercentCompleted>75</PercentCompleted>
                  </Job>
                  <Job JobNo="09876" jobTitle="out">
                    <AddressStreet>Street E</AddressStreet>
                    <PercentCompleted>100</PercentCompleted>
                  </Job>
                </Jobs>
              </x:XData>
            </XmlDataProvider>

          </Grid.Resources>

<igDP:XamDataGrid x:Name="JobDataGrid" DataSource="{Binding Source={StaticResource JobDataXML},XPath=Job}" Grid.Row="1" GroupByAreaLocation="AboveDataArea">

The above works fine.

I then try the CSLA version in the same XAML file.

          <Grid.Resources>
      <csla:CslaDataProvider x:Key="JobList"
                             ObjectType="{x:Type SALib:JobListExtended}"
                             FactoryMethod="GetList"
                             IsAsynchronous="True"
                             IsInitialLoadEnabled="False">
      </csla:CslaDataProvider>
          </Grid.Resources>

<igDP:XamDataGrid x:Name="JobDataGrid" DataSource="{Binding Source={StaticResource JobList}}"     Grid.Row="1"  >

With this the grid comes up blank even though I know there is data.

I've also tried the following in the code-behind:

        private void OnInit(object sender, EventArgs e)
        {
            JobDataGrid.DataContext = ServiceApp.Library.JobListExtended.GetList();
        }

In this case the DataContext is poulated correctly but still the grid is displayed empty.


Could it be that the use of generics is causing a problem?
The Infragistics help says that the DataSource must implement IEnumerable. Is this the same with the standard combo control?  Is this a problem in the context of CSLA?

jtnjtnjtn replied on Monday, July 23, 2007

It seems that after making any changes to the XAML files you must clean the solution before rebuilding otherwise the changes are ignored.  There's probably an option in VS somewhere to control this.

Copyright (c) Marimer LLC