I'm getting a runtime exception at the instant I grab a DragSource item with the mouse and start to move it.
I only get this when I've set the following on my DropTargets:
dropTarget.DropTargetStyle = (Style)this.Resources["HoverOverStyle"];
My Style Resource is set as follows:
<UserControl.Resources> <Style x:Key="HoverOverStyle" TargetType="ContentControl"> <Setter Property="Background" Value="Yellow"/> </Style></UserControl.Resources>
The Exception is: System.Windows.Markup.XamlParseException:
Please see the attached file, DropTargetStyle.zip, for detail about the exception.
Hi Valerie,
Thanks for your reply in the support section. I clicked on the link to add a note but nothing happened.
As I continue trying to work all of this out, I'm sure I'll have more questions, but right now I'm good.
Thanks!
Hello Joe,
Do you have any other questions on this matter?
Valerie
Hi Nikolay,
I really appreciate all your help. I'm beginning to get a clearer understanding of how DD works.
Since I have so many DragSource's and DropTarget's, I think I'm going to have to make heavy use of the Channels functionality.
Thanks Again,
Joe
Hi,
The reason for the error in the sample from your last post is the TargetType of your style. It is ContentControl, but your DropTarget is WrapPanel (it derives from Panel).
When the mouse gets over the target the D&D framework tries to set the style on the target, but the style has wrong TargetType and SL throws XamlParserException.
Regards,
Note: I've attached the modified files. Tried to send the zipped project, but it exceeded your 200kb upload limit.
Thank you for your help. I modified the TestApp project (Forum4.zip) you sent me the other day. I added:
to file TestView.xaml.cs.
And I added this Style definition to TestView.xaml:
The modified project is attached. To see the error, grab an item from the listbox and move to the wrappanel (no need to drop).