<Page
    x:Class="StockPortfolio.SearchStockPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:StockPortfolio.View.MyPortfolio"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:c1="using:C1.Xaml"
    RequestedTheme="Light"
   >
    <Grid x:Name="RootPanel" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Border Background="#FFEDEDED">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <StackPanel Orientation="Horizontal">
                    <Path Height="32" Width="32" Margin="20 0 0 0" VerticalAlignment="Center" Data="M21,20 L27,20 L27,24 L21,24 z M48,13.47 L48,34 C48,36.2091 46.2091,38 44,38 L4,38 C1.79086,38 0,36.2091 0,34 L0,13.47 L0.050926,13.5439 C3.27892,18.0839 10.0333,21.5167 18.266,22.6214 L19,22.7097 L19,25 C19,25.5523 19.4477,26 20,26 L28,26 C28.5523,26 29,25.5523 29,25 L29,22.7097 L29.734,22.6214 C37.9667,21.5167 44.7211,18.0839 47.9491,13.5439 z M17,3 L17,8 L31,8 L31,3 z M16,0 L32,0 C33.1046,0 34,0.895432 34,2 L34,8 L44,8 C46.071,8 47.7745,9.574 47.9793,11.591 L47.9807,11.6093 L47.9518,11.6676 C45.3818,16.643 38.329,20.495 29.5135,21.6458 L29,21.7059 L29,19 C29,18.4477 28.5523,18 28,18 L20,18 C19.4477,18 19,18.4477 19,19 L19,21.7059 L18.4865,21.6458 C9.67095,20.495 2.6182,16.643 0.048165,11.6676 L0.019261,11.6093 L0.020652,11.591 C0.225491,9.574 1.92893,8 4,8 L14,8 L14,2 C14,0.895432 14.8954,0 16,0 z"  Fill="#FFB1356B" Stretch="Uniform"  />
                    <TextBlock x:Name="pageTitle" Text="Stock Detail" VerticalAlignment="Center" Margin="10 0 0 0" FontFamily="Segoe WP" FontWeight="Light" FontSize="18" Foreground="#FFB1356B"/>
                    <!-- Style="{StaticResource PageHeaderTextStyle}"-->
                </StackPanel>
                <StackPanel Grid.Column="1" Orientation="Horizontal" Margin="0 0 20 0" VerticalAlignment="Center" >
                    <!--<TextBlock Text="Theme:" Margin="8" Foreground="{ThemeResource ControlExplorerLightForegroundThemeBrush}" VerticalAlignment="Center" FontSize="20"/>-->
                    <!--<ComboBox x:Name="comboThemes" MinWidth="100" SelectionChanged="comboThemes_SelectionChanged" Height="40"/>-->

                </StackPanel>
            </Grid>
        </Border>
        <Grid Grid.Row="1" Margin="10">
            <Grid.Resources>
                <Style TargetType="TextBlock">
                    <Setter Property="Foreground" Value="#FF5D5D5D"/>
                </Style>
            </Grid.Resources>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="180"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="50"/>
                <RowDefinition Height="50"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid Background="#FFF3F3F3" >
                <StackPanel Grid.Row="0" Margin="5">
                    <TextBlock FontSize="18" Text="Balance" />
                    <TextBlock x:Name="balanceText" FontSize="14" FontFamily="Segoe WP" FontWeight="Light" Margin="0 -5 0 10"/>
                </StackPanel>
            </Grid>
            <StackPanel x:Name="SearchPanel" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 20">
                <TextBlock Text="Stock Symbol" FontSize="18"/>
                <c1:C1DropDown Height="35" x:Name="searchSymbols" FocusCuesVisibility="Collapsed" ShowButton="False" DropDownWidth="300" Width="380"  HeaderPadding="0" Padding="0" IsDropDownOpenChanged="searchSymbols_IsDropDownOpenChanged">
                    <c1:C1DropDown.Header>
                        <Border Height="28">
                            <c1:C1TextBoxBase x:Name="txtSymbol" BorderThickness="0" TextWrapping="Wrap" TextChanged="txtSymbol_TextChanged" KeyDown="txtSymbol_KeyDown" LostFocus="txtSymbol_LostFocus" Margin="0" />
                        </Border>
                    </c1:C1DropDown.Header>
                    <Border Background="White" BorderBrush="#FFB1356B" BorderThickness="2" Width="300">
                        <!-- We do not use a Listbox because it swallows the clicks -->
                        <ItemsControl x:Name="listBox" Margin="10" />
                    </Border>
                </c1:C1DropDown>

                <!--<AppBarButton Icon="Find" x:Name="SearchButton" Click="Search_Click"></AppBarButton>-->
            </StackPanel>
            <Grid Grid.Row="2" Margin="5" Name="StockGird">
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />

                </Grid.ColumnDefinitions>
                <StackPanel Grid.ColumnSpan="2">
                    <TextBlock Text="StockName" FontSize="18"/>
                    <TextBlock Text="{Binding CurrentStockQuote.StockName}" FontSize="14" FontFamily="Segoe WP" FontWeight="Light" Margin="0 -5 0 10"/>
                </StackPanel>

                <StackPanel  Grid.Row="0" Grid.Column="2">
                    <TextBlock Text="Symbol" FontSize="18"/>
                    <TextBlock Text="{Binding Symbol}" FontSize="14" FontFamily="Segoe WP" FontWeight="Light" Margin="0 -5 0 10"/>
                </StackPanel>

                <StackPanel Grid.Row="1" Grid.Column="0">
                    <TextBlock Text="Open" FontSize="18"/>
                    <TextBlock Text="{Binding CurrentStockQuote.Open}" FontSize="14" FontFamily="Segoe WP" FontWeight="Light" Margin="0 -5 0 10"/>
                </StackPanel>

                <StackPanel Grid.Row="1" Grid.Column="1">
                    <TextBlock Text="Close" FontSize="18"/>
                    <TextBlock Text="{Binding CurrentStockQuote.PreviousClose}" FontSize="14" FontFamily="Segoe WP" FontWeight="Light" Margin="0 -5 0 10"/>
                </StackPanel>

                <StackPanel Grid.Row="1" Grid.Column="2">
                    <TextBlock Text="High" FontSize="18"/>
                    <TextBlock Text="{Binding CurrentStockQuote.Dayhigh}" FontSize="14" FontFamily="Segoe WP" FontWeight="Light" Margin="0 -5 0 10"/>
                </StackPanel>


                <StackPanel Grid.Row="2" Grid.Column="0">
                    <TextBlock Text="Low" FontSize="18"/>
                    <TextBlock Text="{Binding CurrentStockQuote.Daylow}" FontSize="14" FontFamily="Segoe WP" FontWeight="Light" Margin="0 -5 0 10"/>
                </StackPanel>

                <StackPanel Grid.Row="2" Grid.Column="1">
                    <TextBlock Text="LastTrade" FontSize="18"/>
                    <TextBlock Text="{Binding CurrentStockQuote.LastTrade}" FontSize="14" FontFamily="Segoe WP" FontWeight="Light" Margin="0 -5 0 10"/>
                </StackPanel>

                <StackPanel Grid.Row="2" Grid.Column="2">
                    <TextBlock Text="Count" FontSize="18"/>
                    <TextBlock Text="{Binding Count}" FontSize="14" FontFamily="Segoe WP" FontWeight="Light" Margin="0 -5 0 10"/>
                </StackPanel>


            </Grid>
            <StackPanel x:Name="BuyPanel" Grid.Row="3" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 20">
                <TextBlock Text="Buying in" FontSize="18"/>
                <c1:C1NumericBox IsEnabled="False" Minimum="0" Width="380" ValueChanged="ValueChanged" x:Name="Buy"/>

            </StackPanel>
            <StackPanel x:Name="SellPanel" Grid.Row="3" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 20">
                <TextBlock Text="Selling out" FontSize="18"/>
                <c1:C1NumericBox IsEnabled="False" Minimum="0" Width="380" ValueChanged="ValueChanged" x:Name="Sell"/>

            </StackPanel>
            <TextBlock Grid.Row="4" x:Name="total" Margin="5" FontSize="24" VerticalAlignment="Center" Foreground="#FFB1356B"/>
            <TextBlock Grid.Row="5" Visibility="Collapsed" x:Name="Message" Text="Total value shouldn't more than balance!" Margin="5"  FontSize="20" VerticalAlignment="Center"/>
            <StackPanel Grid.Row="6" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right">
                <Button Content="Cancel" Name="CloseButton" Click="CloseButton_Click" Margin="0 0 10 0"/>
                <Button Content="OK" Name="OkButton" IsEnabled="False" Click="OkButton_Click" />
            </StackPanel>
        </Grid>
    </Grid>


</Page>
