Ejemplo n.º 1
0
        private void InitializeExpander(EditableExpander editableExpander)
        {
            var accessManagerBinding = new Binding();

            accessManagerBinding.Source = this;
            accessManagerBinding.Path   = new PropertyPath(PropertyUtil.ExtractPropertyName(() => AccessControlManager));
            editableExpander.SetBinding(SecureControl.AccessControlManagerProperty, accessManagerBinding);

            if (SaveCommand != null)
            {
                var saveBinding = new Binding();
                saveBinding.Source = this;
                saveBinding.Path   = new PropertyPath(PropertyUtil.ExtractPropertyName(() => SaveCommand));
                editableExpander.SetBinding(EditableExpander.SaveCommandProperty, saveBinding);
            }

            if (CancelCommand != null)
            {
                var cancelBinding = new Binding();
                cancelBinding.Source = this;
                cancelBinding.Path   = new PropertyPath(PropertyUtil.ExtractPropertyName(() => CancelCommand));
                editableExpander.SetBinding(EditableExpander.CancelCommandProperty, cancelBinding);
            }

            if (Expanders.Count() > 1)
            {
                editableExpander.NextCommand = new DelegateCommand <EditableExpander> (ExecuteNextCommand);
            }
        }
Ejemplo n.º 2
0
        private void ExecuteNextCommand(EditableExpander editableExpander)
        {
            var index     = Expanders.IndexOf(editableExpander);
            var nextIndex = index + 1;

            if (nextIndex == Expanders.Count)
            {
                nextIndex = 0;
            }
            EditableExpander next;

            while ((next = Expanders[nextIndex]) != editableExpander)
            {
                if (next.CanAccess)
                {
                    next.SetAsNextCommand.Execute(null);
                    break;
                }
                nextIndex++;
                if (nextIndex == Expanders.Count)
                {
                    nextIndex = 0;
                }
            }
        }
Ejemplo n.º 3
0
 private void UpdateStartOpened()
 {
     if (StartOpen)
     {
         ExecuteExpandAllCommand();
         if (Expanders != null && Expanders.Count() > 0)
         {
             var expander = Expanders.ElementAt(0);
             expander.SetAsNextCommand.Execute(null);
         }
     }
     else
     {
         ExecuteCollapseAllCommand();
         if (Expanders != null && Expanders.Count() > 0)
         {
             var expander = Expanders.ElementAt(0);
             expander.IsExpanded = true;
         }
     }
 }