Hi,
I'm trying simple example on xamDataGrid from your documentation and can't get child data in grid. I'm using VS 2008, NetAdvantage for WPF 2007.
I've created simple Typed DataSet from AdvandureWorks database with two tables: Contact and Individual.
I've created simple class that populates dataset:
class Data { public static testData GetData() { testData t = new testData(); WpfTestClient.testDataTableAdapters.IndividualTableAdapter a = new WpfTestClient.testDataTableAdapters.IndividualTableAdapter(); WpfTestClient.testDataTableAdapters.ContactTableAdapter a1 = new WpfTestClient.testDataTableAdapters.ContactTableAdapter(); //DataRelation tableRelation = // new DataRelation("hierarchy", // this.flatData.Tables["Customers"].Columns["CustomerID"], // this.flatData.Tables["Orders"].Columns["CustomerID"]); //flatData.Relations.Add(tableRelation); a1.Fill(t.Contact); a.Fill(t.Individual); return t; } }
XAML code behind:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;namespace WpfTestClient{ public partial class InfGrid : Window { public InfGrid() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { xamDataGrid1.DataSource = Data.GetData().Contact.DefaultView; } }}
XAML:
<Window x:Class="WpfTestClient.InfGrid" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="InfGrid" Height="401" Width="663" xmlns:my="clr-namespace:Infragistics.Windows.DataPresenter;assembly=Infragistics3.Wpf.DataPresenter.v7.2" Loaded="Window_Loaded"> <Grid> <my:XamDataGrid Name="xamDataGrid1" AutoFit="True" /> </Grid></Window>
form is shoing only Contact info and it has "+" sign indicating it has child. But when I click on it, nothing happends.
thx
just figured out, this code actually works, I just didnt had child relation on every entity...
thx anyway