• How to use WPF DataGrid

    by  • June 25, 2013 • Microsoft Visual Studio .NET, Windows Presentation Foundation (WPF) • 0 Comments

    In Web Applications DataGrid is commonly used to display data and in the same way DataGridView control is used in Windows application. Initially, GridView was not there in WPF and it was used from WPF Toolkit but .NET frameword 4.0 has come with WPF DataGrid. This article is all about using WPF DataGrid. DataGrid WPF has some common attributes and functionality with Web application DataGrid but there are lots of differences between these two. I will use some of the attributes and functionality in my code snippet but you can explore and use many others.

    Data binding to WPF DataGrid

    Binding data to WPF DataGrid is simple. It is something same as you bind data to web application DataGrid or Windows application DataGridView. Let me show you how we can use DataGrid WPF and how we can bind data to WPF DataGrid.

    First create WPF Application. If you don’t know how to create WFP Application, please see my article.

    Add a GridView from Toolbox

    Now get your data

    Now bind data to WPF GridView. “ItemsSource” property is used to bind data to WPF GridView instead of DataSource property of web application GridView.

    You can change different attributes of WPF GridView and also you can write your own headers and change individual item attributes.




    Namecheap.com
    Avatar of GetCodeSnippet.com

    About

    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply