Thursday, February 08, 2018

Universal Windows Platform: ListView and SelectionChanged event - Part 2

In my previous post (UWP: XAML's ListView Control and its SelectionChanged event - Part 1) you learnt the following:

Part 1
  • Progressively build a ListView Control 
  • Place ListViewItems inside a ListView's ItemTemplate
  • You will place three named ListView items
In this part you wil learn how to write code to change the properties you set for the ListViewItems by the SelectionChanged event.

The following image shows the app after a successful run. This displays how the app is displayed at this stage:

              
JListView_23

This next image shows the effect of the SelectionChanged event.


JListView_28

You could set the FontSize properties in design as shown.To start with all the ListViewItem's FontSize was 15px and FontFamily Segoe UI (defaults). Clicking the ListViewItem for 'Dog', you can change its size in the property box (now focus is on 'bird').


JListView_15

As shown in the next image, you insert 'SelectionChanged' inside the ListView. If you just type the letter S, you should get a selection list in which you will find 'SelectionChanged'.


JListView_17

Place the "=" sign after it and you should get the "New Event Handler" and when you click this you will create the ListView_SelectionChaged event.


JlistView_18

In the code behind (MainPage.xaml.cs), the new event is displayed as shown


JlistView_19

Part 2 is continued here.

No comments:

DMCA.com Protection Status