Binding master detail datagrid in WPF

Binding master detail datagrid in WPF

Postby matthieu de graaf » Fri 12 Sep 2008 13:37

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
matthieu de graaf
 
Posts: 18
Joined: Wed 14 May 2008 12:13

Postby Shalex » Tue 16 Sep 2008 09:35

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.
Shalex
Devart Team
 
Posts: 7149
Joined: Thu 14 Aug 2008 12:44

Postby matthieu de graaf » Thu 18 Sep 2008 20:23

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:

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="EmpDept ListBox" Height="398" Width="739" Loaded="Window_Loaded">






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
matthieu de graaf
 
Posts: 18
Joined: Wed 14 May 2008 12:13


Return to dotConnect for Oracle