Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9061285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:26:42+00:00 2026-06-16T15:26:42+00:00

Recently I started building my own big Windows 8 Store App. Working on UI

  • 0

Recently I started building my own big Windows 8 Store App.
Working on UI I started replicating some good UIs.

One I met very interesting animation of inserting new elements in list view in standard Mail app. When you click on chain it expands and shows all messages in chain.

Here is captured video.

I have no idea what technique did they use to achieve this animation and behavior.

Can anyone help me, explain or give example how can I achieve such behavior? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:26:43+00:00Added an answer on June 16, 2026 at 3:26 pm

    The mail app is written in JavaScript, so it won’t help you much to know how it was done since this UI stack is quite different than the XAML one. The thing though is that the list controls are likely animated the same way, so you only need to add/remove some items in the list to get the expansion/collapse effect.

    I played with it for a bit and this is what I came up with that uses ListView’s ItemTemplateSelector property to define a few different item templates.

    enter image description here

    <Page
        x:Class="App82.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:App82"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
        <Page.Resources>
            <local:CollapsibleListItemTemplateSelector
                x:Key="collapsibleListItemTemplateSelector">
                <local:CollapsibleListItemTemplateSelector.BasicItemTemplate>
                    <DataTemplate>
                        <Border
                            Margin="5"
                            Height="50"
                            VerticalAlignment="Stretch"
                            BorderBrush="ForestGreen"
                            BorderThickness="2,0,0,0">
                            <StackPanel
                                Margin="10,0,0,0">
                                <TextBlock
                                    FontWeight="Bold"
                                    Text="{Binding Title}" />
                                <TextBlock
                                    Text="{Binding Gist}" />
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </local:CollapsibleListItemTemplateSelector.BasicItemTemplate>
                <local:CollapsibleListItemTemplateSelector.ExpandedItemTemplate>
                    <DataTemplate>
                        <Border
                            Margin="15,5,5,5"
                            Height="50"
                            VerticalAlignment="Stretch"
                            BorderBrush="Yellow"
                            BorderThickness="2,0,0,0">
                            <StackPanel
                                Margin="10,0,0,0">
                                <TextBlock
                                    FontWeight="Bold"
                                    Text="{Binding Title}" />
                                <TextBlock
                                    Text="{Binding Gist}" />
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </local:CollapsibleListItemTemplateSelector.ExpandedItemTemplate>
                <local:CollapsibleListItemTemplateSelector.CollapsibleItemTemplate>
                    <DataTemplate>
                        <Border
                            Margin="5"
                            Height="50"
                            VerticalAlignment="Stretch"
                            BorderBrush="DodgerBlue"
                            BorderThickness="2,0,0,0">
                            <StackPanel
                                Margin="10,0,0,0"
                                Orientation="Horizontal">
                                <TextBlock
                                    FontWeight="Bold"
                                    Text="{Binding ChildItems.Count}" />
                                <TextBlock
                                    FontWeight="Bold"
                                    Text="&#160;Items" />
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </local:CollapsibleListItemTemplateSelector.CollapsibleItemTemplate>
            </local:CollapsibleListItemTemplateSelector>
        </Page.Resources>
        <Grid
            Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
            <ListView
                x:Name="ListView"
                ItemTemplateSelector="{StaticResource collapsibleListItemTemplateSelector}"
                ItemClick="OnItemClick"
                IsItemClickEnabled="True" />
        </Grid>
    </Page>
    

    Code behind:

    using System.Collections;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using App82.Common;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    
    namespace App82
    {
        public sealed partial class MainPage : Page
        {
            public MainPage()
            {
                this.InitializeComponent();
    
                var items = new ObservableCollection<BindableBase>();
                var item1 = new BasicItem { Title = "Item 1", Gist = "This item has some content that is not fully shown..." };
                var item2 = new ExpandedItem { Title = "Item 2", Gist = "This item has some content that is not fully shown..." };
                var item3 = new ExpandedItem { Title = "Item 3", Gist = "This item has some content that is not fully shown..." };
                var item4 = new ExpandedItem { Title = "Item 4", Gist = "This item has some content that is not fully shown..." };
                var item5 = new BasicItem { Title = "Item 5", Gist = "This item has some content that is not fully shown..." };
    
                var itemGroup1 = new CollapsibleItem(items, new[] { item2, item3, item4 });
                items.Add(item1);
                items.Add(itemGroup1);
                items.Add(item5);
                this.ListView.ItemsSource = items;
            }
    
            private void OnItemClick(object sender, ItemClickEventArgs e)
            {
                var collapsibleItem = e.ClickedItem as CollapsibleItem;
                if (collapsibleItem != null)
                    collapsibleItem.ToggleCollapse();
            }
        }
    
        public class CollapsibleListItemTemplateSelector : DataTemplateSelector
        {
            public DataTemplate BasicItemTemplate { get; set; }
            public DataTemplate CollapsibleItemTemplate { get; set; }
            public DataTemplate ExpandedItemTemplate { get; set; }
    
            protected override Windows.UI.Xaml.DataTemplate SelectTemplateCore(object item, Windows.UI.Xaml.DependencyObject container)
            {
                if (item is ExpandedItem)
                    return ExpandedItemTemplate;
                if (item is BasicItem)
                    return BasicItemTemplate;
                //if (item is CollapsibleItem)
                    return CollapsibleItemTemplate;
            }
        }
    
        public class BasicItem : BindableBase
        {
            #region Title
            private string _title;
            public string Title
            {
                get { return _title; }
                set { this.SetProperty(ref _title, value); }
            }
            #endregion
    
            #region Gist
            private string _gist;
            public string Gist
            {
                get { return _gist; }
                set { this.SetProperty(ref _gist, value); }
            }
            #endregion
        }
    
        public class ExpandedItem : BasicItem
        {
    
        }
    
        public class CollapsibleItem : BindableBase
        {
            private readonly IList _hostCollection;
    
            #region IsExpanded
            private bool _isExpanded;
            public bool IsExpanded
            {
                get { return _isExpanded; }
                set
                {
                    if (this.SetProperty(ref _isExpanded, value))
                    {
                        if (_isExpanded)
                            Expand();
                        else
                            Collapse();
                    }
                }
            }
            #endregion
    
            #region ChildItems
            private ObservableCollection<BasicItem> _childItems;
            public ObservableCollection<BasicItem> ChildItems
            {
                get { return _childItems; }
                set { this.SetProperty(ref _childItems, value); }
            }
            #endregion
    
            public CollapsibleItem(
                IList hostCollection,
                IEnumerable<BasicItem> childItems)
            {
                _hostCollection = hostCollection;
                _childItems = new ObservableCollection<BasicItem>(childItems);
            }
    
            public void ToggleCollapse()
            {
                IsExpanded = !IsExpanded;
            }
    
            private void Expand()
            {
                int i = _hostCollection.IndexOf(this) + 1;
    
                foreach (var childItem in ChildItems)
                {
                    _hostCollection.Insert(i++, childItem);
                }
            }
    
            private void Collapse()
            {
                int i = _hostCollection.IndexOf(this) + 1;
    
                for (int index = 0; index < ChildItems.Count; index++)
                {
                    _hostCollection.RemoveAt(i);
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently started learning Objective-C, and I am working on an iOS app as
I'm very used to working in WPF, but I have recently started building websites
I have recently started messing about with JavaScript and building my own jQuery plugins
I have been doing some testing on a project that I recently started building
I recently started building a bookmarklet that displays the EXIF data of any image
I recently started looking into building web applications using .NET MVC and I stumbled
I have recently started programming in PHP. I am building a cart in PHP.
I recently started using rspec and factory_girl and I'm working on a basic control
I recently started working with a client that had an index.html file with this
We recently started using AnkhSVN subversion plugin for Visual Studio. Everything is working as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.