Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
310
Why is it not working?
posted

Hello, I have the following code and wonder why it's not working..

<Window x:Class="Wpf2.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Wpf2"
    Title="Window1" Height="276" Width="483" xmlns:my="clr-namespace:Infragistics.Windows.DataPresenter;assembly=Infragistics3.Wpf.DataPresenter.v8.1.Express">
    <Grid>
        <Grid.Resources>
            <!-- Creates a DataSet with
         two related DataTables. -->
            <ObjectDataProvider
                  x:Key="dataSetProvider"
                  MethodName="CreateDataSet"
                  ObjectType="{x:Type local:DataSetCreator}"
                  />
        </Grid.Resources>
        <my:XamDataGrid x:Name="XamDataGrid1" 
                        DataSource="{Binding Source={StaticResource dataSetProvider},XPath=Master}" >
        </my:XamDataGrid>
    </Grid>
</Window>

using System;
using System.Data;

namespace Wpf2
{
    public static class DataSetCreator
    {
        public static DataSet CreateDataSet()
        {
            DataSet ds = new DataSet();

            // Create the parent table.
            // ***************************************
            DataTable tbl = new DataTable( "Master" );
            tbl.Columns.Add( "ID", typeof( int ) );
            tbl.Columns.Add( "Name" );
            for( int i = 0; i < 3; ++i )
            {
                DataRow row = tbl.NewRow();
                row["ID"] = i;
                row["Name"] = "Master #" + i;
                tbl.Rows.Add( row );
            }
            ds.Tables.Add( tbl );

            // Create the child table.
            // ***************************************
            tbl = new DataTable( "Detail" );
            tbl.Columns.Add( "MasterID", typeof( int ) );
            tbl.Columns.Add( "Info" );
            for( int i = 0; i < 9; ++i )
            {
                DataRow row = tbl.NewRow();
                row["MasterID"] = i % 3;
                row["Info"] = String.Format(
                    "Detail Info #{0} for Master #{1}",
                    (i / 3), (i % 3) );
                tbl.Rows.Add( row );
            }
            ds.Tables.Add( tbl );

            // Associate the tables.
            // ***************************************
            ds.Relations.Add(
                "Master2Detail",
                ds.Tables["Master"].Columns["ID"],
                ds.Tables["Detail"].Columns["MasterID"] );

            return ds;
        }
    }
}
 

Parents
No Data
Reply Children
No Data