We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Import MS Access database to a SFDataGrid

Thread ID:





119167 May 16,2015 08:15 PM May 19,2015 11:22 AM WPF 2
Tags: SfDataGrid
Asked On May 16, 2015 08:15 PM


I'm trying to import a MS Access database to a SFDataGrid, since I'd like to use the filter and sorting for this control. I got it working for a WPF DataGrid using the tutorial here and then build the project, go to the Data Sources toolbar, make sure DataGrid is selected from the dropdown for the dataset and then drag and drop into the design view. I was unable to figure out how to add the SFDataGrid control as a custom control for this dataset (under Customized Control Binding). I have the code below after messing around with the DataGrid code, but it doesn't display any data -- only the headers.

What is the best way to import a MS Access database into a SFDataGrid?

        xmlns:local="clr-namespace:AccessWPFTest" x:Class="AccessWPFTest.MainWindow"
        d:DesignHeight="1280" d:DesignWidth="1080"
        Loaded="Window_Loaded" >

            <local:TestDatabaseDataSet x:Key="testDatabaseDataSet"/>
            <CollectionViewSource x:Key="test_1ViewSource" Source="{Binding Test_1, Source={StaticResource testDatabaseDataSet}}"/>

    <Grid DataContext="{StaticResource test_1ViewSource}">

        <syncfusion:SfDataGrid x:Name="test_1DataGrid" ColumnSizer="Auto" ItemsSource="{Binding test_1ViewSource}" >
                <syncfusion:GridTextColumn x:Name="number" HeaderText="Number" Binding.XmlNamespaceManager="{Binding Number}"/>
                <syncfusion:GridTextColumn x:Name="number2" HeaderText="Number2" Binding.XmlNamespaceManager="{Binding Number2}"/>



private void Window_Loaded(object sender, RoutedEventArgs e)
            AccessWPFTest.TowerDatabaseDataSet towerDatabaseDataSet = ((AccessWPFTest.TowerDatabaseDataSet)(this.FindResource("towerDatabaseDataSet")));
            // Load data into the table TW230kV_1. You can modify this code as needed.
            AccessWPFTest.TowerDatabaseDataSetTableAdapters.TW230kV_1TableAdapter towerDatabaseDataSetTW230kV_1TableAdapter = new AccessWPFTest.TowerDatabaseDataSetTableAdapters.TW230kV_1TableAdapter();
            System.Windows.Data.CollectionViewSource tW230kV_1ViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("tW230kV_1ViewSource")));

Replied On May 16, 2015 08:32 PM

The Window_Loaded function was not edited properly; so that someone could replicate my problem in the future, could someone delete/replace that part from the OP with the following? Many thanks in advance.

private void Window_Loaded(object sender, RoutedEventArgs e)
            AccessWPFTest.TestDatabaseDataSet testDatabaseDataSet = ((AccessWPFTest.TestDatabaseDataSet)(this.FindResource("testDatabaseDataSet")));
            // Load data into the table Test_1. You can modify this code as needed.
            AccessWPFTest.TestDatabaseDataSetTableAdapters.Test_1TableAdapter towerDatabaseDataSetTest_1TableAdapter = new AccessWPFTest.TestDatabaseDataSetTableAdapters.Test_1TableAdapter();
            System.Windows.Data.CollectionViewSource test_1ViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("test_1ViewSource")));

Jai Ganesh S [Syncfusion]
Replied On May 19, 2015 11:22 AM

Hi Cindy,

Thank you for using Syncfusion products.

We have analyzed your query. Asupport incident has been created under your account to track the status of this query. Please log on to our support website to check for further updates


Please let us know if you have any queries.

Thank you,

Jai Ganesh S


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.