Demo: Controls/DataGrid

This commit is contained in:
Zihan Chen
2017-06-12 21:19:13 -07:00
parent 00745eaf7c
commit b30259bc6b
16 changed files with 6232 additions and 0 deletions
+3
View File
@@ -15,4 +15,7 @@ call Codegen.bat
popd
pushd ListControls\UI
call Codegen.bat
popd
pushd DataGrid\UI
call Codegen.bat
popd
@@ -0,0 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>DataGrid</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\..\Import;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\..\Import;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\..\Import;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)..\..\..\Import;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Main.cpp" />
<ClCompile Include="UI\Source\DemoPartialClasses.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="UI\Source\Demo.h" />
<ClInclude Include="UI\Source\DemoPartialClasses.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Lib\GacUILite\GacUILite.vcxproj">
<Project>{96c559ca-9718-4bec-a053-28a0ab6a8ca2}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="UI">
<UniqueIdentifier>{c4d1e5fd-cdd8-4fdd-8f2f-13cac8339080}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="UI\Source\DemoPartialClasses.cpp">
<Filter>UI</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="UI\Source\DemoPartialClasses.h">
<Filter>UI</Filter>
</ClInclude>
<ClInclude Include="UI\Source\Demo.h">
<Filter>UI</Filter>
</ClInclude>
</ItemGroup>
</Project>
+25
View File
@@ -0,0 +1,25 @@
#define GAC_HEADER_USE_NAMESPACE
#include "UI/Source/Demo.h"
#include <Windows.h>
using namespace vl::collections;
using namespace vl::stream;
using namespace vl::reflection::description;
using namespace demo;
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int CmdShow)
{
return SetupWindowsDirect2DRenderer();
}
void GuiMain()
{
{
FileStream fileStream(L"../UIRes/DataGrid.bin", FileStream::ReadOnly);
auto resource = GuiResource::LoadPrecompiledBinary(fileStream);
GetResourceManager()->SetResource(L"Resource", resource);
}
demo::MainWindow window;
window.MoveToScreenCenter();
GetApplication()->Run(&window);
}
@@ -0,0 +1 @@
..\..\..\..\Tools\GacGen.exe Resource.xml
@@ -0,0 +1,252 @@
<Folder>
<Folder name="GenderComponents">
<Instance name="GenderDisplayerResource">
<Instance ref.CodeBehind="false" ref.Class="demo::GenderDisplayer">
<ref.Members>
<![CDATA[
prop Gender : MyGender = Male {}
]]>
</ref.Members>
<CustomControl ref.Name="self">
<Bounds AlignmentToParent="left:2 top:2 right:2 bottom:2" MinSizeLimitation="LimitToElement">
<ImageFrame HorizontalAlignment="Left" VerticalAlignment="Center">
<att.Image-bind>(cast (GuiImageData^) self.ResolveResource("res", $"Images/$(ToString(self.Gender))", true)).Image</att.Image-bind>
</ImageFrame>
</Bounds>
</CustomControl>
</Instance>
</Instance>
<Instance name="GenderVisualizerResource">
<Instance ref.CodeBehind="false" ref.Class="demo::GenderVisualizer" xmlns:demo="demo::*">
<GridVisualizerTemplate ref.Name="self">
<demo:GenderDisplayer Gender-bind="(cast MyGender self.CellValue) ?? MyGender::Male">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
</demo:GenderDisplayer>
</GridVisualizerTemplate>
</Instance>
</Instance>
<Instance name="GenderItemTemplateResource">
<Instance ref.CodeBehind="false" ref.Class="demo::GenderItemTemplate" xmlns:demo="demo::*">
<ref.Parameter Name="SelectedGender" Class="demo::MyGender"/>
<TextListItemTemplate MinSizeLimitation="LimitToElementAndChildren">
<demo:GenderDisplayer Gender-eval="SelectedGender">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
</demo:GenderDisplayer>
</TextListItemTemplate>
</Instance>
</Instance>
<Instance name="GenderEditorResource">
<Instance ref.CodeBehind="false" ref.Class="demo::GenderEditor" xmlns:demo="demo::*">
<ref.Members>
<![CDATA[
var items : MyGender[] =
{
Male of MyGender
Female of MyGender
};
]]>
</ref.Members>
<GridEditorTemplate ref.Name="self" CellValue-bind="comboBox.SelectedItem">
<ComboBox ref.Name="comboBox" ItemTemplate="demo:GenderItemTemplate" SelectedIndex-bind="self.items.IndexOf(self.CellValue)">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<att.ListControl>
<BindableTextList ItemSource-eval="self.items" ItemTemplate="demo:GenderItemTemplate" HorizontalAlwaysVisible="false" VerticalAlwaysVisible="false"/>
</att.ListControl>
</ComboBox>
</GridEditorTemplate>
</Instance>
</Instance>
</Folder>
<Folder name="CategoryComponents">
<Instance name="CategoryDisplayerResource">
<Instance ref.CodeBehind="false" ref.Class="demo::CategoryDisplayer">
<ref.Members>
<![CDATA[
prop Category : MyCategory = Black {}
]]>
</ref.Members>
<CustomControl ref.Name="self">
<Table AlignmentToParent="left:2 top:2 right:2 bottom:2" MinSizeLimitation="LimitToElementAndChildren">
<att.Rows>
<_>composeType:Percentage percentage:0.5</_>
<_>composeType:Absolute absolute:16</_>
<_>composeType:Percentage percentage:0.5</_>
</att.Rows>
<att.Columns>
<_>composeType:Absolute absolute:2</_>
<_>composeType:Absolute absolute:16</_>
<_>composeType:Absolute absolute:2</_>
<_>composeType:Percentage percentage:1.0</_>
</att.Columns>
<Cell Site="row:1 column:1">
<SolidBorder Color="#000000"/>
<Bounds AlignmentToParent="left:1 top:1 right:1 bottom:1">
<SolidBackground Color-bind="ToColor(self.Category)"/>
</Bounds>
</Cell>
<Cell Site="row:0 column:3 rowSpan:3">
<SolidLabel Text-bind="ToString(self.Category)" Font-bind="self.Font" HorizontalAlignment="Left" VerticalAlignment="Center" Ellipse="true"/>
</Cell>
</Table>
</CustomControl>
</Instance>
</Instance>
<Instance name="CategoryVisualizerResource">
<Instance ref.CodeBehind="false" ref.Class="demo::CategoryVisualizer" xmlns:demo="demo::*">
<GridVisualizerTemplate ref.Name="self">
<demo:CategoryDisplayer Category-bind="(cast MyCategory self.CellValue) ?? MyCategory::Black" Font-bind="self.Font">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
</demo:CategoryDisplayer>
</GridVisualizerTemplate>
</Instance>
</Instance>
<Instance name="CategoryItemTemplateResource">
<Instance ref.CodeBehind="false" ref.Class="demo::CategoryItemTemplate" xmlns:demo="demo::*">
<ref.Parameter Name="SelectedCategory" Class="demo::MyCategory"/>
<TextListItemTemplate ref.Name="self" MinSizeLimitation="LimitToElementAndChildren">
<demo:CategoryDisplayer Category-eval="SelectedCategory" Font-bind="self.Font">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
</demo:CategoryDisplayer>
</TextListItemTemplate>
</Instance>
</Instance>
<Instance name="CategoryEditorResource">
<Instance ref.CodeBehind="false" ref.Class="demo::CategoryEditor" xmlns:demo="demo::*">
<ref.Members>
<![CDATA[
var items : MyCategory[] =
{
Black of MyCategory
Red of MyCategory
Lime of MyCategory
Blue of MyCategory
White of MyCategory
};
]]>
</ref.Members>
<GridEditorTemplate ref.Name="self" CellValue-bind="comboBox.SelectedItem">
<ComboBox ref.Name="comboBox" ItemTemplate="demo:CategoryItemTemplate" SelectedIndex-bind="self.items.IndexOf(self.CellValue)">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<att.ListControl>
<BindableTextList ItemSource-eval="self.items" ItemTemplate="demo:CategoryItemTemplate" HorizontalAlwaysVisible="false" VerticalAlwaysVisible="false"/>
</att.ListControl>
</ComboBox>
</GridEditorTemplate>
</Instance>
</Instance>
</Folder>
<Instance name="TextEditorResource">
<Instance ref.CodeBehind="false" ref.Class="demo::TextEditor">
<GridEditorTemplate ref.Name="self" CellValue-bind="textBox.Text" FocusControl-ref="textBox">
<SinglelineTextBox ref.Name="textBox" Text-bind="(cast string self.CellValue) ?? ''">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
</SinglelineTextBox>
</GridEditorTemplate>
</Instance>
</Instance>
<Instance name="DateEditorResource">
<Instance ref.CodeBehind="false" ref.Class="demo::DateEditor">
<GridEditorTemplate ref.Name="self" CellValue-bind="comboBox.SelectedDate" FocusControl-ref="comboBox">
<DateComboBox ref.Name="comboBox" SelectedDate-bind="(cast DateTime self.CellValue) ?? (cast DateTime '2000-01-01 00:00:00.000')">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
</DateComboBox>
</GridEditorTemplate>
</Instance>
</Instance>
<Instance name="DateFilterResource">
<Instance ref.CodeBehind="false" ref.Class="demo::DateFilter">
<ref.Members>
<![CDATA[
@cpp:Private
var callback : IDataProcessorCallback* = null;
@cpp:Private
func UpdateFilter() : void
{
if (callback is not null)
{
callback.OnProcessorChanged();
}
}
prop Filter : IDataFilter^ = null {const, not observe}
]]>
</ref.Members>
<ref.Ctor>
<![CDATA[
SetFilter(
new IDataFilter^
{
override func SetCallback(value : IDataProcessorCallback*) : void
{
callback = value;
}
override func Filter(row : object) : bool
{
var date = (cast (MyDataItem^) row).Birthday;
if (checkFrom.Selected)
{
if (Sys::CompareDateTime(date, dateFrom.SelectedDate) < 0)
{
return false;
}
}
if (checkTo.Selected)
{
if (Sys::CompareDateTime(date, dateTo.SelectedDate) > 0)
{
return false;
}
}
return true;
}
}
);
]]>
</ref.Ctor>
<CustomControl ref.Name="self">
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0" CellPadding="5" MinSizeLimitation="LimitToElementAndChildren">
<att.Rows>
<_>composeType:MinSize</_>
<_>composeType:MinSize</_>
</att.Rows>
<att.Columns>
<_>composeType:MinSize</_>
<_>composeType:MinSize</_>
</att.Columns>
<Cell Site="row:0 column:0">
<CheckBox ref.Name="checkFrom" Text="From:" ev.SelectedChanged-eval="self.UpdateFilter();"/>
</Cell>
<Cell Site="row:0 column:1">
<DateComboBox ref.Name="dateFrom" Enabled-bind="checkFrom.Selected" SelectedDate="1988-01-01 00:00:00.000" ev.SelectedDateChanged-eval="self.UpdateFilter();">
<att.BoundsComposition-set PreferredMinSize="x:120"/>
</DateComboBox>
</Cell>
<Cell Site="row:1 column:0">
<CheckBox ref.Name="checkTo" Text="To:" ev.SelectedChanged-eval="self.UpdateFilter();"/>
</Cell>
<Cell Site="row:1 column:1">
<DateComboBox ref.Name="dateTo" Enabled-bind="checkTo.Selected" SelectedDate="2000-01-01 00:00:00.000" ev.SelectedDateChanged-eval="self.UpdateFilter();">
<att.BoundsComposition-set PreferredMinSize="x:120"/>
</DateComboBox>
</Cell>
</Table>
</CustomControl>
</Instance>
</Instance>
</Folder>
Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

@@ -0,0 +1,268 @@
<Resource>
<Folder name="GacGenConfig">
<Folder name="Cpp">
<Text name="SourceFolder">Source</Text>
<Text name="Resource">..\..\UIRes\DataGrid.bin</Text>
<Text name="NormalInclude">GacUI.h</Text>
<Text name="ReflectionInclude">GacUIReflection.h</Text>
<Text name="Name">Demo</Text>
</Folder>
</Folder>
<Instance name="MainWindowResource">
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow" xmlns:demo="demo::*">
<ref.Ctor>
<![CDATA[
{
var tempData : MyDataItem^[] =
{
new MyDataItem^("涼宮 春日", Female, Lime, (cast DateTime "1988-08-08 00:00:00.000"), "http://www.haruhi.tv/")
new MyDataItem^("キョン", Male, Black, (cast DateTime "1988-08-08 00:00:00.000"), "http://www.haruhi.tv/")
new MyDataItem^("长门 有希", Female, White, (cast DateTime "2000-08-06 00:00:00.000"), "http://www.haruhi.tv/")
new MyDataItem^("朝比奈 实玖瑠", Female, Red, (cast DateTime "1987-08-30 00:00:00.000"), "http://www.haruhi.tv/")
new MyDataItem^("古泉 一树", Male, Blue, (cast DateTime "1986-08-12 00:00:00.000"), "http://www.haruhi.tv/")
};
var largeImage = cast (GuiImageData^) (ResolveResource("res", "Images/Large", true));
var smallImage = cast (GuiImageData^) (ResolveResource("res", "Images/Small", true));
for(item in tempData)
{
item.LargeImage = largeImage;
item.SmallImage = smallImage;
}
dataGrid.ItemSource = tempData;
}
]]>
</ref.Ctor>
<Window ref.Name="self" Text="DataGrid" ClientSize="x:640 y:480">
<att.BoundsComposition-set PreferredMinSize="x:640 y:480"/>
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0" CellPadding="5">
<att.Rows>
<_>composeType:MinSize</_>
<_>composeType:Percentage percentage:1.0</_>
</att.Rows>
<att.Columns>
<_>composeType:Percentage percentage:1.0</_>
</att.Columns>
<Cell Site="row:0 column:0">
<ComboBox ref.Name="comboView" Alt="V" SelectedIndex="6">
<att.BoundsComposition-set PreferredMinSize="x:120"/>
<att.ListControl>
<TextList HorizontalAlwaysVisible="false" VerticalAlwaysVisible="false">
<att.Items>
<TextItem Text="BigIcon"/>
<TextItem Text="SmallIcon"/>
<TextItem Text="List"/>
<TextItem Text="Tile"/>
<TextItem Text="Information"/>
<TextItem Text="Detail"/>
<TextItem Text="DataGrid"/>
</att.Items>
</TextList>
</att.ListControl>
<ev.SelectedIndexChanged-eval>
<![CDATA[
{
switch (comboView.SelectedIndex)
{
case 0:
{
dataGrid.View = BigIcon;
}
case 1:
{
dataGrid.View = SmallIcon;
}
case 2:
{
dataGrid.View = ListViewView::List;
}
case 3:
{
dataGrid.View = Tile;
}
case 4:
{
dataGrid.View = Information;
}
case 5:
{
dataGrid.View = Detail;
}
case 6:
{
dataGrid.SetViewToDefault();
}
}
}
]]>
</ev.SelectedIndexChanged-eval>
</ComboBox>
</Cell>
<Cell Site="row:1 column:0">
<BindableDataGrid ref.Name="dataGrid" Alt="L" env.ItemType="demo::MyDataItem^" env.ItemName="itemToBind" HorizontalAlwaysVisible="false" VerticalAlwaysVisible="false">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<att.LargeImageProperty>LargeImage</att.LargeImageProperty>
<att.SmallImageProperty>SmallImage</att.SmallImageProperty>
<att.Columns>
<DataColumn Text="Name" Size="120">
<att.TextProperty>Name</att.TextProperty>
<att.ValueProperty>Name</att.ValueProperty>
<att.EditorFactory>demo:TextEditor</att.EditorFactory>
<att.Sorter>[Sys::CompareString($1.Name, $2.Name)]</att.Sorter>
</DataColumn>
<DataColumn Text="Gender" Size="80">
<att.TextProperty>demo::ToString(itemToBind.Gender)</att.TextProperty>
<att.ValueProperty>Gender</att.ValueProperty>
<att.VisualizerFactory>demo:GenderVisualizer;CellBorderVisualizerTemplate</att.VisualizerFactory>
<att.EditorFactory>demo:GenderEditor</att.EditorFactory>
<att.Sorter>[Sys::CompareUInt64(cast UInt64 ($1.Gender), cast UInt64 ($2.Gender))]</att.Sorter>
</DataColumn>
<DataColumn Text="Category" Size="80">
<att.TextProperty>demo::ToString(itemToBind.Category)</att.TextProperty>
<att.ValueProperty>Category</att.ValueProperty>
<att.VisualizerFactory>demo:CategoryVisualizer;CellBorderVisualizerTemplate</att.VisualizerFactory>
<att.EditorFactory>demo:CategoryEditor</att.EditorFactory>
<att.Sorter>[Sys::CompareUInt64(cast UInt64 ($1.Category), cast UInt64 ($2.Category))]</att.Sorter>
</DataColumn>
<DataColumn Text="Birthday" Size="80">
<att.TextProperty>demo::ToString(itemToBind.Birthday)</att.TextProperty>
<att.ValueProperty>Birthday</att.ValueProperty>
<att.EditorFactory>demo:DateEditor</att.EditorFactory>
<att.Sorter>[Sys::CompareDateTime($1.Birthday, $2.Birthday)]</att.Sorter>
<att.Filter-eval>dateFilter.Filter</att.Filter-eval>
<att.Popup>
<ToolstripMenu>
<demo:DateFilter ref.Name="dateFilter">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
</demo:DateFilter>
</ToolstripMenu>
</att.Popup>
</DataColumn>
<DataColumn Text="Website" Size="160">
<att.TextProperty>Website</att.TextProperty>
<att.ValueProperty>Website</att.ValueProperty>
<att.VisualizerFactory>HyperlinkVisualizerTemplate;CellBorderVisualizerTemplate</att.VisualizerFactory>
<att.EditorFactory>demo:TextEditor</att.EditorFactory>
<att.Sorter>[Sys::CompareString($1.Website, $2.Website)]</att.Sorter>
</DataColumn>
</att.Columns>
<att.DataColumns>
<_>0</_>
</att.DataColumns>
</BindableDataGrid>
</Cell>
</Table>
</Window>
</Instance>
</Instance>
<Folder name="DataGridComponents" content="Link">DataGridComponents.xml</Folder>
<Folder name="Images">
<Image name="Large" content="File">Large.png</Image>
<Image name="Small" content="File">Small.png</Image>
<Image name="Male" content="File">Male.png</Image>
<Image name="Female" content="File">Female.png</Image>
</Folder>
<Script name="ViewModelResource">
<Workflow>
<![CDATA[
module viewmodel;
using system::*;
using presentation::*;
namespace demo
{
enum MyCategory
{
Black = 0,
Red = 1,
Lime = 2,
Blue = 3,
White = 4,
}
enum MyGender
{
Male = 0,
Female = 1,
}
class MyDataItem
{
prop Name : string = "" {not observe}
prop Gender : MyGender = Male {not observe}
prop Category : MyCategory = White {not observe}
prop Birthday : DateTime = (cast DateTime "2000-01-01 00:00:00.000") {not observe}
prop Website : string = "" {not observe}
prop LargeImage : GuiImageData^ = null {not observe}
prop SmallImage : GuiImageData^ = null {not observe}
new()
{
}
new(name : string, gender : MyGender, category : MyCategory, birthday : DateTime, website : string)
{
Name = name;
Gender = gender;
Category = category;
Birthday = birthday;
Website = website;
}
}
func ToString(value : MyCategory) : string
{
switch (value)
{
case Black: { return "Black"; }
case Red: { return "Red"; }
case Lime: { return "Lime"; }
case Blue: { return "Blue"; }
case White: { return "White"; }
}
return "";
}
func ToColor(value : MyCategory) : Color
{
switch (value)
{
case Red: { return cast Color "#FF0000"; }
case Lime: { return cast Color "#00FF00"; }
case Blue: { return cast Color "#0000FF"; }
case White: { return cast Color "#FFFFFF"; }
}
return cast Color "#000000";
}
func ToString(value : MyGender) : string
{
switch (value)
{
case Male: { return "Male"; }
case Female: { return "Female"; }
}
return "";
}
func ToString(value : DateTime) : string
{
return $"$(value.month)/$(value.day)/$(value.year)";
}
}
]]>
</Workflow>
</Script>
</Resource>
Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

@@ -0,0 +1,60 @@
/***********************************************************************
!!!!!! DO NOT MODIFY !!!!!!
GacGen.exe Resource.xml
This file is generated by Workflow compiler
https://github.com/vczh-libraries
***********************************************************************/
#ifndef VCZH_WORKFLOW_COMPILER_GENERATED_DEMO
#define VCZH_WORKFLOW_COMPILER_GENERATED_DEMO
#include "DemoPartialClasses.h"
/***********************************************************************
Reflection
***********************************************************************/
namespace vl
{
namespace reflection
{
namespace description
{
#ifndef VCZH_DEBUG_NO_REFLECTION
DECL_TYPE_INFO(::demo::CategoryDisplayer)
DECL_TYPE_INFO(::demo::CategoryDisplayerConstructor)
DECL_TYPE_INFO(::demo::CategoryEditor)
DECL_TYPE_INFO(::demo::CategoryEditorConstructor)
DECL_TYPE_INFO(::demo::CategoryItemTemplate)
DECL_TYPE_INFO(::demo::CategoryItemTemplateConstructor)
DECL_TYPE_INFO(::demo::CategoryVisualizer)
DECL_TYPE_INFO(::demo::CategoryVisualizerConstructor)
DECL_TYPE_INFO(::demo::DateEditor)
DECL_TYPE_INFO(::demo::DateEditorConstructor)
DECL_TYPE_INFO(::demo::DateFilter)
DECL_TYPE_INFO(::demo::DateFilterConstructor)
DECL_TYPE_INFO(::demo::GenderDisplayer)
DECL_TYPE_INFO(::demo::GenderDisplayerConstructor)
DECL_TYPE_INFO(::demo::GenderEditor)
DECL_TYPE_INFO(::demo::GenderEditorConstructor)
DECL_TYPE_INFO(::demo::GenderItemTemplate)
DECL_TYPE_INFO(::demo::GenderItemTemplateConstructor)
DECL_TYPE_INFO(::demo::GenderVisualizer)
DECL_TYPE_INFO(::demo::GenderVisualizerConstructor)
DECL_TYPE_INFO(::demo::MainWindow)
DECL_TYPE_INFO(::demo::MainWindowConstructor)
DECL_TYPE_INFO(::demo::MyCategory)
DECL_TYPE_INFO(::demo::MyDataItem)
DECL_TYPE_INFO(::demo::MyGender)
DECL_TYPE_INFO(::demo::TextEditor)
DECL_TYPE_INFO(::demo::TextEditorConstructor)
#endif
extern bool LoadDemoTypes();
}
}
}
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -19,6 +19,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProgressAndAsync", "Progres
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ListControls", "ListControls\ListControls.vcxproj", "{3E4357C6-179C-457E-ACCD-7ADE1887183F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DataGrid", "DataGrid\DataGrid.vcxproj", "{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -73,6 +75,14 @@ Global
{3E4357C6-179C-457E-ACCD-7ADE1887183F}.Release|Win32.Build.0 = Release|Win32
{3E4357C6-179C-457E-ACCD-7ADE1887183F}.Release|x64.ActiveCfg = Release|x64
{3E4357C6-179C-457E-ACCD-7ADE1887183F}.Release|x64.Build.0 = Release|x64
{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}.Debug|Win32.ActiveCfg = Debug|Win32
{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}.Debug|Win32.Build.0 = Debug|Win32
{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}.Debug|x64.ActiveCfg = Debug|x64
{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}.Debug|x64.Build.0 = Debug|x64
{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}.Release|Win32.ActiveCfg = Release|Win32
{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}.Release|Win32.Build.0 = Release|Win32
{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}.Release|x64.ActiveCfg = Release|x64
{4A3E9DB2-C440-42B5-AFCC-0FCA01909BF1}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Binary file not shown.