<localView:BeWoView x:Class="BeWo.View.BeWoFileView" 
                    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:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" 
                    xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" 
                    Height="Auto" Width="Auto" HorizontalAlignment="Stretch" 
                    xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase" 
                    VerticalAlignment="Stretch" Focusable="True">
	<localView:BeWoView.Resources>

		<ContextMenu x:Key="cm" MenuItem.Click="ContextMenu_Click" Opened="ContextMenu_Opened">
            <MenuItem Header="Neu" >
                <MenuItem.Icon>
                    <Image Source="..\Ressources\Icons\Add24.png"/>
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Header="Umbenennen">
                <MenuItem.Icon>
                    <Image Source="..\Ressources\Icons\Rename24.png"/>
                </MenuItem.Icon>
            </MenuItem>
            <Separator />
			<MenuItem Header="Löschen" >
                <MenuItem.Icon>
                    <Image Source="..\Ressources\Icons\Delete24.png"/>
                </MenuItem.Icon>
            </MenuItem>
		</ContextMenu>

		<HierarchicalDataTemplate x:Key="test" DataType="{x:Type localViewModel:BeWoFolderVM}" ItemsSource="{Binding SubFolders}">

			<StackPanel Orientation="Horizontal" ContextMenu="{StaticResource cm}">
				<Image Name="img" Width="20" Height="20" Stretch="Fill" Source="..\Ressources\Icons\Folder.png" />

				<TextBox Cursor="Arrow" Background="Transparent" Padding="2 1" LostFocus="TextBox_LostFocus" KeyDown="TextBox_KeyDown" BorderThickness="0" IsReadOnly="True" Text="{Binding Path=Name}" />
			</StackPanel>
		</HierarchicalDataTemplate>

	</localView:BeWoView.Resources>
	<Grid>
		<Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="*" />
			</Grid.ColumnDefinitions>
            <GroupBox Grid.ColumnSpan="2" Padding="5" Style="{StaticResource ObjectEditGroupBox}" Header="Neue Datei hochladen">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <Label Grid.Row="1" Content="Datei" />
                    <uc:PopUpEdit IsReadOnly="True" Name="popupedit_file" Grid.Column="1" Margin="3" Height="23" Grid.Row="1" DeleteButtonVisibility="Collapsed" PopUpClick="popupedit_file_PopUpClick" />
                    <Label Grid.Row="1" Grid.Column="2" Content="Beschreibung" />
                    <TextBox Name="textbox_fileNotice" Margin="3" Height="23" Grid.Row="1" Grid.Column="3" />
                    <Button IsEnabled="False" Name="button_uploadDocument" Margin="3" Height="25" Grid.Row="1" Grid.Column="4" Click="button_uploadDocument_Click" Content="Dokument hochladen" />

                    <ProgressBar Height="20" Margin="3" Name="progressbar_upload" Grid.Row="2" Grid.ColumnSpan="5" Minimum="0" Maximum="1" />
                    <Label VerticalAlignment="Center" Grid.Row="2" Grid.ColumnSpan="5" HorizontalAlignment="Center" Name="text_progress" />
                </Grid>

            </GroupBox>
            
            <TreeView Grid.Row="1" Margin="5,3,2,5" PreviewMouseDown="TreeViewItem_PreviewMouseRightButtonDown" x:Name="treeview" MinWidth="200" ItemTemplate="{StaticResource test}" ItemsSource="{Binding}"></TreeView>

            <dxg:GridControl Grid.Row="1" Margin="2,3,5,5" DataSource="{Binding SelectedItem.Files, ElementName=treeview, diagnostics:PresentationTraceSources.TraceLevel=High}" x:Name="datagrid_documents" Grid.Column="1">
				<dxg:GridControl.Columns>
                    <dxg:GridColumn FieldName="FileName" 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="InsertedOn" AllowEditing="False" Header="hinterlegt am" Width="150" />
					<dxg:GridColumn FieldName="InsertedBy" AllowEditing="False" Header="hinterlegt von" Width="150" />
					<dxg:GridColumn FieldName="FileName" AllowEditing="False" Header="Dateiname" Width="180" />
					<dxg:GridColumn FieldName="Description" AllowEditing="False" Header="Beschreibung" Width="180" />
					<dxg:GridColumn FieldName="URL" Header="" Width="100">
						<dxg:GridColumn.CellTemplate>
							<DataTemplate>
								<TextBlock>
									<Hyperlink TargetName="inexistent" NavigateUri="{Binding Path=Value, Converter={StaticResource DownloadURLConverter}}" RequestNavigate="Hyperlink_OnRequestNavigate">
										<TextBlock Text="herunterladen" />
									</Hyperlink>
								</TextBlock>
							</DataTemplate>
						</dxg:GridColumn.CellTemplate>
					</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>

		</Grid>
		<Canvas>
            <Grid x:Name="CursorControl" Visibility="Visible" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Border Background="AliceBlue" Opacity="0.75">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Image x:Name="imageFolder" Source="..\Ressources\Icons\Folder.png"/>
                        <Image x:Name="imageFile" Source="..\Ressources\Icons\Document48.png"/>
                        
                        <TextBlock x:Name="labelFrom" Grid.Column="1" Text="Datei xyz.txt" Margin="3" />
                    </Grid>
                </Border>
                <TextBlock x:Name="labelTo" Grid.Row="1" Grid.ColumnSpan="2" Text="-> Nach verschieben" Margin="3" Foreground="Blue" Opacity="1"/>
            </Grid>
            
		</Canvas>
	</Grid>

</localView:BeWoView>