<UserControl x:Class="TradeBlotter.Views.SectorView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
      xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
      xmlns:wpfx="http://schemas.xceed.com/wpf/xaml/toolkit"
	>
  <wpfx:BusyIndicator Name="BusyBar" IsBusy="{Binding Path=BusyIndicator}" BusyContent="Generating Sector Breakdown...">
  <Grid Background="LightGray">  
  <DockPanel>
      <Grid Margin="4">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="6" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="3" />
          <RowDefinition Height="30" />
        </Grid.RowDefinitions>
        <GroupBox Header="Selection" >
        <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical">
        <Label Content="Account" HorizontalAlignment="Left" Target="{Binding ElementName=accountListLbl}" ></Label>
        <ComboBox ItemsSource="{Binding Path=Accounts, Mode=OneTime}" SelectedItem="{Binding Path=SelectedAccount, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
        <Label Content="Sector/Industry" HorizontalAlignment="Left" Target="{Binding ElementName=accountListLbl}" ></Label>
        <ComboBox Margin="2,2" ItemsSource="{Binding Path=SectorIndustry, Mode=OneTime}" SelectedItem="{Binding Path=SelectedOperation, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
        <CheckBox Content="Include Cash" IsChecked="{Binding Path=IncludeCash}" Margin="0,1" ></CheckBox>
        <CheckBox Content="Realtime Price" IsChecked="{Binding Path=UseRealPrice}" Margin="0,1" ></CheckBox>
        <Button Margin="0,1" Content="Refresh" HorizontalAlignment="Left" Command="{Binding Path=RefreshCommand}"></Button>
        </StackPanel>
        </GroupBox>
      </Grid>
      <Grid Grid.Row="0" >
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="30" />
        <RowDefinition Height="*" />
        <RowDefinition Height="30" />
        <RowDefinition Height="*" />
      </Grid.RowDefinitions>

      <Label Grid.Row="0" Content="{Binding Path=TitleExposure, Mode=OneWay}" HorizontalAlignment="Center" Target="{Binding ElementName=titleLbl}" FontSize="16" FontWeight="Bold" BorderThickness="1"></Label>  
      <telerik:RadPieChart DockPanel.Dock="Left" x:Name="PieChartExposure" Palette="Crystal" Grid.Row="1">
						<telerik:RadPieChart.SmartLabelsStrategy>
							<telerik:PieChartSmartLabelsStrategy/>
						</telerik:RadPieChart.SmartLabelsStrategy>
						<telerik:PieSeries  ItemsSource="{Binding Path=PieDataExposure}" ShowLabels="True" RadiusFactor=".80" >
						<telerik:PieSeries.LabelConnectorsSettings>
							<telerik:ChartSeriesLabelConnectorsSettings />
						</telerik:PieSeries.LabelConnectorsSettings>
							<telerik:PieSeries.ValueBinding>
            <telerik:PropertyNameDataPointBinding PropertyName="Value"></telerik:PropertyNameDataPointBinding>
          </telerik:PieSeries.ValueBinding>
          <telerik:PieSeries.LabelDefinitions>
            <telerik:ChartSeriesLabelDefinition Margin="-7">
            <telerik:ChartSeriesLabelDefinition.Binding>
            <telerik:PropertyNameDataPointBinding PropertyName="Label"></telerik:PropertyNameDataPointBinding>
            </telerik:ChartSeriesLabelDefinition.Binding>
					</telerik:ChartSeriesLabelDefinition>
          </telerik:PieSeries.LabelDefinitions>
          <telerik:PieSeries.AngleRange>
          <telerik:AngleRange StartAngle="0" SweepAngle="360" SweepDirection="Clockwise"/>
          </telerik:PieSeries.AngleRange>
        </telerik:PieSeries>
      </telerik:RadPieChart>
            

      <Label Grid.Row="2" Content="{Binding Path=TitleContribution, Mode=OneWay}" HorizontalAlignment="Center" Target="{Binding ElementName=titleLbl}" FontSize="16" FontWeight="Bold" BorderThickness="1"></Label>  
      <telerik:RadPieChart DockPanel.Dock="Left" x:Name="PieChartContribution" Palette="Crystal" Grid.Row="3" >
				<telerik:RadPieChart.SmartLabelsStrategy>
					<telerik:PieChartSmartLabelsStrategy/>
				</telerik:RadPieChart.SmartLabelsStrategy>
        <telerik:PieSeries ItemsSource="{Binding Path=PieDataContribution}" ShowLabels="True" RadiusFactor=".80" >
					<telerik:PieSeries.LabelConnectorsSettings>
						<telerik:ChartSeriesLabelConnectorsSettings />
					</telerik:PieSeries.LabelConnectorsSettings>
					<telerik:PieSeries.ValueBinding>
            <telerik:PropertyNameDataPointBinding PropertyName="Value"></telerik:PropertyNameDataPointBinding>
          </telerik:PieSeries.ValueBinding>
          <telerik:PieSeries.LabelDefinitions>
            <telerik:ChartSeriesLabelDefinition Margin="-10">
            <telerik:ChartSeriesLabelDefinition.Binding>
            <telerik:PropertyNameDataPointBinding PropertyName="Label"></telerik:PropertyNameDataPointBinding>
            </telerik:ChartSeriesLabelDefinition.Binding>
          </telerik:ChartSeriesLabelDefinition>
          </telerik:PieSeries.LabelDefinitions>
          <telerik:PieSeries.AngleRange>
          <telerik:AngleRange StartAngle="0" SweepAngle="360"  SweepDirection="Clockwise"/>
          </telerik:PieSeries.AngleRange>
        </telerik:PieSeries>
      </telerik:RadPieChart>
            
      </Grid>
  </DockPanel>
  </Grid>
  </wpfx:BusyIndicator>
</UserControl>
