<localView:BeWoView x:Class="BeWo.View.Detail.AssessmentSheetValueView" 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:localViewModel="clr-namespace:BeWo.ViewModel" xmlns:localViewDetail="clr-namespace:BeWo.View.Detail" xmlns:val="clr-namespace:BeWo.Validation" xmlns:proxy="clr-namespace:BeWo.ServiceProxy" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:r="clr-namespace:BeWo.Security" VerticalAlignment="Stretch" Focusable="True" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic">

	<Grid>
		<GroupBox x:Name="root" Header="Aktuell erfasste Punktebogen Werte" 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="200" />
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition Width="*" />
					<ColumnDefinition Width="Auto" />
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
                    <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}" />

				<!--<Label Grid.Column="2" Grid.Row="0" >Shortcut Taste</Label>
                <TextBox Grid.Column="3" Grid.Row="0" Grid.ColumnSpan="2" Margin="3" Height="23" Text="{Binding Path=NewVM.ShortcutKey, UpdateSourceTrigger=PropertyChanged}" />-->

				<Label Grid.Row="1">Zeichen im Plan</Label>
				<TextBox Grid.Column="1" Grid.Row="1" Margin="3" Height="23" Text="{Binding Path=NewVM.Sign, UpdateSourceTrigger=PropertyChanged}" />

				<Label Grid.Column="0" Grid.Row="3">Position</Label>
				<dxe:SpinEdit EditValue="{Binding Path=NewVM.Position, Converter={StaticResource Int2DecimalConverter}, UpdateSourceTrigger=PropertyChanged}" 
                              x:Name="tb_pos" MinValue="0" IsFloatValue="False" Height="23" Margin="3" Grid.Row="3" Grid.Column="1" Width="100" HorizontalAlignment="Left" />


				<Label Grid.Column="0" Grid.Row="2">Farbe im Plan</Label>
				<ComboBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" SelectedItem="{val:ValidationBinding Path=NewVM.Brush}" Name="combobox_brush" Grid.Column="1" Grid.Row="2" Height="23" Margin="3" ItemsSource="{Binding Path=AllBrushes, Mode=OneWay}">

					<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>

				<Button Name="button_addAsv" FontWeight="Normal" Grid.Column="0" Grid.ColumnSpan="5" HorizontalAlignment="Left" Grid.Row="4" Height="25" Margin="3 3 3 3" Padding="5 0" Click="button_addAsv_Click" IsDefault="True">Hinzufügen</Button>

				<dxg:GridControl x:Name="datagrid_asv" Margin="0,10,0,0" Grid.Column="0" Grid.Row="5" 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" Click="DeleteButton_Click" Visibility="{Binding Path=EditValue, Converter={StaticResource BoolVisibilityConverter}}" FontFamily="Webdings" Width="18" Height="18" VerticalAlignment="Center" />
								</DataTemplate>
							</dxg:GridColumn.CellTemplate>
						</dxg:GridColumn>

						<dxg:GridColumn FieldName="Position" Header="Position" Width="80" />
						<dxg:GridColumn FieldName="Description" Header="Bezeichnung" Width="180" />
						<dxg:GridColumn FieldName="Sign" Header="Zeichen im Plan" Width="100" />
						<dxg:GridColumn x:Name="column_Color" FieldName="Brush" Header="Farbe" Width="40">
							<dxg:GridColumn.DisplayTemplate>
								<ControlTemplate>
									<Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{Binding Value }" 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>
	</Grid>

</localView:BeWoView>