<localView:BeWoView x:Class="BeWo.View.Detail.NewsItemView" 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"
                    xmlns:search="clr-namespace:BeWo.View.Search">

	<Grid>
		<GroupBox Name="root" Header="Ankündigungen" Style="{StaticResource ObjectEditGroupBox}">
			<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

				<Grid.RowDefinitions>
					<RowDefinition Height="Auto" />
					<RowDefinition Height="*" />
				</Grid.RowDefinitions>

				<Grid Name="grid_new">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="*" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					<Label Grid.Column="0" Grid.Row="0">Titel</Label>
					<TextBox Grid.Column="1" Grid.Row="0" Margin="3" Height="23" Text="{val:ValidationBinding Path=NewVM.Title, UpdateSourceTrigger=PropertyChanged}" />
					<Label Grid.Column="2" Grid.Row="0">Veröffentlichen am</Label>
                    <dxe:DateEdit MaskType="DateTimeAdvancingCaret" Margin="3" Height="23" Width="100" Grid.Column="3" Grid.Row="0" 
								  HorizontalAlignment="Left"
								  EditValue="{val:ValidationBinding Path=NewVM.PublishDate, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />

					<Label Grid.Column="0" Grid.Row="1">Nur für Team</Label>
					<uc:PopUpEdit IsReadOnly="True"
                                      x:Name="popupedit_TeamSearch"
                                      Grid.Column="1" Margin="3" Height="23" Grid.Row="1"
                                      DeleteButtonVisibility="Visible"
									  DeleteClick="Popupedit_TeamSearch_OnDeleteClick"
                                      PopUpClick="popupedit_TeamSearch_PopUpClick" />
					<Popup Margin="10" x:Name="popup_Team" StaysOpen="False" Placement="MousePoint" Width="400" Grid.Row="1" Height="400" Grid.Column="1" >
						<search:TeamSearchView ItemSelected="TeamSearchView_TeamSelected" x:Name="teamSearchView" />
					</Popup>
					
				
					<Label Grid.Row="2">Text</Label>
					<TextBox Grid.Column="1" Grid.Row="2" Margin="3" Height="80" AcceptsReturn="True" Grid.ColumnSpan="3" Text="{val:ValidationBinding Path=NewVM.Text, UpdateSourceTrigger=PropertyChanged}" />

					<Button Name="button_addNewsItem" Click="button_addNewsItem_Click" HorizontalAlignment="Right" Grid.Column="3" Grid.Row="3" Height="25" Margin="3" IsDefault="True">Hinzufügen</Button>
				</Grid>

				<dxg:GridControl x:Name="datagrid_news" Margin="0,10,0,0" Grid.Column="0" Grid.Row="1" DataSource="{Binding VMList}">
					<dxg:GridControl.Columns>
						<dxg:GridColumn FieldName="Title" Header="" FixedWidth="True" Width="24" ReadOnly="True">

							<dxg:GridColumn.CellTemplate>
								<DataTemplate>
									<Button Content="r" FontFamily="Webdings" Click="DeleteButton_Click" Width="18" Height="18" VerticalAlignment="Center" />
								</DataTemplate>
							</dxg:GridColumn.CellTemplate>


						</dxg:GridColumn>
						<dxg:GridColumn FieldName="Title" Header="Titel" Width="180" />
						<dxg:GridColumn FieldName="Text" Header="Text" Width="180">
							<dxg:GridColumn.EditSettings>
								<dxe:TextEditSettings AcceptsReturn="True" TextWrapping="Wrap" />
							</dxg:GridColumn.EditSettings>
						</dxg:GridColumn>
						<dxg:GridColumn FieldName="PublishDate" Header="Veröffentlichen am" Width="180" EditSettings="{dxe:DateSettings DisplayFormat=d}">
							<!--<dxg:GridColumn.EditSettings >
                                <dxe:DateEditSettings DisplayFormat="d"/>
                            </dxg:GridColumn.EditSettings>-->
						</dxg:GridColumn>
						<dxg:GridColumn FieldName="Team.Name" Header="Team" Width="180" />
					</dxg:GridControl.Columns>
					<dxg:GridControl.View>
						<dxg:TableView AutoWidth="true" ShowGroupPanel="False" ShowGroupedColumns="false" ShowTotalSummary="False" NavigationStyle="Cell" />
					</dxg:GridControl.View>
				</dxg:GridControl>
			</Grid>
		</GroupBox>
	</Grid>

</localView:BeWoView>