WPF DataContext syntax - Convert from C# to VB
Currently working through a Teach Yourself WPF tutorial. Usually I can mentally convert from C# to VB without any problem but this C# syntax is unfamiliar. How is it written in VB?
Private void Button_Click(object sender, RoutedEventArgs e)
{
((Person)DataContext).FirstName = "blah blah"
}
My usual fave online converters are choking on this ... perha开发者_如何转开发ps because they don't do WPF?
try this
Private Sub Button_Click(ByVal sender As System.Object, ByVal e as RoutedEventArgs) Handles Button.Click
DirectCast(DataContext, Person).FirstName = "blah blah"
End Sub
精彩评论