Skip to content

Commit 8471c64

Browse files
committed
WPF DataGrid sample committed
1 parent 71bfce4 commit 8471c64

23 files changed

+5123
-0
lines changed

App.xaml

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

App.xaml.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#region Copyright Syncfusion Inc. 2001 - 2019
2+
// Copyright Syncfusion Inc. 2001 - 2019. All rights reserved.
3+
// Use of this code is subject to the terms of our license.
4+
// A copy of the current license can be obtained at any time by e-mailing
5+
// licensing@syncfusion.com. Any infringement will be prosecuted under
6+
// applicable laws.
7+
#endregion
8+
using System;
9+
using System.Collections.Generic;
10+
using System.Configuration;
11+
using System.Data;
12+
using System.Linq;
13+
using System.Windows;
14+
15+
namespace LocalizationDemo
16+
{
17+
/// <summary>
18+
/// Interaction logic for App.xaml
19+
/// </summary>
20+
public partial class App : Application
21+
{
22+
public App()
23+
{
24+
}
25+
}
26+
}

LocalizationDemo.csproj

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{2D7FE8E4-9786-4046-9C72-EE1378F74AF3}</ProjectGuid>
9+
<OutputType>WinExe</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>LocalizationDemo</RootNamespace>
12+
<AssemblyName>LocalizationDemo</AssemblyName>
13+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
14+
<TargetFrameworkProfile>
15+
</TargetFrameworkProfile>
16+
<FileAlignment>512</FileAlignment>
17+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
18+
<WarningLevel>4</WarningLevel>
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
21+
<PlatformTarget>x86</PlatformTarget>
22+
<DebugSymbols>true</DebugSymbols>
23+
<DebugType>full</DebugType>
24+
<Optimize>false</Optimize>
25+
<OutputPath>bin\Debug\</OutputPath>
26+
<DefineConstants>DEBUG;TRACE</DefineConstants>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
</PropertyGroup>
30+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
31+
<PlatformTarget>x86</PlatformTarget>
32+
<DebugType>pdbonly</DebugType>
33+
<Optimize>true</Optimize>
34+
<OutputPath>bin\Release\</OutputPath>
35+
<DefineConstants>TRACE</DefineConstants>
36+
<ErrorReport>prompt</ErrorReport>
37+
<WarningLevel>4</WarningLevel>
38+
</PropertyGroup>
39+
<ItemGroup>
40+
<Reference Include="Syncfusion.Data.WPF, Version=17.3460.0.17, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
41+
<HintPath>packages\Syncfusion.Data.WPF.17.3.0.17\lib\net46\Syncfusion.Data.WPF.dll</HintPath>
42+
</Reference>
43+
<Reference Include="Syncfusion.Licensing, Version=17.3460.0.17, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
44+
<HintPath>packages\Syncfusion.Licensing.17.3.0.17\lib\net46\Syncfusion.Licensing.dll</HintPath>
45+
</Reference>
46+
<Reference Include="Syncfusion.SfGrid.WPF, Version=17.3460.0.17, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
47+
<HintPath>packages\Syncfusion.SfGrid.WPF.17.3.0.17\lib\net46\Syncfusion.SfGrid.WPF.dll</HintPath>
48+
<Private>True</Private>
49+
</Reference>
50+
<Reference Include="Syncfusion.Shared.WPF, Version=17.3460.0.17, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
51+
<HintPath>packages\Syncfusion.Shared.WPF.17.3.0.17\lib\net46\Syncfusion.Shared.WPF.dll</HintPath>
52+
</Reference>
53+
<Reference Include="System" />
54+
<Reference Include="System.Data" />
55+
<Reference Include="System.Data.Linq" />
56+
<Reference Include="System.Xml" />
57+
<Reference Include="Microsoft.CSharp" />
58+
<Reference Include="System.Core" />
59+
<Reference Include="System.Xml.Linq" />
60+
<Reference Include="System.Data.DataSetExtensions" />
61+
<Reference Include="System.Xaml">
62+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
63+
</Reference>
64+
<Reference Include="WindowsBase" />
65+
<Reference Include="PresentationCore" />
66+
<Reference Include="PresentationFramework" />
67+
</ItemGroup>
68+
<ItemGroup>
69+
<ApplicationDefinition Include="App.xaml">
70+
<Generator>MSBuild:Compile</Generator>
71+
<SubType>Designer</SubType>
72+
</ApplicationDefinition>
73+
<Compile Include="Model\NWind1.designer.cs">
74+
<AutoGen>True</AutoGen>
75+
<DesignTime>True</DesignTime>
76+
<DependentUpon>NWind.dbml</DependentUpon>
77+
</Compile>
78+
<Compile Include="Resources\Syncfusion.SfGrid.WPF.Designer.cs">
79+
<DependentUpon>Syncfusion.SfGrid.WPF.resx</DependentUpon>
80+
<AutoGen>True</AutoGen>
81+
<DesignTime>True</DesignTime>
82+
</Compile>
83+
<Compile Include="ViewModel\OrderInfoViewModel.cs" />
84+
<Page Include="MainWindow.xaml">
85+
<Generator>MSBuild:Compile</Generator>
86+
<SubType>Designer</SubType>
87+
</Page>
88+
<Compile Include="App.xaml.cs">
89+
<DependentUpon>App.xaml</DependentUpon>
90+
<SubType>Code</SubType>
91+
</Compile>
92+
<Compile Include="MainWindow.xaml.cs">
93+
<DependentUpon>MainWindow.xaml</DependentUpon>
94+
<SubType>Code</SubType>
95+
</Compile>
96+
</ItemGroup>
97+
<ItemGroup>
98+
<Compile Include="Properties\AssemblyInfo.cs">
99+
<SubType>Code</SubType>
100+
</Compile>
101+
<Compile Include="Properties\Resources.Designer.cs">
102+
<AutoGen>True</AutoGen>
103+
<DesignTime>True</DesignTime>
104+
<DependentUpon>Resources.resx</DependentUpon>
105+
</Compile>
106+
<Compile Include="Properties\Settings.Designer.cs">
107+
<AutoGen>True</AutoGen>
108+
<DependentUpon>Settings.settings</DependentUpon>
109+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
110+
</Compile>
111+
<EmbeddedResource Include="Resources\Syncfusion.SfGrid.WPF.resx">
112+
<Generator>ResXFileCodeGenerator</Generator>
113+
<LastGenOutput>Syncfusion.SfGrid.WPF.Designer.cs</LastGenOutput>
114+
</EmbeddedResource>
115+
<None Include="Model\NWind.dbml.layout">
116+
<DependentUpon>NWind.dbml</DependentUpon>
117+
</None>
118+
<EmbeddedResource Include="Properties\Resources.resx">
119+
<Generator>ResXFileCodeGenerator</Generator>
120+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
121+
</EmbeddedResource>
122+
<EmbeddedResource Include="Resources\Syncfusion.SfGrid.WPF.de.resx" />
123+
<None Include="Model\NWind.dbml">
124+
<Generator>MSLinqToSQLGenerator</Generator>
125+
<LastGenOutput>NWind1.designer.cs</LastGenOutput>
126+
<SubType>Designer</SubType>
127+
</None>
128+
<None Include="packages.config" />
129+
<None Include="Properties\Settings.settings">
130+
<Generator>SettingsSingleFileGenerator</Generator>
131+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
132+
</None>
133+
<AppDesigner Include="Properties\" />
134+
</ItemGroup>
135+
<ItemGroup>
136+
<Resource Include="Resources\App.ico" />
137+
</ItemGroup>
138+
<ItemGroup>
139+
<Service Include="{3259AA49-8AA1-44D3-9025-A0B520596A8C}" />
140+
</ItemGroup>
141+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
142+
<ItemGroup>
143+
<Content Include="Northwind.sdf">
144+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
145+
</Content>
146+
</ItemGroup>
147+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
148+
Other similar extension points exist, see Microsoft.Common.targets.
149+
<Target Name="BeforeBuild">
150+
</Target>
151+
<Target Name="AfterBuild">
152+
</Target>
153+
-->
154+
</Project>

LocalizationDemo.sln

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio 15
3+
VisualStudioVersion = 15.0.26020.0
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalizationDemo", "LocalizationDemo.csproj", "{2D7FE8E4-9786-4046-9C72-EE1378F74AF3}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|x86 = Debug|x86
10+
Release|x86 = Release|x86
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{2D7FE8E4-9786-4046-9C72-EE1378F74AF3}.Debug|x86.ActiveCfg = Debug|x86
14+
{2D7FE8E4-9786-4046-9C72-EE1378F74AF3}.Debug|x86.Build.0 = Debug|x86
15+
{2D7FE8E4-9786-4046-9C72-EE1378F74AF3}.Release|x86.ActiveCfg = Release|x86
16+
{2D7FE8E4-9786-4046-9C72-EE1378F74AF3}.Release|x86.Build.0 = Release|x86
17+
EndGlobalSection
18+
GlobalSection(SolutionProperties) = preSolution
19+
HideSolutionNode = FALSE
20+
EndGlobalSection
21+
GlobalSection(ExtensibilityGlobals) = postSolution
22+
SolutionGuid = {5F7B466B-9DD4-4D68-8EB4-43C3D5142C92}
23+
EndGlobalSection
24+
EndGlobal

MainWindow.xaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<Window x:Class="LocalizationDemo.MainWindow"
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:LocalizationDemo"
5+
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
6+
Title="Localization Demo"
7+
Icon="/LocalizationDemo;component/Resources/App.ico">
8+
9+
<Window.DataContext>
10+
<local:OrderInfoViewModel />
11+
</Window.DataContext>
12+
13+
<Grid>
14+
<syncfusion:SfDataGrid Margin="10"
15+
AllowFiltering="True"
16+
AllowGrouping="True"
17+
AutoGenerateColumns="False"
18+
ColumnSizer="Star"
19+
GroupCaptionTextFormat="'{ColumnName} : {Key} - {ItemsCount} Artikel'"
20+
GroupDropAreaText="Ziehen Sie eine Spaltenüberschrift Sie hier, um nach dieser Spalte Gruppe"
21+
IsGroupDropAreaExpanded="True"
22+
ItemsSource="{Binding OrdersDetails}"
23+
NavigationMode="Row"
24+
ShowGroupDropArea="True">
25+
<syncfusion:SfDataGrid.Columns>
26+
27+
<syncfusion:GridTextColumn HeaderText="Bestellen ID"
28+
MappingName="OrderID"
29+
TextAlignment="Right" />
30+
<syncfusion:GridTextColumn HeaderText="Auftraggeber ID" MappingName="CustomerID" />
31+
<syncfusion:GridTextColumn HeaderText="Mitarbeiter ID"
32+
MappingName="EmployeeID"
33+
TextAlignment="Right" />
34+
<syncfusion:GridTextColumn HeaderText="Verschiffen Stadt" MappingName="ShipCity" />
35+
<syncfusion:GridTextColumn HeaderText="Verschiffen Land" MappingName="ShipCountry" />
36+
<syncfusion:GridTextColumn DisplayBinding="{Binding Path=Freight,
37+
StringFormat='{}{0:C}'}"
38+
HeaderText="Frachtkosten"
39+
TextAlignment="Right" />
40+
41+
</syncfusion:SfDataGrid.Columns>
42+
</syncfusion:SfDataGrid>
43+
</Grid>
44+
</Window>

MainWindow.xaml.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#region Copyright Syncfusion Inc. 2001 - 2019
2+
// Copyright Syncfusion Inc. 2001 - 2019. All rights reserved.
3+
// Use of this code is subject to the terms of our license.
4+
// A copy of the current license can be obtained at any time by e-mailing
5+
// licensing@syncfusion.com. Any infringement will be prosecuted under
6+
// applicable laws.
7+
#endregion
8+
using Syncfusion.Windows.Shared;
9+
using System;
10+
using System.Collections.Generic;
11+
using System.Linq;
12+
using System.Text;
13+
using System.Windows;
14+
using System.Windows.Controls;
15+
using System.Windows.Data;
16+
using System.Windows.Documents;
17+
using System.Windows.Input;
18+
using System.Windows.Media;
19+
using System.Windows.Media.Imaging;
20+
using System.Windows.Navigation;
21+
using System.Windows.Shapes;
22+
23+
namespace LocalizationDemo
24+
{
25+
/// <summary>
26+
/// Interaction logic for MainWindow.xaml
27+
/// </summary>
28+
public partial class MainWindow : Window
29+
{
30+
public MainWindow()
31+
{
32+
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de");
33+
InitializeComponent();
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)