<UserControl x:Class="TradeBlotter.Views.StickerPriceView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0" 
    xmlns:dc="clr-namespace:TradeBlotter.UIUtils"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:wpfx="http://schemas.xceed.com/wpf/xaml/toolkit"
    mc:Ignorable="d" 
    d:DesignHeight="300" d:DesignWidth="600">

    <wpfx:BusyIndicator Name="BusyBar" IsBusy="{Binding Path=BusyIndicator}" BusyContent="Loading...">
    <Grid Background="LightGray">
        <AdornerDecorator>
            <Grid>
                <DockPanel>
                    <Grid Margin="4">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="3" />
                            <RowDefinition Height="30" />
                        </Grid.RowDefinitions>

                            <GroupBox BorderBrush="Black" Grid.Row="0" Grid.Column="0" Header="Parameters">
                            <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical">
                                <Label Content="Watch List" HorizontalAlignment="Left"  ></Label>
                                <ComboBox ItemsSource="{Binding Path=WatchListNames, Mode=OneTime}" SelectedItem="{Binding Path=SelectedWatchList, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
                                <Label Content="Symbol" HorizontalAlignment="Left" ></Label>															
                                <ComboBox ItemsSource="{Binding Path=Symbols, Mode=OneWay}" SelectedItem="{Binding Path=SelectedSymbol, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
																<ComboBox.ItemsPanel>
																	<ItemsPanelTemplate>
																		<VirtualizingStackPanel/>
																	</ItemsPanelTemplate>
																</ComboBox.ItemsPanel>
																</ComboBox>
                                <Button Margin="0,2,0,2" Width="100"  Content="Refresh" HorizontalAlignment="Left" Command="{Binding Path=RefreshCommand}"></Button>
                                <Button Margin="0,2,0,2" Content="Copy to Clipboard" HorizontalAlignment="Left" Command="{Binding Path=CopyToClipboardCommand}"></Button>
                                </StackPanel>
                        </GroupBox>

                    </Grid>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height=".12*" />
                            <RowDefinition Height=".8*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width=".01*"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <GridSplitter Background="LightBlue" ResizeDirection="Columns" Grid.Column="1" Grid.RowSpan="3" Grid.Row="0" Width="5" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0"/>
                        <Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>
                        <DockPanel Grid.Row="1" Grid.Column="0" >
                        <telerik:RadGridView CanUserSelect="True" FontSize="10" SelectionMode="Single" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" AlternationCount="2" AlternateRowBackground="Bisque" ShowGroupPanel="false" ShowGroupFooters="False" ItemsSource="{Binding Path=AllBVPS, ValidatesOnDataErrors=True}" AutoGenerateColumns="False" >
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn Header="Dates" IsReadOnly="true" DataMemberBinding="{Binding Path=Date,StringFormat={}{0:MM/dd/yyyy}}" />
                            <telerik:GridViewDataColumn Header="BVPS"  IsReadOnly="true" DataMemberBinding="{Binding Path=Value,StringFormat={}{0:C}}" />
                            <telerik:GridViewDataColumn Header="Return"  IsReadOnly="true" DataMemberBinding="{Binding Path=Return,StringFormat={}{0:P}}" />
                        </telerik:RadGridView.Columns>
                        </telerik:RadGridView>
                        </DockPanel>
                            <GroupBox BorderBrush="Black"  Grid.Column="2" Grid.ColumnSpan="2" Grid.Row="1" Grid.RowSpan="2" Header="Assumptions" FontSize="11" >
                                <StackPanel Grid.Row="0" Grid.Column="1">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height=".25*" />
                                            <RowDefinition Height="*" />
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="62*"></ColumnDefinition>
                                            <ColumnDefinition Width="3*"></ColumnDefinition>
                                            <ColumnDefinition Width="56*"></ColumnDefinition>
                                            <ColumnDefinition Width="3*"></ColumnDefinition>
                                            <ColumnDefinition Width="52*"></ColumnDefinition>
                                            <ColumnDefinition Width="3*"></ColumnDefinition>
                                            <ColumnDefinition Width="52*"></ColumnDefinition>
                                            <ColumnDefinition Width="3*"></ColumnDefinition>
                                            <ColumnDefinition Width="52*"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>

                                    <Label Grid.Row="0" Grid.Column="0" FontSize="10" Content="Required Return" HorizontalAlignment="Left" Target="{Binding ElementName=requiredReturnLbl}" ></Label>
                                    <TextBox ToolTipService.ToolTip="The return required over 10-year horizon." Grid.Row="1" Grid.Column="0" FontSize="10" HorizontalAlignment="Left" Width="55" IsReadOnly="true" Text="{Binding Path=RequiredReturn, ValidatesOnDataErrors=True, UpdateSourceTrigger=LostFocus}" Validation.ErrorTemplate="{x:Null}"/>

                                    <Label Grid.Row="0" Grid.Column="2" FontSize="10" Content="EPS" HorizontalAlignment="Left" Target="{Binding ElementName=epsLbl}" ></Label>
                                    <TextBox ToolTipService.ToolTip="Earnings per share." Grid.Row="1" Grid.Column="2" FontSize="10" HorizontalAlignment="Left" Width="55" IsReadOnly="false" Text="{Binding Path=EPS, Mode=TwoWay,ValidatesOnDataErrors=True, UpdateSourceTrigger=LostFocus}" Validation.ErrorTemplate="{x:Null}"/>

                                    <Label Grid.Row="0" Grid.Column="4" FontSize="10" Content="P/E" HorizontalAlignment="Left" Target="{Binding ElementName=peLbl}" ></Label>
                                    <TextBox ToolTipService.ToolTip="Price-to-earnings ratio." Grid.Row="1" Grid.Column="4" FontSize="10" IsReadOnly="false" Background="{Binding Path=PEBackground}" Text="{Binding Path=PE, Mode=TwoWay}" ></TextBox>
                                        
                                    <Label Grid.Row="0" Grid.Column="6" FontSize="10" Content="Low P/E" HorizontalAlignment="Left" Target="{Binding ElementName=lowPELbl}" ></Label>
                                    <TextBox ToolTipService.ToolTip="EPS*2.00." Grid.Row="1" Grid.Column="6" FontSize="10" IsReadOnly="true" Text="{Binding Path=LowPE, Mode=OneWay}" ></TextBox>

                                    <Label Grid.Row="0" Grid.Column="8" FontSize="10" Content="Trailing P/E" HorizontalAlignment="Left" Target="{Binding ElementName=trailingPELbl}" ></Label>
                                    <TextBox ToolTipService.ToolTip="12-month trailing P/E (Fundamental)." Grid.Row="1" Grid.Column="8" FontSize="10" IsReadOnly="true" Text="{Binding Path=TrailingPE, Mode=OneWay}" ></TextBox>

                                    <Label Grid.Row="2" Grid.Column="0" FontSize="10" Content="Average Low/Trailing" HorizontalAlignment="Left" Target="{Binding ElementName=avgLowTrailingLbl}" ></Label>
                                    <TextBox ToolTipService.ToolTip="(LowP/E+TrailingP/E)/2.00" Grid.Row="3" Grid.Column="0" FontSize="10" HorizontalAlignment="Left" Width="55" IsReadOnly="true" Text="{Binding Path=AvgLowTrailing, Mode=OneWay,ValidatesOnDataErrors=True, UpdateSourceTrigger=LostFocus}" Validation.ErrorTemplate="{x:Null}"/>

                                    <Label Grid.Row="2" Grid.Column="2" FontSize="10" Content="Current Est. Price" HorizontalAlignment="Left" ></Label>
                                    <TextBox ToolTipService.ToolTip="EPS*Average Low/Trailing." Grid.Row="3" Grid.Column="2"  FontSize="10" IsReadOnly="true" Text="{Binding Path=CurrentEstimatedPrice, Mode=OneWay}" ></TextBox>

                                    <Label Grid.Row="2" Grid.Column="4" FontSize="10" Content="Price Est. 10y" HorizontalAlignment="Left" ></Label>
                                    <TextBox ToolTipService.ToolTip="Current Est. Price *((1.00+BVPSGrowth)^10.00)." Grid.Row="3" Grid.Column="4"  FontSize="10" IsReadOnly="true" Text="{Binding Path=PriceEstimate10Y, Mode=OneWay}" ></TextBox>
                                        
                                    <Label Grid.Row="2" Grid.Column="6" FontSize="10" Content="Price Reqd. Return" HorizontalAlignment="Left" ></Label>
                                    <TextBox ToolTipService.ToolTip="Price Est. 10-year/(1.00+Required Return)^10.00" Grid.Row="3" Grid.Column="6"  FontSize="10" IsReadOnly="true" Text="{Binding Path=TodaysPriceForRequiredReturn, Mode=OneWay}" ></TextBox>

                                    <Label Grid.Row="2" Grid.Column="8" FontSize="10" Content="P/CF" HorizontalAlignment="Left" ></Label>
                                    <TextBox ToolTipService.ToolTip="Price to Operating Cashflow: Price/(Operating Cashflow/Shares Outstanding)" Grid.Row="3" Grid.Column="8"  FontSize="10" IsReadOnly="true" Text="{Binding Path=PCF, Mode=OneWay}" ></TextBox>
																			
                                    <Label Grid.Row="4" Grid.Column="0" FontSize="10" Content="Latest Price" HorizontalAlignment="Left" ></Label>
																		<TextBox ToolTipService.ToolTip="Latest closing price." Grid.Row="5" Grid.Column="0"  FontSize="10" AcceptsReturn="True" IsReadOnly="false" Text="{Binding Path=LatestPrice, Mode=TwoWay}" Height="15" VerticalAlignment="Bottom" ></TextBox>
                                        
                                    <Label Grid.Row="4" Grid.Column="2" FontSize="10" Content="Pricing Date" HorizontalAlignment="Left" ></Label>
                                    <TextBox ToolTipService.ToolTip="Date of latest closing price." Grid.Row="5" Grid.Column="2"  FontSize="10" IsReadOnly="true" Text="{Binding Path=PricingDate, Mode=OneWay}" ></TextBox>
                                        
                                    <Label Grid.Row="4" Grid.Column="4" FontSize="10" Content="MOS" HorizontalAlignment="Left" ></Label>
                                    <TextBox  ToolTipService.ToolTip="Todays price for required return * .50." Grid.Row="5" Grid.Column="4" Background="{Binding Path=MOSBackground}" FontSize="10" IsReadOnly="true" Text="{Binding Path=MOS, Mode=OneWay}" ></TextBox>
                                        
                                    <Label Grid.Row="4" Grid.Column="6" FontSize="10" Content="MOS80" HorizontalAlignment="Left" ></Label>
                                    <TextBox ToolTipService.ToolTip="Todays price for required return * .80." Grid.Row="5" Grid.Column="6"  Background="{Binding Path=MOS80Background}" FontSize="10" IsReadOnly="true" Text="{Binding Path=MOS80, Mode=OneWay}" ></TextBox>

																		<Label Grid.Row="4" Grid.Column="8" FontSize="10" Content="NCAVPS" HorizontalAlignment="Left" ></Label>
																		<TextBox ToolTipService.ToolTip="Benjamin Graham : Net Current Asset Value Per Share = (Net Current Assets - Total Liabilities) / Shares Outstanding." Grid.Row="5" Grid.Column="8"  Background="{Binding Path=NetCurrentAssetValuePerShareBackground}" FontSize="10" IsReadOnly="true" Text="{Binding Path=NetCurrentAssetValuePerShare, Mode=OneWay}" ></TextBox>

																		<Label Grid.Row="6" Grid.Column="0" FontSize="10" Content="Intrinsic Value" HorizontalAlignment="Left" ></Label>
                                    <TextBox ToolTipService.ToolTip="Benjamin Graham : EPS*(8.5+(2*EPSGrowth))" Grid.Row="7" Grid.Column="0"  FontSize="10" IsReadOnly="true" Text="{Binding Path=IntrinsicValue, Mode=OneWay}" ></TextBox>

																		<Label Grid.Row="6" Grid.Column="2" FontSize="10" Content="Fundamental Value" HorizontalAlignment="Left" ></Label>
                                    <TextBox ToolTipService.ToolTip="Benjamin Graham : Sqrt(22.5 * eps(ttm) * bvps)." Grid.Row="7" Grid.Column="2"  FontSize="10" IsReadOnly="true" Text="{Binding Path=FundamentalValue, Mode=OneWay}" ></TextBox>
																			
                                    <Label Grid.Row="6" Grid.Column="4" FontSize="10" Content="RGV" HorizontalAlignment="Left" ></Label>
                                    <TextBox ToolTipService.ToolTip="Intrinsic value / Last closing price." Grid.Row="7" Grid.Column="4"  FontSize="10" IsReadOnly="true" Text="{Binding Path=RGV, Mode=OneWay}" ></TextBox>

                                    <Label Grid.Row="6" Grid.Column="6" FontSize="10" Content="BVPS" HorizontalAlignment="Left" ></Label>
                                    <TextBox ToolTipService.ToolTip="Book value per share." Grid.Row="7" Grid.Column="6"  FontSize="10" IsReadOnly="true" Text="{Binding Path=BVPS, Mode=OneWay}" ></TextBox>

                                    <Label Grid.Row="6" Grid.Column="8" FontSize="10" Content="PBVPS" HorizontalAlignment="Left" ></Label>
                                    <TextBox ToolTipService.ToolTip="Price to Book value per share." Grid.Row="7" Grid.Column="8"  FontSize="10" IsReadOnly="true" Text="{Binding Path=PBVPS, Mode=OneWay}" ></TextBox>
                                        
                                    <Label Grid.Row="8" Grid.Column="0" FontSize="10" Content="Average Growth" HorizontalAlignment="Left" Height="23" Margin="0,0.226,0,0" VerticalAlignment="Top" ></Label>
                                    <TextBox ToolTipService.ToolTip="Mean BVPS returns." Grid.Row="9" Grid.Column="0"  FontSize="10" AcceptsReturn="True" IsReadOnly="False" Text="{Binding Path=AverageGrowth, Mode=TwoWay}" ></TextBox>
																			
                                    <Label Grid.Row="8" Grid.Column="2" FontSize="10" Content="Dividend Yield" HorizontalAlignment="Left" ></Label>
																		<TextBox ToolTipService.ToolTip="Dividend Yield (Dividend History vs. Current Price)." Grid.Row="9" Grid.Column="2"  FontSize="10" IsReadOnly="True" Text="{Binding Path=DividendYield, Mode=OneWay}" ></TextBox>

                                    <Label Grid.Row="8" Grid.Column="4" FontSize="10" Content="Shares Outstanding" HorizontalAlignment="Left" ></Label>
																		<TextBox ToolTipService.ToolTip="Shares Outstanding." Grid.Row="9" Grid.Column="4"  FontSize="10" IsReadOnly="True" Text="{Binding Path=SharesOutstanding, Mode=OneWay}" ></TextBox>
																			
                                    <Label Grid.Row="8" Grid.Column="6" FontSize="10" Content="PE x PBVPS" HorizontalAlignment="Left" ></Label>
																		<TextBox ToolTipService.ToolTip="P/E x PBVPS.  Should not exceed 22.5 Ref: The Intelligent Investor." Grid.Row="9" Grid.Column="6"  FontSize="10" IsReadOnly="True" Background="{Binding Path=PExPBVPSBackground}" Text="{Binding Path=PExPBVPS, Mode=OneWay}" ></TextBox>																	
																			
                                    <Label Grid.Row="8" Grid.Column="8" FontSize="10" Content="Debt To Equity" HorizontalAlignment="Left" ></Label>
																		<TextBox ToolTipService.ToolTip="Fundamental.Debt/BalanceSheet.StockHoldersEquity." Grid.Row="9" Grid.Column="8"  FontSize="10" IsReadOnly="True" Background="{Binding Path=DebtToEquityBackground}" Text="{Binding Path=DebtToEquity, Mode=OneWay}" ></TextBox>

                                    <Label Grid.Row="11" Grid.Column="0" FontSize="10" Content="Beta" HorizontalAlignment="Left" Height="23" Margin="0,0.226,0,0" VerticalAlignment="Top" ></Label>
                                    <TextBox ToolTipService.ToolTip="2Y beta from valuation" Grid.Row="12" Grid.Column="0"  FontSize="10" AcceptsReturn="False" IsReadOnly="True" Text="{Binding Path=Beta, Mode=OneWay}" ></TextBox>
                                      
                                    <Label Grid.Row="11" Grid.Column="2" FontSize="10" Content="Earnings Yield" HorizontalAlignment="Left" Height="23" Margin="0,0.226,0,0" VerticalAlignment="Top" ></Label>
                                    <TextBox ToolTipService.ToolTip="Earnings Yield=EBIT/Enterprise Value OR EPS/Latest Price" Grid.Row="12" Grid.Column="2"  FontSize="10" AcceptsReturn="False" IsReadOnly="True" Text="{Binding Path=EarningsYield, Mode=OneWay}" ></TextBox>
                                      
                                    <Label Grid.Row="11" Grid.Column="4" FontSize="10" Content="EBIT" HorizontalAlignment="Left" Height="23" Margin="0,0.226,0,0" VerticalAlignment="Top" ></Label>
                                    <TextBox ToolTipService.ToolTip="Earnings Before Interest and Taxes (EBIT) from valuation" Grid.Row="12" Grid.Column="4"  FontSize="10" AcceptsReturn="False" IsReadOnly="True" Text="{Binding Path=EBIT, Mode=OneWay}" ></TextBox>
                                      
                                    <Label Grid.Row="11" Grid.Column="6" FontSize="10" Content="Enterprise Value" HorizontalAlignment="Left" Height="23" Margin="0,0.226,0,0" VerticalAlignment="Top" ></Label>
                                    <TextBox ToolTipService.ToolTip="Enterprise Value from valuation" Grid.Row="12" Grid.Column="6"  FontSize="10" AcceptsReturn="False" IsReadOnly="True" Text="{Binding Path=EnterpriseValue, Mode=OneWay}" ></TextBox>
                                </Grid>
                                </StackPanel>
                            </GroupBox>



                        </Grid>
                </DockPanel>
            </Grid>
        </AdornerDecorator>
    </Grid>
</wpfx:BusyIndicator>
</UserControl>
