Skip to content

Commit 91b317d

Browse files
committed
Add DataGridAsyncDemoMVVM simple, withou filtering and sorting
1 parent cc66af9 commit 91b317d

25 files changed

Lines changed: 1235 additions & 2 deletions

AlphaChiTech.Virtualization.sln

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27004.2009
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataGridAsyncDemo", "DataGridAsyncDemo\DataGridAsyncDemo.csproj", "{B1235F30-C8A9-4A18-B870-A7F23F214039}"
77
EndProject
@@ -14,6 +14,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{90A3E4
1414
EndProject
1515
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlphaChiTech.Virtualization.Net4", "AlphaChiTech.Virtualization.Net4\AlphaChiTech.Virtualization.Net4.csproj", "{ECEDC613-843A-4D9A-8123-BD9600C9118E}"
1616
EndProject
17+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataGridAsyncDemoMVVM", "DataGridAsyncDemoMVVM\DataGridAsyncDemoMVVM.csproj", "{DE19AAA5-881C-48BE-A8E7-A8799F5C4BD3}"
18+
EndProject
1719
Global
1820
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1921
Debug|Any CPU = Debug|Any CPU
@@ -28,8 +30,15 @@ Global
2830
{ECEDC613-843A-4D9A-8123-BD9600C9118E}.Debug|Any CPU.Build.0 = Debug|Any CPU
2931
{ECEDC613-843A-4D9A-8123-BD9600C9118E}.Release|Any CPU.ActiveCfg = Release|Any CPU
3032
{ECEDC613-843A-4D9A-8123-BD9600C9118E}.Release|Any CPU.Build.0 = Release|Any CPU
33+
{DE19AAA5-881C-48BE-A8E7-A8799F5C4BD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34+
{DE19AAA5-881C-48BE-A8E7-A8799F5C4BD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
35+
{DE19AAA5-881C-48BE-A8E7-A8799F5C4BD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
36+
{DE19AAA5-881C-48BE-A8E7-A8799F5C4BD3}.Release|Any CPU.Build.0 = Release|Any CPU
3137
EndGlobalSection
3238
GlobalSection(SolutionProperties) = preSolution
3339
HideSolutionNode = FALSE
3440
EndGlobalSection
41+
GlobalSection(ExtensibilityGlobals) = postSolution
42+
SolutionGuid = {D457F9E2-2C21-4C1F-93EA-EE4DAD2CA2E4}
43+
EndGlobalSection
3544
EndGlobal

DataGridAsyncDemoMVVM/App.config

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

DataGridAsyncDemoMVVM/App.xaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Application x:Class="DataGridAsyncDemoMVVM.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:DataGridAsyncDemoMVVM"
5+
xmlns:system="clr-namespace:System;assembly=mscorlib"
6+
StartupUri="MainWindow.xaml">
7+
<Application.Resources>
8+
9+
<local:MainViewModel x:Key="MainViewModel" />
10+
</Application.Resources>
11+
</Application>

DataGridAsyncDemoMVVM/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 DataGridAsyncDemoMVVM
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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>{DE19AAA5-881C-48BE-A8E7-A8799F5C4BD3}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>DataGridAsyncDemoMVVM</RootNamespace>
10+
<AssemblyName>DataGridAsyncDemoMVVM</AssemblyName>
11+
<TargetFrameworkVersion>v4.7</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+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<PlatformTarget>AnyCPU</PlatformTarget>
19+
<DebugSymbols>true</DebugSymbols>
20+
<DebugType>full</DebugType>
21+
<Optimize>false</Optimize>
22+
<OutputPath>bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<ErrorReport>prompt</ErrorReport>
25+
<WarningLevel>4</WarningLevel>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28+
<PlatformTarget>AnyCPU</PlatformTarget>
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>bin\Release\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<Reference Include="System" />
38+
<Reference Include="System.Data" />
39+
<Reference Include="System.Linq.Dynamic">
40+
<HintPath>..\packages\System.Linq.Dynamic.1.0.7\lib\net40\System.Linq.Dynamic.dll</HintPath>
41+
</Reference>
42+
<Reference Include="System.Xml" />
43+
<Reference Include="Microsoft.CSharp" />
44+
<Reference Include="System.Core" />
45+
<Reference Include="System.Xml.Linq" />
46+
<Reference Include="System.Data.DataSetExtensions" />
47+
<Reference Include="System.Net.Http" />
48+
<Reference Include="System.Xaml">
49+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
50+
</Reference>
51+
<Reference Include="WindowsBase" />
52+
<Reference Include="PresentationCore" />
53+
<Reference Include="PresentationFramework" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<ApplicationDefinition Include="App.xaml">
57+
<Generator>MSBuild:Compile</Generator>
58+
<SubType>Designer</SubType>
59+
</ApplicationDefinition>
60+
<Compile Include="filtersort\DescriptionList.cs" />
61+
<Compile Include="filtersort\FilterDescription.cs" />
62+
<Compile Include="filtersort\FilterDescriptionList.cs" />
63+
<Compile Include="filtersort\IFilteredSortedSourceProviderAsync.cs" />
64+
<Compile Include="filtersort\IFilterOrderDescription.cs" />
65+
<Compile Include="filtersort\ParentOfTypeExtensions.cs" />
66+
<Compile Include="filtersort\SortDescription.cs" />
67+
<Compile Include="filtersort\SortDescriptionList.cs" />
68+
<Compile Include="MainViewModel.cs" />
69+
<Compile Include="RemoteOrDbDataItem.cs" />
70+
<Compile Include="RemoteOrDbDataSourceAsyncProxy.cs" />
71+
<Compile Include="RemoteOrDbDataSourceEmulation.cs" />
72+
<Page Include="MainWindow.xaml">
73+
<Generator>MSBuild:Compile</Generator>
74+
<SubType>Designer</SubType>
75+
</Page>
76+
<Compile Include="App.xaml.cs">
77+
<DependentUpon>App.xaml</DependentUpon>
78+
<SubType>Code</SubType>
79+
</Compile>
80+
<Compile Include="MainWindow.xaml.cs">
81+
<DependentUpon>MainWindow.xaml</DependentUpon>
82+
<SubType>Code</SubType>
83+
</Compile>
84+
</ItemGroup>
85+
<ItemGroup>
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+
<ItemGroup>
113+
<ProjectReference Include="..\AlphaChiTech.Virtualization.Net4\AlphaChiTech.Virtualization.Net4.csproj">
114+
<Project>{ecedc613-843a-4d9a-8123-bd9600c9118e}</Project>
115+
<Name>AlphaChiTech.Virtualization.Net4</Name>
116+
</ProjectReference>
117+
</ItemGroup>
118+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
119+
</Project>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using AlphaChiTech.Virtualization;
7+
8+
namespace DataGridAsyncDemoMVVM
9+
{
10+
class MainViewModel
11+
{
12+
private VirtualizingObservableCollection<RemoteOrDbDataItem> _myDataVirtualizedAsyncFilterSortObservableCollection = null;
13+
private RemoteOrDbDataSourceAsyncProxy _myRemoteOrDbDataSourceAsyncProxy = null;
14+
15+
public VirtualizingObservableCollection<RemoteOrDbDataItem> MyDataVirtualizedAsyncFilterSortObservableCollection
16+
{
17+
get
18+
{
19+
if (this._myDataVirtualizedAsyncFilterSortObservableCollection == null)
20+
{
21+
this._myRemoteOrDbDataSourceAsyncProxy = new RemoteOrDbDataSourceAsyncProxy(new RemoteOrDbDataSourceEmulation());
22+
this._myDataVirtualizedAsyncFilterSortObservableCollection =
23+
new VirtualizingObservableCollection<RemoteOrDbDataItem>(
24+
new PaginationManager<RemoteOrDbDataItem>(this._myRemoteOrDbDataSourceAsyncProxy, pageSize: 10, maxPages: 2));
25+
}
26+
return this._myDataVirtualizedAsyncFilterSortObservableCollection;
27+
}
28+
}
29+
}
30+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<Window x:Class="DataGridAsyncDemoMVVM.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
Title="TheMainWindow"
5+
Width="525"
6+
Height="350"
7+
DataContext="{StaticResource MainViewModel}"
8+
>
9+
<Grid>
10+
<Grid.RowDefinitions>
11+
<RowDefinition Height="Auto" />
12+
<RowDefinition />
13+
</Grid.RowDefinitions>
14+
15+
<DataGrid x:Name="TstDataGridAsyncFilterSort"
16+
Grid.Row="1"
17+
CanUserSortColumns="True"
18+
ItemsSource="{Binding MyDataVirtualizedAsyncFilterSortObservableCollection}">
19+
20+
<DataGrid.ColumnHeaderStyle>
21+
<Style TargetType="DataGridColumnHeader">
22+
<Setter Property="HorizontalAlignment" Value="Stretch" />
23+
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
24+
<Setter Property="ContentTemplate">
25+
<Setter.Value>
26+
<DataTemplate>
27+
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
28+
<Grid.RowDefinitions>
29+
<RowDefinition Height="Auto" />
30+
<RowDefinition Height="Auto" />
31+
</Grid.RowDefinitions>
32+
<TextBlock Grid.Row="0" Text="{Binding Mode=OneTime}" />
33+
<TextBox x:Name="FilterTextBox"
34+
Grid.Row="1"
35+
HorizontalAlignment="Stretch"
36+
VerticalAlignment="Stretch"
37+
HorizontalContentAlignment="Stretch"
38+
VerticalContentAlignment="Stretch"
39+
Background="GhostWhite"
40+
BorderThickness="0"
41+
Padding="0" />
42+
</Grid>
43+
</DataTemplate>
44+
</Setter.Value>
45+
</Setter>
46+
</Style>
47+
</DataGrid.ColumnHeaderStyle>
48+
</DataGrid>
49+
</Grid>
50+
</Window>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#region
2+
3+
using System;
4+
using System.Diagnostics;
5+
using System.Windows;
6+
using System.Windows.Threading;
7+
using AlphaChiTech.Virtualization;
8+
9+
#endregion
10+
11+
namespace DataGridAsyncDemoMVVM
12+
{
13+
#region
14+
15+
#endregion
16+
17+
/// <summary>
18+
/// Interaction logic for MainWindow.xaml
19+
/// </summary>
20+
public partial class MainWindow : Window
21+
{
22+
public MainWindow()
23+
{
24+
//this routine only needs to run once, so first check to make sure the
25+
//VirtualizationManager isn’t already initialized
26+
if (!VirtualizationManager.IsInitialized)
27+
{
28+
//set the VirtualizationManager’s UIThreadExcecuteAction. In this case
29+
//we’re using Dispatcher.Invoke to give the VirtualizationManager access
30+
//to the dispatcher thread, and using a DispatcherTimer to run the background
31+
//operations the VirtualizationManager needs to run to reclaim pages and manage memory.
32+
VirtualizationManager.Instance.UIThreadExcecuteAction = a => Application.Current.Dispatcher.Invoke(a);
33+
new DispatcherTimer(TimeSpan.FromMilliseconds(10),
34+
DispatcherPriority.Background,
35+
delegate { VirtualizationManager.Instance.ProcessActions(); },
36+
this.Dispatcher).Start();
37+
}
38+
39+
this.InitializeComponent();
40+
}
41+
}
42+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
using System.Windows;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("DataGridAsyncDemoMVVM")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("DataGridAsyncDemoMVVM")]
13+
[assembly: AssemblyCopyright("Copyright © 2017")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
//In order to begin building localizable applications, set
23+
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
24+
//inside a <PropertyGroup>. For example, if you are using US english
25+
//in your source files, set the <UICulture> to en-US. Then uncomment
26+
//the NeutralResourceLanguage attribute below. Update the "en-US" in
27+
//the line below to match the UICulture setting in the project file.
28+
29+
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
30+
31+
32+
[assembly: ThemeInfo(
33+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
34+
//(used if a resource is not found in the page,
35+
// or application resource dictionaries)
36+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
37+
//(used if a resource is not found in the page,
38+
// app, or any theme specific resource dictionaries)
39+
)]
40+
41+
42+
// Version information for an assembly consists of the following four values:
43+
//
44+
// Major Version
45+
// Minor Version
46+
// Build Number
47+
// Revision
48+
//
49+
// You can specify all the values or you can default the Build and Revision Numbers
50+
// by using the '*' as shown below:
51+
// [assembly: AssemblyVersion("1.0.*")]
52+
[assembly: AssemblyVersion("1.0.0.0")]
53+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)