Tuesday, May 7, 2013

C# to VB Converter Recommendation?

If you cannot suggest a converter perhaps you could please nudge me in the right direction.


Here is a sample of what I am trying to convert...


C#



[Category("Settings")]
public Uri SectionContent { get { return (Uri)GetValue(SectionContentProperty); } set { SetValue(SectionContentProperty, value); }}
public static readonly DependencyProperty SectionContentProperty = DependencyProperty.Register("SectionContent", typeof(Uri), typeof(MySection), new PropertyMetadata(null, new PropertyChangedCallback(onContentChanged)));


private static void onContentChanged(object sender, DependencyPropertyChangedEventArgs e)
{
MySection ms = sender as MySection;
ms.setFrameContent();
}

Which Converts to VB like so...



<Category("Settings")> _
Public Property SectionContent() As Uri
Get
Return DirectCast(GetValue(SectionContentProperty), Uri)
End Get
Set
SetValue(SectionContentProperty, value)
End Set
End Property
Public Shared ReadOnly SectionContentProperty As DependencyProperty = DependencyProperty.Register("SectionContent", GetType(Uri), GetType(MySection), New PropertyMetadata(Nothing, New PropertyChangedCallback(onContentChanged)))



Private Shared Sub onContentChanged(sender As Object, e As DependencyPropertyChangedEventArgs)
Dim ms As MySection = TryCast(sender, MySection)
ms.setFrameContent()
End Sub

And I receive the error...



Error 1 Delegate 'System.Windows.PropertyChangedCallback' requires an 'AddressOf' expression or lambda expression as the only argument to its constructor...

~Christine



No comments:

Post a Comment