<mahapps:MetroWindow
    x:Class="DTE.Views.Windows.TemplateWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ViewModels="clr-namespace:DTE.ViewModels"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:DTE.Views.Windows"
    xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="Template"
    Width="800"
    Height="450"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <ItemsControl  Margin="5" ItemsSource="{Binding Labels}" >
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel IsItemsHost="True" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <WrapPanel >
                        <TextBox MouseDoubleClick="TextBox_MouseDoubleClick" Margin="3"  IsReadOnly="True" Text="{Binding Path=., Mode=OneWay}" />
                    </WrapPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>

        <TextBox
            Grid.Row="1"
            Height="auto"
            AcceptsReturn="True"
            Text="{Binding Text}"
            TextWrapping="Wrap" />
        <Grid Grid.Row="2">
            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
                <Button
                    Width="150"
                    Height="30"
                    Margin="5"
                    Command="{Binding Save}"
                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                    Content="Save" />
                <Button
                    Width="150"
                    Height="30"
                    Margin="5"
                    Click="Button_Click"
                    Content="Cancel" />
            </StackPanel>
        </Grid>
    </Grid>
</mahapps:MetroWindow>
