Before reading this article, please go through the article's link, given below.
FadeHeader behavior fades a ListView or GridView header UIElement, when the user scrolls. UIElement fades out to 0 opacity, when the edge of the header reaches the edge of the visible bounds of the ListElement.
After reading this article, you can learn how to fade a ListView header, when the user scrolls.
The important tools, which are required to develop UWP are given below.
- Windows 10 (Recommended)
- Visual Studio 2015 Community Edition (It is a free software available online)
Now, we can discuss step by step app development, which is given below.
Step 1
Open Visual Studio 2015 -> Start -> New Project-> Select Universal (under Visual C#->Windows)-> Blank app -> Give the suitable name for your app (UWPFadeHeader)->OK.

After choosing the target and minimum platform version for your Windows, Universal Application will support and the project creates App.xaml and MainPage.xaml.

Step 2
Open (double click) the file MainPage.xaml in Solution Explorer and add Microsoft.Toolkit.Uwp.UI.Animations reference in the project.
To add the reference, right click on your project (UWPFadeHeader) and select Manage NuGet Packages.

Choose browse and search Microsoft.Toolkit.Uwp.UI.Animations. Select the package and install it.

Accept the Licence

The reference is added to the project

Step 3
Add TextBlock control, change the name and text property for the title,

Step 4
Add ListView control, which is given below.

Step 5
Add the XAML namespaces, given below and code for Fading List view header in Mainpage.xaml.
- xmlns: interactivity = "using:Microsoft.Xaml.Interactivity"
- xmlns: behaviors = "using:Microsoft.Toolkit.Uwp.UI.Animations.Behaviors" < interactivity: Interaction.Behaviors > < behaviors: FadeHeaderBehavior / > < /interactivity:Interaction.Behaviors>

Step 6
Add the List view header with stackpanel, Grid and Textblock for Header information.
- <ListView.Header>
- <Grid x:Name="MyHeaderGrid" MinHeight="100" Background="Blue" Height="174">
- <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="20,0">
- <TextBlock Text="This Is The Header" TextAlignment="Center" FontWeight="Bold" Style="{ThemeResource TitleTextBlockStyle}" Foreground="White" Margin="0,5" />
- <TextBlock Text="Your Header will Fade while you scroll up." Style="{ThemeResource SubtitleTextBlockStyle}" Foreground="White" VerticalAlignment="Center" TextAlignment="Center" /> </StackPanel>
- </Grid>
- </ListView.Header>

Step 7
Add the List view items.
- <x:String>India</x:String>
- <x:String>Unites States</x:String>
- <x:String>Sri Lanka</x:String>
- <x:String>China</x:String>
- <x:String>Canada</x:String>
- <x:String>Russia</x:String>





Vignesh ManiPosted Oct 13, 2016, 10:41 AM
Good one