这是我的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>
并且我试图将文件/文件夹拖到该矩形区域,但是没有成功意味着在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)
{
}
我的错误在哪里?怎么了?