<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:local="clr-namespace:StockAnalysis.Partial.Layouts"
    xmlns:cc="clr-namespace:StockAnalysis.Partial.CustomControls"
    xmlns:uc="clr-namespace:StockAnalysis.Partial.UserControls"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    x:Class="StockAnalysis.Partial.Layouts.Main"
    mc:Ignorable="d" 
    d:DesignHeight="600" d:DesignWidth="800" DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}">

    <Grid  Background="{StaticResource PaperWhite900}">
        <Grid.RowDefinitions>
            <RowDefinition Height="50" />
            <RowDefinition Height="1" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <cc:Title x:Name="title" Background="{StaticResource PaperWhite900}" IconSource="/StockAnalysis;component/Resources/logo.png" >
            <TextBlock Margin="8, 0, 0, 0" FontSize="16" FontWeight="DemiBold">
                <Run Foreground="{StaticResource LogoYellow}" Text="STOCK" />
                <Run Foreground="{StaticResource LogoBlue}" Text="ANALYSIS"/>
            </TextBlock>
        </cc:Title>
        <cc:ContentSchema x:Name="content" Grid.Row="2">
            <cc:ContentSchema.Nav>
                <cc:NavList x:Name="navList" Background="{StaticResource PaperWhite1000}" SelectedIndex="0" ItemsSource="{Binding Model.Quotes}"
                            SelectedValue="{Binding Model.CurrectQuote, Mode=TwoWay}" >
                    <cc:NavList.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate  TargetType="{x:Type ListBoxItem}">
                                        <Border x:Name="border" Margin="0" Padding="15,16,10,16" BorderBrush="{StaticResource PaperWhite800}" BorderThickness="0,0,0,1" Background="{StaticResource PaperWhite1000}">
                                            <ContentPresenter x:Name="content" TextElement.FontWeight="DemiBold" Content="{Binding}" ContentTemplate="{TemplateBinding ContentTemplate}" />
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsSelected" Value="True">
                                                <Setter TargetName="border" Property="Background" Value="{StaticResource PaperWhite900}" />
                                                <Setter TargetName="content" Property="TextElement.FontWeight" Value="Bold" />
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </cc:NavList.ItemContainerStyle>
                    <cc:NavList.ItemTemplate>
                        <DataTemplate>
                            <Grid x:Name="grid" TextElement.Foreground="{StaticResource StockGreen}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="45" />
                                    <ColumnDefinition Width="26" />
                                    <ColumnDefinition Width="45" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0" Text="{Binding Name}" SnapsToDevicePixels="True" />
                                <TextBlock x:Name="rate" Grid.Column="1" HorizontalAlignment="Right" Text="{Binding Rate, StringFormat={}{0:P2}}" FontWeight="Normal" />
                                <Path x:Name="updown" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="11.314" Height="5.657" Data="F1 M 5.657,0.000 L 11.314,5.657 L 0.000,5.657 L 5.657,0.000 Z" Fill="{Binding (TextElement.Foreground), ElementName=grid}" SnapsToDevicePixels="True" />
                                <TextBlock x:Name="price" Grid.Column="3" HorizontalAlignment="Right" Text="{Binding Price, StringFormat={}{0:###.##}}" FontWeight="DemiBold" />
                            </Grid>
                            <DataTemplate.Triggers>
                                <DataTrigger Binding="{Binding Updown}" Value="False">
                                    <Setter TargetName="grid" Property="TextElement.Foreground" Value="{StaticResource StockRed}" />
                                    <Setter TargetName="updown" Property="LayoutTransform">
                                        <Setter.Value>
                                            <RotateTransform Angle="180" CenterX=".5" CenterY=".5"  />
                                        </Setter.Value>
                                    </Setter>
                                </DataTrigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </cc:NavList.ItemTemplate>
                </cc:NavList>
            </cc:ContentSchema.Nav>
            <cc:ContentSchema.Settings>
                <uc:Settings x:Name="settings" />
            </cc:ContentSchema.Settings>
            <cc:ContentSchema.AnnotitionsSettings>
                <uc:AnnotationSettings x:Name="annotitionSettings" />
            </cc:ContentSchema.AnnotitionsSettings>
            <cc:ContentSchema.Chart>
                <uc:Charts x:Name="charts" />
            </cc:ContentSchema.Chart>
        </cc:ContentSchema>
    </Grid>
</UserControl>
