<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="using:PortfolioManager.ViewModels"
        xmlns:vw="using:PortfolioManager.Views"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:controls="clr-namespace:HyperText.Avalonia.Controls;assembly=HyperText.Avalonia"
		xmlns:mxc="https://schemas.eremexcontrols.net/avalonia/charts"		
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="PortfolioManager.Views.MainWindow"
        x:DataType="vm:MainWindowViewModel"
        Icon="/Assets/HighSeas.jpg"
        Title="{Binding Path=DisplayName}" >

    <Design.DataContext>
        <!-- This only sets the DataContext for the previewer in an IDE,
             to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
        <vm:MainWindowViewModel/>
    </Design.DataContext>

   <Window.DataTemplates>
		<DataTemplate DataType="vm:MGSHMomentumViewModel">
			<vw:MGSHMomentumView />
		</DataTemplate>
		<DataTemplate DataType="vm:MomentumViewModel">
			<vw:MomentumView />
		</DataTemplate>		
		<DataTemplate DataType="vm:CMMomentumViewModel">
			<vw:CMMomentumView />
		</DataTemplate>		
		<DataTemplate DataType="vm:CMTrendViewModel">
			<vw:CMTrendView />
		</DataTemplate>			
		<DataTemplate DataType="vm:GainLossViewModel">
			<vw:GainLossView />
		</DataTemplate>				
		<DataTemplate DataType="vm:BollingerBandViewModel">
			<vw:BollingerBandView />
		</DataTemplate>			
	</Window.DataTemplates>

    <Window.Styles>
		<Style Selector="TextBox">
		  <Setter Property="Foreground" Value="#000000"/>	
		  <Setter Property="FontSize" Value="11"/>
		  <Setter Property="Margin" Value="2,1,2,1"/>
		  <Setter Property="VerticalAlignment" Value="Center"/>	
		</Style>
		<Style Selector="ComboBox">
		  <Setter Property="Foreground" Value="#000000"/>	
		  <Setter Property="FontSize" Value="11"/>
		  <Setter Property="Margin" Value="2,1,2,1"/>
		  <Setter Property="VerticalAlignment" Value="Center"/>	
		</Style>		
		<Style Selector="Label">
		  <Setter Property="Foreground" Value="#000000"/>	
		  <Setter Property="FontSize" Value="11"/>
		  <Setter Property="Margin" Value="2,1,2,1"/>
		  <Setter Property="VerticalAlignment" Value="Center"/>	
		</Style>
		<Style Selector="TextBlock">
		  <Setter Property="VerticalAlignment" Value="Center"/>	
		  <Setter Property="FontSize" Value="11"/>		  
		  <Setter Property="FontWeight" Value="DemiBold"/>
		</Style>		
		<Style Selector="Button">
		  <Setter Property="FontSize" Value="11"/>		  
		</Style>
		<Style Selector="Button.hyperlink">
			<Setter Property="Template">
			<ControlTemplate>
				<TextBlock Text="{TemplateBinding Content}" Foreground="#2B2B2B" TextDecorations="Underline">
				<TextBlock.Styles>
					<Style Selector="TextBlock:pointerover">
					<Setter Property="Foreground" Value="#D0D0D0"/>
					</Style>
				</TextBlock.Styles>
				</TextBlock>
			</ControlTemplate>
			</Setter>
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="BorderThickness" Value="0"/>
		</Style>		
	</Window.Styles>

	<!-- <DataGrid.Styles>
		<Style Selector="DataGridRow">
		<Setter Property="ToolTip.Tip" Value="{Binding ToolTipText}" />
		</Style>
	</DataGrid.Styles>	 -->
       
	<Grid >
		<DockPanel>
			<DockPanel DockPanel.Dock="Top" KeyboardNavigation.TabNavigation="None">
				<Menu KeyboardNavigation.TabNavigation="Cycle" Name="mainMenu">
					<MenuItem Header="_File" >
						<MenuItem Header="E_xit" Command="{Binding Path=CloseCommand}" />
					</MenuItem>
					<MenuItem Header="_Edit"/>
					<MenuItem Header="_Options"/>
					<!-- <MenuItem Header="_Windows" ItemsSource="{Binding MenuItems,Mode=OneWay}"/> -->
					<MenuItem Header="_Help"/>
				</Menu>
			</DockPanel>
			<Grid Margin="4">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition Width="4" />
					<ColumnDefinition Width="*" />
				</Grid.ColumnDefinitions>

				<Border Grid.Column="0" Background="#8b8378" BorderBrush="LightGray" BorderThickness="1" CornerRadius="5" Width="185" >
					<HeaderedContentControl	Content="{Binding Path=Commands}" Header="View Panel" >
					<HeaderedContentControl.ContentTemplate>
					<DataTemplate>
						<ItemsControl IsTabStop="False" ItemsSource="{Binding}" Margin="6,2">
							<ItemsControl.ItemTemplate>
								<DataTemplate DataType="vm:CommandViewModel">
									<Button Margin="2,6" Command="{Binding Path=Command}" Classes="hyperlink" Content="{Binding Path=DisplayName}"/>										
								</DataTemplate>
							</ItemsControl.ItemTemplate>
						</ItemsControl>
					</DataTemplate>
					</HeaderedContentControl.ContentTemplate>
					</HeaderedContentControl>
				</Border>
				
				<Border Grid.Column="2" Background="#8b8378" BorderBrush="LightGray" BorderThickness="1" CornerRadius="5" >
					<HeaderedContentControl x:Name="HeaderedContentControl" Content="{Binding Path=Workspaces}" Header="Views">
					<HeaderedContentControl.ContentTemplate>
					<DataTemplate>
						<!-- <TabControl Margin="4" ItemsSource="{Binding}" SelectedIndex="{Binding Path=SelectedIndex,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type vm:WorkspaceViewModel}}}, Mode=TwoWay"> -->
						<TabControl x:Name="TabViews" Margin="4" ItemsSource="{Binding}" SelectionChanged="tabControl_SelectionChanged">
							<TabControl.ItemTemplate>							
								<DataTemplate DataType="vm:WorkspaceViewModel">
									<DockPanel>
										<TextBlock Text="{Binding Title}"></TextBlock>
										<Button 
											Command="{Binding Path=CloseCommand}"
											Content="X"
											Cursor="Hand"
											DockPanel.Dock="Right"
											Focusable="False"
											FontFamily="Arial" 
											FontSize="10"
											FontWeight="Bold"  
											Margin="1,1,1,1"
											Padding="0"
											VerticalContentAlignment="Center"
											HorizontalAlignment="Center"
											Width="16" Height="16"> 
										</Button>
									</DockPanel>
								</DataTemplate>
							</TabControl.ItemTemplate>
						</TabControl>
					</DataTemplate>
					</HeaderedContentControl.ContentTemplate>
					</HeaderedContentControl>
				</Border>
			</Grid>
		</DockPanel>
	</Grid>
</Window>
