Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Popup in VB (NOT C#)
2 replies. Latest Post by SieGoBoY on May 29, 2009.
(0)
Kermit75
Member
22 points
47 Posts
10-08-2008 2:08 PM |
Hello!
I would like to use a popup control in my SL VB project.
All example code I have found is for C# only. :(Example: http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.popup(VS.95).aspx
How do I write similar VB code?
Thanks a bunch! :D
ccoombs
Contributor
5168 points
758 Posts
10-08-2008 2:19 PM |
If you can write VB code, you should be able to AT LEAST translate from C#, if not write in both languages. There are only a few (very small) differences. The code sample in the link you provided can be translated as follows:
Private p As New Popup() Private Sub btnTest_Click() Handles btnTest.Click Dim border As New Border() border.BorderBrush = New SolidColorBrush(Colors.Black) border.BorderThickness = New Thickness(5.0) Dim panel1 As New StackPanel() panel1.Background = New SolidColorBrush(Colors.LightGray) Dim button1 As New Button() button1.Content = "Close" button1.Margin = New Thickness(5.0) AddHandler button1.Click, AddressOf button1_Click Dim textblock1 As New TextBlock() textblock1.Text = "The popup control" textblock1.Margin = New Thickness(5.0) panel1.Children.Add(textblock1) panel1.Children.Add(button1) border.Child = panel1 ' Set the Child property of Popup to the border ' which contains a stackpanel, textblock and button. p.Child = border ' Set where the popup will show up on the screen. p.VerticalOffset = 25 p.HorizontalOffset = 25 ' Open the popup. p.IsOpen = True End Sub Private Sub button1_Click() p.IsOpen = False End Sub
SieGoBoY
2 points
1 Posts
05-29-2009 7:43 AM |
Thanks man!
That saved my life, I am totally a beginner programmer and was struggling with this for ages! You rock.
cheers