<UserControl x:Class="TradeBlotter.Views.AnalystRatingsView"
						 xmlns:vw="clr-namespace:TradeBlotter.Views"						 
             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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:wpfx="http://schemas.xceed.com/wpf/xaml/toolkit"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
  <UserControl.Resources>
    <Style x:Key="TradeItemStyle" TargetType="{x:Type telerik:RadGridView}">
    </Style>
  </UserControl.Resources>
  <wpfx:BusyIndicator Name="BusyBar" IsBusy="{Binding Path=BusyIndicator}" BusyContent="Loading Analyst Ratings...">
  <Grid  Background="LightGray">
  <DockPanel>
    <Grid DockPanel.Dock="Left" Margin="0,2,4,2">
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="6" />
      <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
      <RowDefinition Height="35" />
      <RowDefinition Height="3" />
      <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Label Grid.Row="0" Grid.Column="2" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>
    <StackPanel Orientation="Vertical" Grid.Row="2" Grid.Column="0">
    <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" Target="{Binding ElementName=symbolLbl}" ></Label>-->
    <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>
				<!--<Label Content="Date" HorizontalAlignment="Left" Target="{Binding ElementName=ratingDateLbl}" ></Label>-->
				<Label Content="Date" HorizontalAlignment="Left" ></Label>
    <ComboBox ItemsSource="{Binding Path=Dates, Mode=OneWay}" SelectedItem="{Binding Path=SelectedDate, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
			<ComboBox.ItemsPanel>
			<ItemsPanelTemplate>
					<VirtualizingStackPanel />
			</ItemsPanelTemplate>
			</ComboBox.ItemsPanel>						
		</ComboBox>
    <Button Margin="0,2" Content="Reset" HorizontalAlignment="Left" Command="{Binding Path=ResetCommand}"></Button>
    </StackPanel>
    <DockPanel Grid.Row="2" Grid.Column="2" >
    <telerik:RadGridView SelectedItem="{Binding SelectedItem, Mode=TwoWay}" ItemContainerStyle="{StaticResource TradeItemStyle}" AlternationCount="2" AlternateRowBackground="Bisque" ShowGroupFooters="True" ShowColumnFooters="True" ItemsSource="{Binding Path=AllItems, ValidatesOnDataErrors=True}" AutoGenerateColumns="False" >
    <telerik:RadContextMenu.ContextMenu>
      <telerik:RadContextMenu x:Name="GridContextMenu" StaysOpen="False" ItemsSource="{Binding MenuItems}">
        <telerik:RadContextMenu.ItemContainerStyle>
            <Style TargetType="telerik:RadMenuItem">
                <Setter Property="Header" Value="{Binding Text}" />
                <Setter Property="Command" Value="{Binding MenuItemClickedCommand}" />
                <Setter Property="StaysOpenOnClick" Value="False" />
            </Style>
        </telerik:RadContextMenu.ItemContainerStyle>
      </telerik:RadContextMenu>
    </telerik:RadContextMenu.ContextMenu>
    <telerik:RadGridView.Columns>
      <telerik:GridViewDataColumn IsReadOnly="True" Header="Date" DataMemberBinding="{Binding Path=Date,StringFormat='{}{0:MM/dd/yyyy}'}" />
      <telerik:GridViewDataColumn IsReadOnly="True" Header="Symbol" DataMemberBinding="{Binding Path=Symbol}" >
				<telerik:GridViewColumn.ToolTipTemplate>
					<DataTemplate >
						<StackPanel Orientation="Horizontal" >
							<TextBlock Background="LemonChiffon" MaxWidth="1000" TextWrapping="Wrap" Text="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type vw:AnalystRatingsView}},Path=DataContext.Description}"/>
						</StackPanel>
					</DataTemplate>
				</telerik:GridViewColumn.ToolTipTemplate>
			</telerik:GridViewDataColumn>
			<telerik:GridViewDataColumn IsReadOnly="True" Header="Company Name" DataMemberBinding="{Binding Path=CompanyName}" />
      <telerik:GridViewDataColumn IsReadOnly="True" Header="Brokerage Firm" DataMemberBinding="{Binding Path=BrokerageFirm}" />
      <telerik:GridViewDataColumn IsReadOnly="True" Header="Type" DataMemberBinding="{Binding Path=Type}" />
      <telerik:GridViewDataColumn IsReadOnly="True" Header="RatingsChange" DataMemberBinding="{Binding Path=RatingsChange}" />
      <telerik:GridViewDataColumn IsReadOnly="True" Header="Price Target" DataMemberBinding="{Binding Path=PriceTarget,StringFormat='{}{0:C}'}" />
      <telerik:GridViewDataColumn IsReadOnly="True" Header="Upgrades(%)" DataMemberBinding="{Binding Path=UpgradePercentile,StringFormat='{}{0:N2}'}" />
		</telerik:RadGridView.Columns>
    </telerik:RadGridView>
    </DockPanel>
  </Grid>
  </DockPanel>
  </Grid>
</wpfx:BusyIndicator>
</UserControl>
