<Instance ref.CodeBehind="false" ref.Class="demo::DataGridTabPage" xmlns:demo="demo::*">
  <ref.Ctor>
    <![CDATA[
      {
        var tempData : observe 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", "LargeImages/Task", true));
        var smallImage = cast (GuiImageData^) (ResolveResource("res", "SmallImages/Task", true));
        for(item in tempData)
        {
          item.LargeImage = largeImage;
          item.SmallImage = smallImage;
        }
        dataGrid.ItemSource = tempData;
      }
    ]]>
  </ref.Ctor>
  <TabPage ref.Name="self" Text="BindableDataGrid">
    <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::Compare($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::Compare(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::Compare(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::Compare($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::Compare($1.Website, $2.Website)]</att.Sorter>
            </DataColumn>
          </att.Columns>

          <att.DataColumns>
            <_>0</_>
          </att.DataColumns>
        </BindableDataGrid>
      </Cell>
    </Table>
  </TabPage>
</Instance>