开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜