<UserControl x:Class="TradeBlotter.Views.HeadlinesView"
						 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:dc="clr-namespace:TradeBlotter.UIUtils"						 
             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>
		<dc:SubStringConverter x:Key="FFCConverter" Length="100" ShowEllipse="True" />
		<Style x:Key="TradeItemStyle" TargetType="{x:Type telerik:RadGridView}">
		</Style>

		<Style x:Key="HeadlineCellStyle" TargetType="{x:Type telerik:GridViewCell}">
			<Style.Triggers>
				<DataTrigger Binding="{Binding Path=Sentiment}" Value="Positive">
					<Setter Property="Background" Value="#FF228B22" />
				</DataTrigger>
				<DataTrigger Binding="{Binding Path=Sentiment}" Value="Negative">
          <Setter Property="Background" Value="#FFFF0000" />
          <Setter Property="Foreground" Value="#FFFFFFFF" />
        </DataTrigger>
				<DataTrigger Binding="{Binding Path=Sentiment}" Value="Neutral">
					<Setter Property="Background" Value="#FF87CEFA" />
				</DataTrigger>
			</Style.Triggers>
		</Style>



	</UserControl.Resources>
	<wpfx:BusyIndicator Name="BusyBar" IsBusy="{Binding Path=BusyIndicator}" BusyContent="Loading Headlines...">
		<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="Refresh" HorizontalAlignment="Left" Command="{Binding Path=RefreshCommand}"></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 CellStyle="{StaticResource HeadlineCellStyle}" IsReadOnly="True" Header="Date" DataMemberBinding="{Binding Path=Date,StringFormat='{}{0:MM/dd/yyyy}'}" />

								<telerik:GridViewDataColumn CellStyle="{StaticResource HeadlineCellStyle}" IsReadOnly="True" Header="Updated" DataMemberBinding="{Binding Path=Modified,StringFormat='{}{0:HH:mm:ss}'}" />

								<telerik:GridViewDataColumn CellStyle="{StaticResource HeadlineCellStyle}" 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:HeadlinesView}},Path=DataContext.Parity}"/>
											</StackPanel>
										</DataTemplate>
									</telerik:GridViewColumn.ToolTipTemplate>									
								</telerik:GridViewDataColumn>

								<telerik:GridViewDataColumn CellStyle="{StaticResource HeadlineCellStyle}" IsReadOnly="True" Header="Company Name" DataMemberBinding="{Binding Path=CompanyName}" >
									<telerik:GridViewColumn.ToolTipTemplate>
										<DataTemplate >
											<StackPanel Orientation="Horizontal" >
												<TextBlock Background="LemonChiffon" MaxWidth="1000" TextWrapping="Wrap" Text="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type vw:HeadlinesView}},Path=DataContext.Description}"/>
											</StackPanel>
										</DataTemplate>
									</telerik:GridViewColumn.ToolTipTemplate>
								</telerik:GridViewDataColumn>

								<telerik:GridViewDataColumn CellStyle="{StaticResource HeadlineCellStyle}" IsReadOnly="True" MaxWidth="1024" Header="Headline" DataMemberBinding="{Binding Path=Entry,Converter={StaticResource FFCConverter}}" >
								</telerik:GridViewDataColumn>
									
									<!--<telerik:GridViewDataColumn.CellStyle>
										<Style TargetType="telerik:GridViewCell">
											<Style.Triggers>
												<DataTrigger Binding="{Binding Path=Sentiment}" Value="Positive">
													<Setter Property="Background" Value="Green" />
												</DataTrigger>
												<DataTrigger Binding="{Binding Path=Sentiment}" Value="Negative">
													<Setter Property="Background" Value="Red" />
												</DataTrigger>
												<DataTrigger Binding="{Binding Path=Sentiment}" Value="Neutral">
													<Setter Property="Background" Value="LightBlue" />
												</DataTrigger>
											</Style.Triggers>
										</Style>
									</telerik:GridViewDataColumn.CellStyle>-->
								<!--</telerik:GridViewDataColumn>-->



								<telerik:GridViewDataColumn CellStyle="{StaticResource HeadlineCellStyle}" IsReadOnly="True" Header="Source" DataMemberBinding="{Binding Path=Source}" />
								<!--</telerik:GridViewDataColumn>-->

								<telerik:GridViewDataColumn CellStyle="{StaticResource HeadlineCellStyle}" IsReadOnly="True" MaxWidth="1024" Header="Sentiment" DataMemberBinding="{Binding Path=Sentiment}" />
								<!--</telerik:GridViewDataColumn>-->


							</telerik:RadGridView.Columns>
						</telerik:RadGridView>
					</DockPanel>
				</Grid>
			</DockPanel>
		</Grid>
	</wpfx:BusyIndicator>
</UserControl>
