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. Image for the cookie policy date

Import MS Access database to a SFDataGrid


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")));

2 Replies

CO Coder May 17, 2015 12:32 AM UTC

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")));

JG Jai Ganesh S Syncfusion Team May 19, 2015 03:22 PM UTC

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

Live Chat Icon For mobile
Up arrow icon