Purpose: Silverlight application needs to add a combobox
Creating the Design Page For the Combobox Application.
2. Select the language C#, Silverlight Project.
3.Name it Combox.
5.Leave the Rest Settings as default.
6.Now open MainPage.xaml. modify the grid add the HorizontalAlignment="Left"
7. And now And now add the Textblock (Label) like this:
<TextBlock Height="17.09" Grid.Column="0" Grid.Row="0" Width="100.303" Canvas.Left="260" Canvas.Top="38.91" Text="Client Name" TextWrapping="Wrap"
Foreground="#FF000000" FontSize="16" Margin="12,0,8,5" />
8. In the next column of grid Add the Combobox. like:
<ComboBox x:Name="cmbClient" Grid.Column="1" Grid.Row="0" SelectionChanged="cmbClient_SelectionChanged"></ComboBox>
9. Not going into more Designing Issues. Lets Finish it here. And Start Our Coding.
10. Creating a button so that onclick of that button we can get the
Information of the Client
<Button x:Name="btn" Click="btn_Click" Content="Get Info" Grid.Column="0" Grid.Row="1"></Button>
Client Mobile number
Now open the MainPage.xaml.cs File And create the following Class
public static List<MyClients> clientlist = new List<MyClients>();
Now next step is to create a function which will add the MyClients to the List Here is the function.
Now we need to call this function in the MainPage so the code of MainPage will now look like
Now setting the above variable on the selectionchanged event:
private void cmbClient_SelectionChanged(object sender,SelectionChangedEventArgs e)
and Finally the code for the click event:
private void btn_Click(object sender, RoutedEventArgs e)
Now run and see the combox in active Code is attached
A very good article, its advisable for editor whenever you approve any article please reformat the same. As the Code section of above is appering as other simple lines
Thanks gaurav but i haven't finished my resource posting yet and the editor has approved it so there is some problem you may find
I re-edited the same and approved it.
Thanks a Lot Gaurav. For editing and approving as we don't have GUI editor neither have preview option so i have to post the code every time to see the output thanks a lot for being patient with me and helping me in giving final touch to the looks.
good one .
keep it up.
Thanks and Regards