■ GridControl 클래스에서 MS Access 데이터베이스의 데이터를 로드하는 방법을 보여준다.
▶ MainWindow.xaml
1 2 3 |
<Window x:Class="TestProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
Width="800"
Height="600"
Title="GridControl 클래스 : MS Access 데이터베이스에 그리드 바인딩 하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Grid>
<dxg:GridControl x:Name="gridControl" AutoGenerateColumns="AddNew">
<dxg:GridControl.View>
<dxg:TableView />
</dxg:GridControl.View>
</dxg:GridControl>
</Grid>
</Window>
▶ MainWindow.xaml.cs
1 2 3 |
using System.Windows;
using TestProject.NorthwindDataSetTableAdapters;
namespace TestProject
{
/// <summary>
/// 메인 윈도우
/// </summary>
public partial class MainWindow : Window
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 – MainWindow()
/// <summary>
/// 생성자
/// </summary>
public MainWindow()
{
InitializeComponent();
this.gridControl.ItemsSource = new CustomersTableAdapter().GetData();
}
#endregion
}
}