<localView:BeWoView x:Class="BeWo.View.Detail.AbsenceReasonView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:localView="clr-namespace:BeWo.View"
        xmlns:val="clr-namespace:BeWo.Validation" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
        xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" 
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase"
        xmlns:s="clr-namespace:System;assembly=mscorlib" Height="Auto" Width="Auto" HorizontalAlignment="Stretch"
        VerticalAlignment="Stretch" Focusable="True">
    <GroupBox Name="root" Header="Aktuell definierte Abwesenheitskategorien" Style="{StaticResource ObjectEditGroupBox}">
        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid.Resources>
                <DataTemplate x:Key="DropDownItemTemplate">
                    <Border Height="20" MinWidth="20" Background="{Binding}" BorderThickness="1" CornerRadius="2" HorizontalAlignment="Stretch" BorderBrush="Black" />
                </DataTemplate>
                <DataTemplate x:Key="SelectedItemTemplate">
                    <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{Binding}" BorderBrush="Black" BorderThickness="1" />
                </DataTemplate>
            </Grid.Resources>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Label Grid.Column="0" Grid.Row="0">Bezeichnung</Label>
            <TextBox Grid.Column="1" Grid.Row="0" Margin="3" Height="23"
                    Text="{val:ValidationBinding Path=NewVM.Description, UpdateSourceTrigger=PropertyChanged}" Width="125" />
            <Label Grid.Column="2" Grid.Row="0">max. abrechenbare Stunden (pro Woche)</Label>
                
            <dxe:SpinEdit Name="spinedit_hours" AllowNullInput="True" IsFloatValue="False" MinValue="0" Grid.Column="3" Grid.Row="0"
                    Height="23" Width="50"  EditValue="{Binding Path=NewVM.Hours, Converter={StaticResource Int2DecimalConverter}, UpdateSourceTrigger=PropertyChanged}" />
            <Label Grid.Column="4" Grid.Row="0">Minuten</Label>
            <dxe:SpinEdit Name="spinedit_minutes" AllowNullInput="True" IsFloatValue="False" Grid.Column="5" Grid.Row="0"
                    Height="23" Width="50" MinValue="0"
                    MaxValue="59"
                    EditValue="{Binding Path=NewVM.Minutes, Converter={StaticResource Int2DecimalConverter}, UpdateSourceTrigger=PropertyChanged}" />
            <Button Name="button_addReason" Click="button_addReason_Click" Grid.Column="2" Grid.Row="1" Height="25"
                    Margin="3" IsDefault="True" Grid.ColumnSpan="4" HorizontalAlignment="Right">Hinzufügen</Button>
            <Label Grid.Column="0" Grid.Row="1">
                Farbe im Belegungsplan
            </Label>
            <ComboBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" SelectedItem="{val:ValidationBinding Path=NewVM.Brush}" Name="combobox_brush" Grid.Column="1" Grid.Row="1" Height="23" Margin="3" ItemsSource="{Binding Path=AllBrushes, Mode=OneWay}" Width="125">

                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <UniformGrid Columns="12" Rows="12" IsItemsHost="True" />
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
                <ComboBox.ItemContainerStyle>
                    <Style TargetType="{x:Type ComboBoxItem}">
                        <Setter Property="Margin" Value="2" />
                        <Setter Property="Padding" Value="0" />
                    </Style>
                </ComboBox.ItemContainerStyle>
            </ComboBox>
            <dxg:GridControl x:Name="datagrid_absencereasons" Margin="0,10,0,0" Grid.Column="0" Grid.Row="2"
                    Grid.ColumnSpan="7" DataSource="{Binding VMList}">
                <dxg:GridControl.Columns>
                    <dxg:GridColumn FieldName="IsDeleteable" Header="" FixedWidth="True" Width="24" ReadOnly="True">
                        <dxg:GridColumn.CellTemplate>
                            <DataTemplate>
                                <Button Content="r"
                                        Visibility="{Binding Path=EditValue, Converter={StaticResource BoolVisibilityConverter}}"
                                        FontFamily="Webdings" Click="DeleteButton_Click" Width="18" Height="18"
                                        VerticalAlignment="Center" />
                            </DataTemplate>
                        </dxg:GridColumn.CellTemplate>
                    </dxg:GridColumn>
                    <dxg:GridColumn FieldName="Description" Header="Bezeichnung" Width="180" />
                    <dxg:GridColumn FieldName="Hours" Header="max. abrechenbare Stunden" Width="180" />
                    <dxg:GridColumn FieldName="Minutes" Header="Minuten" Width="180" />
                    <dxg:GridColumn x:Name="column_Color" FieldName="Brush" Header="Farbe" Width="70">
						<dxg:GridColumn.DisplayTemplate>
							<ControlTemplate>
								<Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{Binding Value, diagnostics:PresentationTraceSources.TraceLevel=High }" BorderBrush="Black" BorderThickness="1" />
							</ControlTemplate>
						</dxg:GridColumn.DisplayTemplate>
						<dxg:GridColumn.EditTemplate>
							<ControlTemplate>
								<Button x:Name="PART_Editor" BorderThickness="0" Style="{x:Null}" Background="{Binding EditValue}" Foreground="{Binding EditValue}" Height="21" HorizontalAlignment="Stretch" Click="button_select_color_Click"></Button>
							</ControlTemplate>
						</dxg:GridColumn.EditTemplate>
					</dxg:GridColumn>
                </dxg:GridControl.Columns>
                <dxg:GridControl.View>
                    <dxg:TableView AutoWidth="true" ShowGroupPanel="False" ShowGroupedColumns="false" ShowTotalSummary="False"
                            NavigationStyle="Cell" />
                </dxg:GridControl.View>
            </dxg:GridControl>
            <Popup x:Name="popup_color" StaysOpen="false" Placement="MousePoint">
                <ListBox x:Name="listbox_colorpicker" BorderThickness="0" Loaded="colorEditor_Loaded" SelectionChanged="listbox_colorpicker_SelectionChanged">
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <UniformGrid Columns="12" Rows="12" IsItemsHost="True" />
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Margin" Value="2" />
                            <Setter Property="Padding" Value="0" />
                        </Style>
                    </ListBox.ItemContainerStyle>
                </ListBox>
            </Popup>
        </Grid>
    </GroupBox>
</localView:BeWoView>