Reader Level:
Universal Windows Platform

Windows Store Application ListBox Control in Visual Studio 2012

By Ravi Saklani on Jun 07 2012
Here I am talking about the ListBox control in Visual Studio 2012 in Windows Store Applications. We are creating this ListBox control in a Windows Store Application.
    • Like
    • Love It
    • Awesome
    • Interesting
    • It's Okay
    • Thumbs Down
  • 8.1k
  • 0


Here I am talking about the ListBox control in Visual Studio 2012 in Metro Style Applications. We are creating this ListBox control in a Metro Style Application. We are going to implement a color ListBox control, which will be applied to ListBox items. The ListBox will look like this on the Main window. The Metro Style application works on Windows 8. There is a ListBox control which is a very useful control. This article shows how the ListBox control is created. When we run the code in XAML then the ListBox control will move. And there are two Buttons which work at run time. In the following we are providing the whole code of the XAML file.

Step 1 : First, you will create a new Metro Style Application. Let us see the description with images of how you will create it.

  •   Open Visual Studio 2012
  •   File -> New -> Project
  •   Choose Template -> Visual C# -> Metro Style Application
  •   Rename the application


Step 2 : In the Solution Explorer there are two files that we will primarily work with; the MainPage.xaml and MainPage.xaml.cs files.


Step 3 : The MainPage.xaml file is as in the following code. When we create the ListBox control its code in XAML will look like this:

<ListBox HorizontalAlignment="Left" Height="280" VerticalAlignment="Top"
="100" Margin="5,0,0,0">


<Page x:Class="App5.MainPage" IsTabStop="false"    
 xmlns:local="using:App5" xmlns:d=""
:Ignorable="d" Width="1365" Background="#FFE89898">
Page.BottomAppBar>    <Grid Background="#CCB26A6A"
="0,0,0,325" RenderTransformOrigin="0.565999984741211,0.763000011444092">
ListBox HorizontalAlignment="Left" Height="280" VerticalAlignment="Top"
="100" Margin="5,0,0,0">
<ListBoxItem Content="MCA"/>
ListBoxItem Content=""/>
ListBoxItem Content="BCA"/>
ListBoxItem Content="MBA"/>
ListBoxItem Content=""/>
ListBoxItem Content="MSC(cs)"/>
ListBoxItem Content="MSC(IT)"/>

The output for above code will look like this: