We take a Silverlight application and write the following XAML code in editor:
<Grid
x:Name="LayoutRoot"
Background="White">
<ListBox
Height="254"
HorizontalAlignment="Left"
Margin="10,10,0,0"
ItemsSource="{Binding
}"
Name="listBox1"
VerticalAlignment="Top"
Width="141"
Background="#FF867082"
FontSize="15"
Foreground="Black"
/>
<Button
Content="Click
"
Height="36"
HorizontalAlignment="Left"
Margin="157,12,0,0"
Name="Button1"
VerticalAlignment="Top"
Width="81"
/>
</Grid>
Then we write the following code on Button Click event on MainPage.xaml.vb
Partial
Public Class
MainPage
Inherits
UserControl
Public
Sub New()
InitializeComponent()
End
Sub
Private
Sub Button1_Click(sender
As System.Object,
e As System.Windows.RoutedEventArgs)
Handles Button1.Click
Dim
ss As String() =
{"A", "B",
"C", "D",
"E", "F",
"G", "H",
"I"}
Me.DataContext
= ss
End
Sub
End
Class
We run our application. The output will be as below

When we Click on button, ListBox will show all items as below.

Thank You.....

Join the conversation! Your thoughts help the community grow.