protected override void Arrange()
        {
            base.Arrange();

            Viewmodel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, Section);
            Handler = (CollectionElementViewModel) Viewmodel.DescendentElements(x => typeof(ExceptionHandlerData).IsAssignableFrom(x.ConfigurationType)).First();
            
        }
        public bool IsLast(CollectionElementViewModel element)
        {
            if (!ChildElements.Any())
            {
                return(false);
            }

            return(ChildElements.Last().ElementId == element.ElementId);
        }
        private void MoveElement(CollectionElementViewModel element, int moveDistance)
        {
            var list = thisElementCollection.OfType <ConfigurationElement>().ToArray();

            //move the element in the configuration collection.
            MoveConfigurationItem(list, element.ConfigurationElement, moveDistance);
            mergeableConfigurationCollection.ResetCollection(list);

            //move the element in the view.
            MoveConfigurationItem((ObservableCollection <ElementViewModel>)ChildElements, element, moveDistance);
        }
        protected override void Act()
        {
            firstHandler = ViewModel.DescendentElements(x => x.ConfigurationType == typeof(TestHandlerData)).OfType<CollectionElementViewModel>().Where(
                x => x.Name == "One").Single();

            firstHandler.Select();

            secondHandler = ViewModel.DescendentElements(x => x.ConfigurationType == typeof(TestHandlerData)).OfType<CollectionElementViewModel>().Where(
                x => x.Name == "Two").Single();

            secondHandler.MoveDown.Execute(null);
        }
        /// <summary>
        /// Deletes an element from the collection.
        /// </summary>
        /// <param name="element">The element to delete.</param>
        public void Delete(CollectionElementViewModel element)
        {
            //remove the element from configuration collection.
            var list =
                thisElementCollection.OfType <ConfigurationElement>().Where(x => x != element.ConfigurationElement).
                ToArray();

            mergeableConfigurationCollection.ResetCollection(list);

            //remove the element from the view.
            RemoveChildFromView(element);

            Validate();

            element.OnDeleted();
        }
 /// <summary>
 /// Moves a <see cref="CollectionElementViewModel"/> in this collection one position later in the <see cref="ElementViewModel.ChildElements"/> sequence.
 /// </summary>
 /// <param name="elementViewModel">The <see cref="CollectionElementViewModel"/> in this collection to move.</param>
 public void MoveDown(CollectionElementViewModel elementViewModel)
 {
     MoveElement(elementViewModel, 1);
 }
 /// <summary>
 /// Moves a <see cref="CollectionElementViewModel"/> in this collection one position earlier in the <see cref="ElementViewModel.ChildElements"/> sequence.
 /// </summary>
 /// <param name="elementViewModel">The <see cref="CollectionElementViewModel"/> in this collection to move.</param>
 public void MoveUp(CollectionElementViewModel elementViewModel)
 {
     MoveElement(elementViewModel, -1);
 }