I’m trying to convert the c # code of a sample code to vb.net but I could with the following line of code. it is an event, delegate. but I can not build a functional structure. someone could help me?
thanks
Ellipse node = new Ellipse();
node.Style = nodeStyle;
node.MouseEnter += delegate(object sender, MouseEventArgs e) {
if (selectedNode == null)
node.BeginStoryboard((Storyboard)FindResource("NodeFadeIn"));
};
node.MouseLeave += delegate(object sender, MouseEventArgs e) {
if (selectedNode == null)
node.BeginStoryboard((Storyboard)FindResource("NodeFadeOut"));
};
node.PreviewMouseDown += delegate(object sender, MouseButtonEventArgs e) {
e.Handled = true;
selectedNode = (Ellipse)sender;
};
You need to use the AddHandler keyword in VB.NET to subscribe event handlers. In VS2010, an anonymous method can be substituted with a lambda, like this:
In VS2008 and earlier you’ll need to write a little private method.