Skip to content

Commit 94bc4c8

Browse files
authored
Merge pull request #1 from priyanka0497/master
DataGrid-GettingStarted
2 parents 8375120 + 102c51f commit 94bc4c8

11 files changed

Lines changed: 355 additions & 2 deletions

App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5+
</startup>
6+
</configuration>

App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="DataGridDemo.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:DataGridDemo"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>

App.xaml.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace DataGridDemo
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}

DataGridDemo.csproj

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{48153C11-A9A7-4016-884C-4A0188899B4E}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>DataGridDemo</RootNamespace>
10+
<AssemblyName>DataGridDemo</AssemblyName>
11+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<WarningLevel>4</WarningLevel>
15+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
<Deterministic>true</Deterministic>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<PlatformTarget>AnyCPU</PlatformTarget>
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<PlatformTarget>AnyCPU</PlatformTarget>
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="Syncfusion.Data.WPF, Version=17.3460.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
39+
<HintPath>packages\Syncfusion.Data.WPF.17.3.0.26\lib\net46\Syncfusion.Data.WPF.dll</HintPath>
40+
</Reference>
41+
<Reference Include="Syncfusion.Licensing, Version=17.3460.0.26, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
42+
<HintPath>packages\Syncfusion.Licensing.17.3.0.26\lib\net46\Syncfusion.Licensing.dll</HintPath>
43+
</Reference>
44+
<Reference Include="Syncfusion.SfGrid.WPF, Version=17.3460.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
45+
<HintPath>packages\Syncfusion.SfGrid.WPF.17.3.0.26\lib\net46\Syncfusion.SfGrid.WPF.dll</HintPath>
46+
</Reference>
47+
<Reference Include="Syncfusion.Shared.WPF, Version=17.3460.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
48+
<HintPath>packages\Syncfusion.Shared.WPF.17.3.0.26\lib\net46\Syncfusion.Shared.WPF.dll</HintPath>
49+
</Reference>
50+
<Reference Include="System" />
51+
<Reference Include="System.Data" />
52+
<Reference Include="System.Xml" />
53+
<Reference Include="Microsoft.CSharp" />
54+
<Reference Include="System.Core" />
55+
<Reference Include="System.Xml.Linq" />
56+
<Reference Include="System.Data.DataSetExtensions" />
57+
<Reference Include="System.Net.Http" />
58+
<Reference Include="System.Xaml">
59+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
60+
</Reference>
61+
<Reference Include="WindowsBase" />
62+
<Reference Include="PresentationCore" />
63+
<Reference Include="PresentationFramework" />
64+
</ItemGroup>
65+
<ItemGroup>
66+
<ApplicationDefinition Include="App.xaml">
67+
<Generator>MSBuild:Compile</Generator>
68+
<SubType>Designer</SubType>
69+
</ApplicationDefinition>
70+
<Compile Include="ViewModel.cs" />
71+
<Page Include="MainWindow.xaml">
72+
<Generator>MSBuild:Compile</Generator>
73+
<SubType>Designer</SubType>
74+
</Page>
75+
<Compile Include="App.xaml.cs">
76+
<DependentUpon>App.xaml</DependentUpon>
77+
<SubType>Code</SubType>
78+
</Compile>
79+
<Compile Include="MainWindow.xaml.cs">
80+
<DependentUpon>MainWindow.xaml</DependentUpon>
81+
<SubType>Code</SubType>
82+
</Compile>
83+
</ItemGroup>
84+
<ItemGroup>
85+
<Compile Include="OrderInfo.cs" />
86+
<Compile Include="Properties\AssemblyInfo.cs">
87+
<SubType>Code</SubType>
88+
</Compile>
89+
<Compile Include="Properties\Resources.Designer.cs">
90+
<AutoGen>True</AutoGen>
91+
<DesignTime>True</DesignTime>
92+
<DependentUpon>Resources.resx</DependentUpon>
93+
</Compile>
94+
<Compile Include="Properties\Settings.Designer.cs">
95+
<AutoGen>True</AutoGen>
96+
<DependentUpon>Settings.settings</DependentUpon>
97+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
98+
</Compile>
99+
<EmbeddedResource Include="Properties\Resources.resx">
100+
<Generator>ResXFileCodeGenerator</Generator>
101+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
102+
</EmbeddedResource>
103+
<None Include="packages.config" />
104+
<None Include="Properties\Settings.settings">
105+
<Generator>SettingsSingleFileGenerator</Generator>
106+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
107+
</None>
108+
</ItemGroup>
109+
<ItemGroup>
110+
<None Include="App.config" />
111+
</ItemGroup>
112+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
113+
</Project>

DataGridDemo.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28010.2050
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataGridDemo", "DataGridDemo\DataGridDemo.csproj", "{48153C11-A9A7-4016-884C-4A0188899B4E}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{48153C11-A9A7-4016-884C-4A0188899B4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{48153C11-A9A7-4016-884C-4A0188899B4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{48153C11-A9A7-4016-884C-4A0188899B4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{48153C11-A9A7-4016-884C-4A0188899B4E}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {7884A4A4-3FBD-416B-9B10-5074CC8DB625}
24+
EndGlobalSection
25+
EndGlobal

MainWindow.xaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Window
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:DataGridDemo"
7+
xmlns:syncfusion="http://schemas.syncfusion.com/wpf" x:Class="DataGridDemo.MainWindow"
8+
mc:Ignorable="d"
9+
Title="MainWindow" Height="450" Width="800">
10+
<Window.DataContext>
11+
<local:ViewModel/>
12+
</Window.DataContext>
13+
<Grid>
14+
15+
<syncfusion:SfDataGrid ItemsSource="{Binding Orders}" AllowFiltering="True" ShowGroupDropArea="True" ColumnSizer="Auto" SelectionMode="Extended" FilterRowPosition="FixedTop" AllowTriStateSorting="True"/>
16+
17+
</Grid>
18+
</Window>

MainWindow.xaml.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace DataGridDemo
17+
{
18+
/// <summary>
19+
/// Interaction logic for MainWindow.xaml
20+
/// </summary>
21+
public partial class MainWindow : Window
22+
{
23+
public MainWindow()
24+
{
25+
InitializeComponent();
26+
}
27+
}
28+
}

OrderInfo.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace DataGridDemo
8+
{
9+
public class OrderInfo
10+
{
11+
int orderID;
12+
string customerId;
13+
string country;
14+
string customerName;
15+
string shippingCity;
16+
17+
public int OrderID
18+
{
19+
get { return orderID; }
20+
set { orderID = value; }
21+
}
22+
23+
public string CustomerID
24+
{
25+
get { return customerId; }
26+
set { customerId = value; }
27+
}
28+
29+
public string CustomerName
30+
{
31+
get { return customerName; }
32+
set { customerName = value; }
33+
}
34+
35+
public string Country
36+
{
37+
get { return country; }
38+
set { country = value; }
39+
}
40+
41+
public string ShipCity
42+
{
43+
get { return shippingCity; }
44+
set { shippingCity = value; }
45+
}
46+
47+
public OrderInfo(int orderId, string customerName, string country, string customerId, string shipCity)
48+
{
49+
this.OrderID = orderId;
50+
this.CustomerName = customerName;
51+
this.Country = country;
52+
this.CustomerID = customerId;
53+
this.ShipCity = shipCity;
54+
}
55+
}
56+
}

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
1-
# wpf-datagrid-example
2-
Sample code for datagrid getting started video.
1+
# Getting Started Sample for WPF-DataGrid
2+
This sample contains a simple DataGrid with datacollection bound to it and few of its basic features like sorting, filtering, grouping and selection are enabled.
3+
4+
## Project pre-requisites
5+
To run this application, you need to have the below two in your system
6+
* VisualStudio
7+
* DataGrid Assemblies.
8+
9+
## Install
10+
You can install the DataGrid Assemblies from Syncfusion nuget packages.
11+
Follow the below steps to install assemblies from nuget
12+
* Go to the References option in the project.
13+
* Right-click the References option and choose Manage NuGet Packages option from the menu that will display a window.
14+
* Now click the settings icon and in the options search for Nuget Package Manager.
15+
* In the package source, add the Syncfusion package manager source https://api.nuget.org/v3/index.json
16+
* From the above source install Syncfusion.SfGrid.WPF nuget.

ViewModel.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace DataGridDemo
9+
{
10+
public class ViewModel
11+
{
12+
private ObservableCollection<OrderInfo> _orders;
13+
public ObservableCollection<OrderInfo> Orders
14+
{
15+
get { return _orders; }
16+
set { _orders = value; }
17+
}
18+
19+
public ViewModel()
20+
{
21+
_orders = new ObservableCollection<OrderInfo>();
22+
this.GenerateOrders();
23+
}
24+
25+
private void GenerateOrders()
26+
{
27+
_orders.Add(new OrderInfo(1002, "Khaleesi", "Mexico", "QUEEN", "Mexico D.F."));
28+
_orders.Add(new OrderInfo(1002, "Drogo", "Mexico", "DOTHRAKI", "Mexico D.F."));
29+
_orders.Add(new OrderInfo(1001, "Maria Anders", "Germany", "ALFKI", "Berlin"));
30+
_orders.Add(new OrderInfo(1001, "Antonio Moreno", "Germany", "ANTON", "Berlin"));
31+
_orders.Add(new OrderInfo(1001, "Martin Sommer", "Germany", "BOLID", "Berlin"));
32+
_orders.Add(new OrderInfo(1001, "Sommer", "Germany", "BOL", "Berlin"));
33+
_orders.Add(new OrderInfo(1001, "Jon Snow", "Germany", "BOLD", "Berlin"));
34+
_orders.Add(new OrderInfo(1001, "Arya Stark", "Germany", "NOONE", "Berlin"));
35+
_orders.Add(new OrderInfo(1002, "Ana Trujilo", "Mexico", "ANATR", "Mexico D.F."));
36+
_orders.Add(new OrderInfo(1002, "Styles", "Mexico", "HAHI", "Mexico D.F."));
37+
_orders.Add(new OrderInfo(1002, "Ana Trujilo", "Mexico", "ANATR", "Mexico D.F."));
38+
_orders.Add(new OrderInfo(1002, "Antonio Moreno", "Mexico", "ANTON", "Mexico D.F."));
39+
_orders.Add(new OrderInfo(1002, "Christina Berglund", "Mexico", "ANATR", "Mexico D.F."));
40+
_orders.Add(new OrderInfo(1003, "Antonio Moreno", "Mexico", "ANTON", "Mexico D.F."));
41+
_orders.Add(new OrderInfo(1003, "Ronaldo", "Mexico", "ANTON", "Mexico D.F."));
42+
_orders.Add(new OrderInfo(1003, "Cersei", "Mexico", "ANTON", "Mexico D.F."));
43+
_orders.Add(new OrderInfo(1003, "Jack", "Mexico", "ANTON", "Mexico D.F."));
44+
_orders.Add(new OrderInfo(1003, "Antony", "Mexico", "ANTON", "Mexico D.F."));
45+
_orders.Add(new OrderInfo(1003, "Caesar", "Mexico", "ANTON", "Mexico D.F."));
46+
_orders.Add(new OrderInfo(1003, "Lanister", "Mexico", "ANTON", "Mexico D.F."));
47+
_orders.Add(new OrderInfo(1003, "Sansa", "Mexico", "BLAUS", "Mexico D.F."));
48+
_orders.Add(new OrderInfo(1004, "Thomas Hardy", "UK", "AROUT", "London"));
49+
_orders.Add(new OrderInfo(1005, "Christina Berglund", "Sweden", "BERGS", "Lula"));
50+
_orders.Add(new OrderInfo(1005, "Hanna Moos", "Sweden", "BERGS", "Lula"));
51+
_orders.Add(new OrderInfo(1006, "Hanna Moos", "Germany", "BLAUS", "Mannheim"));
52+
_orders.Add(new OrderInfo(1007, "Frederique Citeaux", "France", "BLONP", "Strasbourg"));
53+
_orders.Add(new OrderInfo(1007, "Martin Sommer", "France", "BOTTM", "Strasbourg"));
54+
_orders.Add(new OrderInfo(1007, "Elizabeth Lincoln", "France", "BLONP", "Strasbourg"));
55+
_orders.Add(new OrderInfo(1008, "Martin Sommer", "Spain", "BOLID", "Madrid"));
56+
_orders.Add(new OrderInfo(1009, "Laurence Lebihan", "France", "BONAP", "Marseille"));
57+
_orders.Add(new OrderInfo(1010, "Elizabeth Lincoln", "Canada", "BOTTM", "Tsawassen"));
58+
}
59+
}
60+
}

0 commit comments

Comments
 (0)