<Page x:Class="Foo.ClientServices.GUIWPForms.WorkspaceSelector_StandardPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Custom="http://schemas.microsoft.com/wpf/2008/toolkit"
    Title="WorkspaceSelector_StandardPage" Height="312" Loaded="Page_Loaded" Width="250" Foreground="Black">    
    <Page.Resources>
        <Style x:Key="DataGridCellStyle" TargetType="{x:Type Custom:DataGridCell}">
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="BorderBrush" Value="Transparent" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Custom:DataGridCell}">
                        <Border Background="Transparent" 
                            BorderBrush="{TemplateBinding BorderBrush}"  
                            BorderThickness="0" 
                            SnapsToDevicePixels="True">
                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
        <!-- Custom Brushes -->
        <LinearGradientBrush x:Key="RowBackgroundSelectedBrush" StartPoint="0,0" EndPoint="0,1">
            <GradientStop Color="#4F8CC7" Offset="0" />
            <GradientStop Color="#1C4B7C" Offset="0.7" />
            <GradientStop Color="#042D5B" Offset="1" />
        </LinearGradientBrush>
        <SolidColorBrush x:Key="RowBackgroundAlternationIndex2Brush" Color="#44FF0000" />
        <SolidColorBrush x:Key="RowBackgroundAlternationIndex3Brush" Color="#44CCCCCC" />
        
        <Style x:Key="DataGridDemoRowStyle" TargetType="{x:Type Custom:DataGridRow}">
            <Style.Triggers>
                <Trigger Property="AlternationIndex" Value="2" >
                    <Setter Property="Background" Value="{StaticResource RowBackgroundAlternationIndex2Brush}" />
                </Trigger>
                <Trigger Property="AlternationIndex" Value="3">
                    <Setter Property="Background" Value="{StaticResource RowBackgroundAlternationIndex3Brush}" />
                </Trigger>

                <Trigger Property="IsSelected" Value="true">
                    <Setter Property="Background" Value="{StaticResource RowBackgroundSelectedBrush}" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </Page.Resources>
    <Grid>       
        <Rectangle x:Name="recGradiant" Stroke="Black" RadiusY="1" RadiusX="1" Grid.ColumnSpan="2">
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" Opacity="1.0">
                    <GradientStop Color="#FF000000" Offset="0.238"/>
                    <GradientStop Color="#FE333333" Offset="0.778"/>
                    <GradientStop Color="#FE202020" Offset="0.613"/>
                    <GradientStop Color="#FE333333" Offset="0.87"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
        <my:DataGrid ItemsSource="{Binding ElementName=This, Path=WorkspacesDT.DefaultView}" 
                     AutoGenerateColumns="False" Margin="12,54,12,33" Name="dataGridWorkspaces" 
                     HorizontalScrollBarVisibility="Disabled" HeadersVisibility="None" 
                     VerticalScrollBarVisibility="Auto" TabIndex="1"
                     GridLinesVisibility="Horizontal"
                     CellStyle="{StaticResource DataGridCellStyle}"
                     RowStyle="{StaticResource DataGridDemoRowStyle}"
                     RowHeaderWidth="3" ColumnHeaderHeight="15"                     
                     SelectionMode="Single" SelectionUnit="FullRow" 
                     CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False"
                     CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="False"  
                     MouseRightButtonDown="dataGridWorkspaces_MouseRightButtonDown"
                     MouseDoubleClick="dataGridWorkspaces_MouseDoubleClick"
                     SelectedCellsChanged="dataGridWorkspaces_SelectedCellsChanged"                     
                     xmlns:my="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit" Background="White" BorderBrush="Transparent" BorderThickness="0" IsTabStop="False">
            
            <my:DataGrid.Columns>                
                <!--<my:DataGridTextColumn Binding="{Binding WorkspaceName}" />-->

                <my:DataGridTemplateColumn KeyboardNavigation.TabIndex="1" Header="WorkspaceName" Width="188" IsReadOnly="True">
                    <my:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>                            
                            <TextBlock TextWrapping="NoWrap" Text="{Binding WorkspaceName}">                                                                
                                <TextBlock.ToolTip>
                                    <TextBlock TextWrapping="Wrap" Width="188" Text="{Binding WorkspaceName}"/>
                                </TextBlock.ToolTip>                                
                            </TextBlock>
                        </DataTemplate>
                    </my:DataGridTemplateColumn.CellTemplate>
                </my:DataGridTemplateColumn>

                <my:DataGridTemplateColumn KeyboardNavigation.TabIndex="1" Header="Date" Width="20" IsReadOnly="True">
                    <my:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <!--<TextBlock Text="{Binding Date, StringFormat=d}" />-->
                            <!--<Button Visibility="{Binding ButtonIsVisible}" Background="Transparent" Height="16" Width="16" Margin="0,0,0,0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="ButtonGrid_Click">
                                <Button.Content>-->
                                    <!--<Image Source="PageImages/Launch.png"></Image>-->
                                    <Image Source="{Binding ButtonResUri}" Height="16" Width="16">
                                        <Image.ToolTip>
                                            <TextBlock TextWrapping="Wrap" Width="100" Text="{Binding ButtonToolTipText}"/>                                            
                                        </Image.ToolTip>                                        
                                    </Image>
                                    <!--<TextBlock Text="{Binding Word, StringFormat=d}" />-->
                                <!--</Button.Content>
                            </Button>-->                        
                        </DataTemplate>
                    </my:DataGridTemplateColumn.CellTemplate>
                </my:DataGridTemplateColumn>                
            </my:DataGrid.Columns>
            
            <!--<my:DataGrid.ContextMenu>
                <ContextMenu >
                    <MenuItem x:Name="menuItemLaunch" Header="Launch">                        
                        <MenuItem.Icon>
                            <Image Source="Images/cut.png" />                            
                        </MenuItem.Icon>                        
                    </MenuItem>
                </ContextMenu>
            </my:DataGrid.ContextMenu>-->  
            
        </my:DataGrid>
        <Label Height="28" Margin="16,-2,12,0" Name="lblCurrentWorkspace" VerticalAlignment="Top"
               Foreground="White" HorizontalContentAlignment="Center">Workspaces</Label>
        <ComboBox Height="23" Margin="33,23,32,0" Name="comboBoxSortBy" VerticalAlignment="Top" TabIndex="0" SelectionChanged="comboBoxSortBy_SelectionChanged" />
        <Button Background="Transparent" BorderThickness="0" BorderBrush="Transparent" Height="24" Width="24" HorizontalAlignment="Left" Margin="12,0,0,5" Name="btnNew" VerticalAlignment="Bottom" Click="btnNew_Click" TabIndex="2">
            <Button.Content>
                <Image Source="PageImages/AddWorkspace.png"></Image>
            </Button.Content>
            <!--<Button.ToolTip>
                <ToolTip>
                    <TextBlock TextWrapping="Wrap" Width="150">Doris Loves to play with her piano. Piano is alot of fun and she likes to play with it</TextBlock>                    
                </ToolTip>
            </Button.ToolTip>-->
        </Button>
        <Button Background="Transparent" BorderThickness="0" BorderBrush="Transparent" Height="24" Width="24" Margin="42,0,0,5" Name="btnEdit" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="btnEdit_Click" TabIndex="3">
            <Button.Content>
                <Image Source="PageImages/EditWorkspace.png"></Image>
            </Button.Content>
        </Button>
        <Button Background="Transparent" BorderThickness="0" BorderBrush="Transparent" Height="24" Width="24" Margin="72,0,0,5" Name="btnDelete" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="btnDelete_Click" TabIndex="4">
            <Button.Content>
                <Image Source="PageImages/DeleteWorkspace.png"></Image>
            </Button.Content>
        </Button>
        <Button Background="Transparent" BorderThickness="0" BorderBrush="Transparent" Height="24" Width="24" HorizontalAlignment="Right" Margin="0,0,12,5" Name="btnCloseAll" VerticalAlignment="Bottom" Click="btnCloseAll_Click" TabIndex="5">            
            <Button.Content>
                <Image Source="PageImages/CloseAll.png"></Image>
            </Button.Content>
        </Button>
    </Grid>
</Page>
