Page 1 of 1

Binding master detail datagrid in WPF

Posted: Fri 12 Sep 2008 13:37
by matthieu de graaf
Hi,

I'm working with Oradirect 4.75.40.0 with MS Visual Studio 2008.

I'm trying to make the Oradirect.Net sample "MasterDetail" in WPF/C#. As datagrid I use the new Microsoft datagrid component which comes with the WPFToolkit.

I'v createe a strongly typed Dept Emp dataset (OraDirect style, option "use provider specific code generator is checked" is used in dataset wizard.

I'm wondering how I can bind this datagrid. In the Windows Forms sample the grid is bound to the relation. In WPF however, the relation is not exposed as a public property but can be retrieved by means of the relations property of the dataset.

How can I bind this relation to the datagrid?

Regards,

Matthieu de Graaf

Posted: Tue 16 Sep 2008 09:35
by Shalex
When you are using typed DataSet of OraDirect .NET, you can bind it just as standard Microsoft DataSet. If you find any differences, please tell us about it.

Posted: Thu 18 Sep 2008 20:23
by matthieu de graaf
Hi,

I've made a little example following the instructions in Beatriz Costas Blog (http://www.beacosta.com/blog/?p=21)

I'v created 2 listboxes. Listbox 1 is based on the dept table in the EmpDeptDS. Listbox 2 is based on the emp_fk_dept relation between the emp en dept table in the EmpDeptDS dataset (column deptno joins the 2 tables)

The Emps are never shown with the dept

Can you show me where I went wrong?

Here you find my (simple code):

XAML File:








0


1




Code behind file:

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 EmpDeptMD
{
///
/// Interaction logic for EmpDeptListBoxFM.xaml
///
public partial class EmpDeptListBoxFM : Window
{
private EmpDeptDS myDS = new EmpDeptDS();
public EmpDept.DEPTDataTable myDept;
public EmpDeptListBoxFM()
{
InitializeComponent();
}

private void Window_Loaded(object sender, RoutedEventArgs e)
{
myDS.EnforceConstraints = false;
myDept = myDS.DEPT;
this.DataContext = myDept;
myDept.Active = true;
}
}
}

Regards,

Matthieu de Graaf