demo: control_list_listview

This commit is contained in:
Zihan Chen
2021-06-19 23:46:05 -07:00
parent 61c1cdb053
commit 1f8280630a
7 changed files with 141 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<Resource>
<Folder name="GacGenConfig">
<Folder name="ResX86">
<Text name="Resource">..\..\UIRes\32bits\control_list_listview.bin</Text>
</Folder>
<Folder name="ResX64">
<Text name="Resource">..\..\UIRes\64bits\control_list_listview.bin</Text>
</Folder>
</Folder>
<Image content="File">Book16.png</Image>
<Image content="File">Book32.png</Image>
<Image content="File">Open16.png</Image>
<Image content="File">Open32.png</Image>
<Folder name="MainWindow">
<Instance name="MainWindowResource">
<Instance ref.Class="sample::MainWindow">
<ref.Members><![CDATA[
@cpp:Private
var views: ListViewView[] = {
ListViewView::BigIcon;
ListViewView::SmallIcon;
ListViewView::List;
ListViewView::Tile;
ListViewView::Information;
ListViewView::Detail;
};
@cpp:Private
var books: string[] = {};
@cpp:Private
var iconBook16: ImageData^ = null;
@cpp:Private
var iconBook32: ImageData^ = null;
@cpp:Private
var iconOpen16: ImageData^ = null;
@cpp:Private
var iconOpen32: ImageData^ = null;
]]></ref.Members>
<ref.Ctor><![CDATA[
{
self.iconBook16 = cast (ImageData^) self.ResolveResource("res", "Book16.png", true);
self.iconBook32 = cast (ImageData^) self.ResolveResource("res", "Book32.png", true);
self.iconOpen16 = cast (ImageData^) self.ResolveResource("res", "Open16.png", true);
self.iconOpen32 = cast (ImageData^) self.ResolveResource("res", "Open32.png", true);
var locale = Application::GetApplication().Locale;
var formats = Localization::GetLongDateFormats(locale).CreateEnumerator();
formats.Next();
var format = cast string formats.Current;
for (i in range [0, 24))
{
var item = new ListViewItem^();
item.SmallImage = self.iconBook16;
item.LargeImage = self.iconBook32;
item.Text = Sys::LoremIpsumTitle(24);
item.SubItems.Add(Sys::LoremIpsumTitle(16));
item.SubItems.Add(Localization::FormatDate(locale, format, Sys::CreateDateTime(2010 + i / 3, 1 + i / 2, 1 + i)));
item.SubItems.Add(Sys::LoremIpsumSentence(64));
self.books.Add(Sys::LoremIpsumParagraph(512));
listView.Items.Add(item);
}
}
]]></ref.Ctor>
<Window ref.Name="self" Text="control_list_listview" ClientSize="x:640 y:480">
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0" CellPadding="5" BorderVisible="false" MinSizeLimitation="LimitToElementAndChildren">
<att.Rows>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Rows>
<att.Columns>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Absolute absolute:120</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Columns>
<Cell Site="row:0 column:0">
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0" CellPadding="5" BorderVisible="false" MinSizeLimitation="LimitToElementAndChildren">
<att.Rows>
<CellOption>composeType:Percentage percentage:0.5</CellOption>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:0.5</CellOption>
</att.Rows>
<att.Columns>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Columns>
<Cell Site="row:1 column:0">
<Label Text="listView.View = ListViewView::"/>
</Cell>
</Table>
</Cell>
<Cell Site="row:0 column:1">
<ComboBox ref.Name="comboView" SelectedIndex="0">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<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"/>
</att.Items>
</TextList>
</att.ListControl>
</ComboBox>
</Cell>
<Cell Site="row:1 column:0 columnSpan:3">
<ListView ref.Name="listView" View-bind="self.views[comboView.SelectedIndex]" HorizontalAlwaysVisible="false" VerticalAlwaysVisible="false">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<att.Columns>
<ListViewColumn Text="Title"/>
<ListViewColumn Text="Author" SortingState="Ascending"/>
<ListViewColumn Text="Date Published" SortingState="Descending"/>
<ListViewColumn Text="Summary">
<att.DropdownPopup>
<ToolstripMenu>
<MenuItemButton Text="Fake"/>
<MenuItemButton Text="Menu"/>
<MenuItemButton Text="Item"/>
</ToolstripMenu>
</att.DropdownPopup>
</ListViewColumn>
</att.Columns>
<att.DataColumns>
<_>0</_>
<_>1</_>
</att.DataColumns>
</ListView>
</Cell>
</Table>
</Window>
</Instance>
</Instance>
</Folder>
</Resource>