Exemple #1
0
        /// <summary>
        /// Called when the place's people collection changes. Updated by PlacesList.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void People_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                foreach (Person person in e.NewItems)
                {
                    AddPersonAvatar(person);
                }
            }
            else if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                foreach (Person person in e.OldItems)
                {
                    AvatarControl control = null;
                    foreach (var ctrl in this.AvatarStack.Children)
                    {
                        if ((ctrl as AvatarControl).Person == person)
                        {
                            control = ctrl as AvatarControl;
                            break;
                        }
                    }

                    if (control != null)
                    {
                        this.AvatarStack.Children.Remove(control);
                    }
                }
            }
        }
Exemple #2
0
        private void AddPersonAvatar(Person person)
        {
            var avatar = new AvatarControl();

            avatar.Person = person;
            avatar.Height = 80;
            avatar.Width  = 80;
            avatar.Margin = new Thickness(0, 0, 24, 0);

            this.AvatarStack.Children.Add(avatar);
        }