TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
C B
NA
22
22k
C# Drag and Drop - DragDrop.DoDragDrop()
Mar 9 2012 12:12 PM
Hello
I am trying to drag and drop one label into another label (receiving label). Both labels have been set up in wpf and the recieving label has been set AllowDrop="True" Drop="lblTarget_Drop". The problem I am getting is, I cannot get the content and background colour to transfer across to the receiving label e.g:
Background colour is blue and its content is the number 1. How do you get both the content and the background colour to transfer into the receiving label.
Thanks for your time.
Cheers
C
//C# Drag and Drop code
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void lblSource_MouseDown(object sender, MouseButtonEventArgs e)
{
Label lbl = (Label)sender;
DragDrop.DoDragDrop(lbl, lbl.Content, DragDropEffects.Copy);
DragDrop.DoDragDrop(lbl, lbl.Background, DragDropEffects.Copy);
}
private void lblTarget_Drop(object sender, DragEventArgs e)
{
SolidColorBrush scb1 = (SolidColorBrush)e.Data.GetData(typeof(SolidColorBrush));
((Label)sender).Content = e.Data.GetData(DataFormats.Text);
((Label)sender).Background = scb1;
}
}
}
Reply
Answers (
0
)
i want to multiply the textbox value
Take snapshot from built in webcam