Sharing structured data

XML Magazine

Subscribe to XML Magazine: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get XML Magazine: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

XML Authors: Jnan Dash, Jayaram Krishnaswamy, Jason Bloomberg, Chris Pollach, Peter Silva

Related Topics: XML Magazine

Blog Feed Post

Universal Windows Platform: ListView and SelectionChanged event - Part1

In my previous post you learnt about ListView and ListBox controls used in XAML.

In this post you will learn to:

Part 1
  • Progressively build a ListView Control 
  • Place ListViewItems inside a ListView's ItemTemplate
  • You will place three named ListView items

Part 2
  • You will write code to change the properties of items you placed.
At first, you launch Visual Studio 2017 Community and create a blank Universal Windows Platform project using C# and provide the name to the project (Project JListView).


Here you choose the target and min versions of Windows 10


Add a ListView as shown between the 'Grid' as shown using intellisense.


An empty ListView control is added to the XAML with some default border over the Desktop as shown.


Now we place an ItemTemplate of the ListView by choosing from a drop-down list.


Visual Studio is not happy as this template cannot be empty. We will add a DataTemplate inside the ItemTemplate, again using intellisense.


Choose to place a DataTemplate.


DataTemplate is placed and there is no red wiggly line for ItemTemplate like before. 


Now we place a Grid, layout element, again using intellisense.


You could choose the background property (not really needed, optional).


I just changed the width of ListView to half its previous size. Notice the UI change in Design view.


You add a border to the grid. Add a TextBlock to the Grid.


You now add ListView.Items by typing it just above the closing of 'ListView' as shown.


Add 3 ListViewItems as shown. Provide names for the ListViewItems. FontSize is optional. You immediately see the ListViewItems in the design as shown.


Now if you build, deploy and run it on the Local Machine (as described in my earlier posts), the App is displayed as shown. You can also see the borders of the ListView's TextBlock


You have successfully added three ListViewItems to the project.

Read the original blog entry...

More Stories By Jayaram Krishnaswamy

Jayaram Krishnaswamy is a technical writer, mostly writing articles that are related to the web and databases. He is the author of SQL Server Integration Services published by Packt Publishers in the UK. His book, 'Learn SQL Server Reporting Services 2008' was also published by Packt Publishers Inc, Birmingham. 3. "Microsoft SQL Azure Enterprise Application Development" (Dec 2010) was published by Packt Publishing Inc. 4. "Microsoft Visual Studio LightSwitch Business Application Development [Paperback] "(2011) was published by Packt Publishing Inc. 5. "Learning SQL Server Reporting Services 2012 [Paperback]" (June 2013) was Published by Packt Publishing Inc. Visit his blogs at: He writes articles on several topics to many sites.