<?xml version="1.0" encoding="utf-8"?>
<Folder>
  <Instance name="FindWindowResource">
    <Instance ref.Class="demo::FindWindow" xmlns:x="presentation::controls::GuiSelectableButton::*">
      <ref.Members>
        <![CDATA[
          @cpp:UserImpl
          @cpp:Protected
          func FindNext(toFind : string, caseSensitive : bool, down : bool) : bool {}
          
          var textBox : MultilineTextBox* = null;
        ]]>
      </ref.Members>
      <Window ref.Name="self" Text="Find" ClientSize="x:360 y:150" MinimizedBox="false" MaximizedBox="false">
        <att.BoundsComposition-set PreferredMinSize="x:360 y:150"/>
        <x:MutexGroupController ref.Name="groupDirection"/>

        <MessageDialog ref.Name="dialogContentNotFound"
                       Input="DisplayOK"
                       Title-eval="self.Text"
                       Text="Content not found."
          />

        <Table AlignmentToParent="left:0 top:0 right:0 bottom:0" CellPadding="5">
          <att.Rows>
            <CellOption>composeType:MinSize</CellOption>
            <CellOption>composeType:MinSize</CellOption>
            <CellOption>composeType:Percentage percentage:1.0</CellOption>
            <CellOption>composeType:MinSize</CellOption>
          </att.Rows>
          <att.Columns>
            <CellOption>composeType:MinSize</CellOption>
            <CellOption>composeType:Percentage percentage:1.0</CellOption>
            <CellOption>composeType:MinSize</CellOption>
            <CellOption>composeType:MinSize</CellOption>
          </att.Columns>

          <Cell Site="row:0 column:0">
            <Label Text="To Find:">
              <att.BoundsComposition-set AlignmentToParent="left:5 top:5 right:5 bottom:5"/>
            </Label>
          </Cell>

          <Cell Site="row:0 column:1 columnSpan:3">
            <SinglelineTextBox ref.Name="textFind">
              <att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
            </SinglelineTextBox>
          </Cell>

          <Cell Site="row:1 column:0 columnSpan:4">
            <Stack Direction="Horizontal" AlignmentToParent="left:5 top:5 right:5 bottom:5" Padding="20" MinSizeLimitation="LimitToElementAndChildren">
              <StackItem>
                <CheckBox ref.Name="checkCase" Text="Case Sensitive"/>
              </StackItem>
              <StackItem>
                <GroupBox Text="Direction">
                  <att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:-1 bottom:0"/>
                  <att.ContainerComposition-set MinSizeLimitation="LimitToElementAndChildren"/>

                  <Stack Direction="Horizontal" AlignmentToParent="left:5 top:5 right:5 bottom:5" Padding="20" MinSizeLimitation="LimitToElementAndChildren">
                    <StackItem>
                      <RadioButton ref.Name="radioUp" Text="Up" GroupController-ref="groupDirection"/>
                    </StackItem>
                    <StackItem>
                      <RadioButton ref.Name="radioDown" Text="Down" GroupController-ref="groupDirection" Selected="true"/>
                    </StackItem>
                  </Stack>
                </GroupBox>
              </StackItem>
            </Stack>
          </Cell>

          <Cell Site="row:3 column:2">
            <Button Text="Find Next">
              <att.BoundsComposition-set PreferredMinSize="x:100 y:30"/>
              <ev.Clicked-eval>
                <![CDATA[
                  {
                    if (not self.FindNext(textFind.Text, checkCase.Selected, radioDown.Selected))
                    {
                      dialogContentNotFound.ShowDialog();
                    }
                  }
                ]]>
              </ev.Clicked-eval>
            </Button>
          </Cell>

          <Cell Site="row:3 column:3">
            <Button Text="Close">
              <att.BoundsComposition-set PreferredMinSize="x:100 y:30"/>
              <ev.Clicked-eval>self.Close();</ev.Clicked-eval>
            </Button>
          </Cell>
        </Table>
      </Window>
    </Instance>
  </Instance>
</Folder>