1

This is my XAML

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

    <ProgressBar Grid.Row="1" IsIndeterminate="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Foreground="#02F4C4" Value="{Binding CurrentProgress}"/>
    <TextBlock Grid.Row="1" Text="{Binding CurrentProgressText}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22"/>

    <ProgressBar Grid.Row="2" IsIndeterminate="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Foreground="#02F432" Value="{Binding OverallProgress}"/>
    <TextBlock Grid.Row="2" Text="{Binding OverallProgressText}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22"/>

    <Rectangle Grid.Row="0" Fill="#CCCCCC" HorizontalAlignment="Stretch" Stroke="Black" VerticalAlignment="Stretch" AllowDrop="True" DragOver="Rectangle_DragOver" Drop="Rectangle_Drop" DragEnter="Rectangle_DragOver" Visibility="{Binding DragDropVisibility}"/>
    <TextBlock Grid.Row="0" Text="Drag folder(s) here to start" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" AllowDrop="True" DragOver="Rectangle_DragOver" Drop="Rectangle_Drop" DragEnter="Rectangle_DragOver" Visibility="{Binding DragDropVisibility}"/>
</Grid>

and I tried to drag file/folder to that rectangle area but no success mean no breakpoint is reached at Rectangle_DragOver:

private void Rectangle_DragOver(object sender, DragEventArgs e)
{
    //e.Effects = DragDropEffects.None;

    if (e.Data.GetDataPresent(DataFormats.FileDrop))
    {
        var files = e.Data.GetDataPresent(DataFormats.FileDrop);

        e.Effects = DragDropEffects.Copy | DragDropEffects.Move;
    }
}

private void Rectangle_Drop(object sender, DragEventArgs e)
{

}

Where is my mistake ? What's going wrong ?

Snake Eyes
  • 16,287
  • 34
  • 113
  • 221
  • 1
    I just complied the code and tried to drag a file over the area : both methods are hit for me, although the mouse is a "unavailable" pointer. – user8478480 May 08 '19 at 06:41
  • Check for errors in your binding properties, rest everything looks good. – Justin CI May 08 '19 at 07:01
  • No binding error exists ... I tried with very basic example without rows and other stuff... I added AllowDrop also on ProgressBar but same thing. – Snake Eyes May 08 '19 at 07:03
  • Can you believe that is not working if debug from Visual Studio 2019, but it works very well in Visual Studio 2017 ? Dammit Microsoft ! – Snake Eyes May 08 '19 at 07:07
  • Possible duplicate of [Visual Studio 2010 WPF Project ran in debug or release will not allow drag and drop to any control](https://stackoverflow.com/questions/7485909/visual-studio-2010-wpf-project-ran-in-debug-or-release-will-not-allow-drag-and-d) – Rekshino May 09 '19 at 06:03

0 Answers0