I'm trying to drop a file into a textbox on my WPF application but it won't work. I believe I have the XAML setup correctly to do this, and a PreviewDragOver event handler does work-- just not Drop or PreviewDrop. Here's the XAML in question:
<Window x:Class="TableTagCount.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" AllowDrop="True">
<Grid Name="bgGrid" Drop="bgGrid_Drop" AllowDrop="True">
<Grid.Background>
<ImageBrush ImageSource="/TableTagCount;component/Images/Sunset.jpg" Stretch="Fill" TileMode="None" />
</Grid.Background>
<Button Content="Analyze" Height="23" HorizontalAlignment="Left" Margin="32,91,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click"/>
<TextBox Height="23" HorizontalAlignment="Left" Margin="32,43,0,0" Name="textBox1" VerticalAlignment="Top" Width="205" PreviewDragOver="textBox1_PreviewDragOver" AllowDrop="True" />
<Label Content="File Name" Height="28" HorizontalAlignment="Left" Margin="32,13,0,0" Name="label1" VerticalAlignment="Top" Width="65" />
</Grid></Window>
Note that the Drop operation does work on my Grid.
Also, I'd like to prevent the Drop event from being handled by the Grid if my textbox handles it first. In my textbox Drop handler I'm setting the DragEventArg's Handled property to true. Is this enough to keep the event from bubbling up to the Grid?