Hi!
I have watch you video (very good) but I'm trying to add an MouseLeftButtonDown, MouseLeftButtonUp and MouseMove event handlers to a dynamcally created button iin order to enable drag and drop.
I write:
void addButton_Click(object sender, RoutedEventArgs e)
{
Button b = new Button();
b.Content = "TEST";
b.Width = 100;
b.Height = 20;
b.MouseLeftButtonDown += new MouseButtonEventHandler(Page_MouseLeftButtonDown);
b.MouseLeftButtonUp += new MouseButtonEventHandler(Page_MouseLeftButtonUp);
b.MouseMove += new MouseEventHandler(Page_MouseMove);
LayoutRoot.Children.Add(b);
}
The event handlers works fine for a button i declare in xaml. The difference is that the button declared in xaml has a x:name and the code behind has not (can't be done)
Any ideas!
Regards Erik