Esempio n. 1
0
        public void NavigatorPathChanged(
            DependencyPropertyChangedEventArgs e)
        {
            NavigatorNodeCommandArgument argument =
                new NavigatorNodeCommandArgument(
                    _currentIndex,
                    (string)e.NewValue,
                    _commandType);

            int index = 0,
                size  = ItemListArray.Count();
            List <NavigatorNode> nodes = new List <NavigatorNode>();

            foreach (string value in argument.Path.Split('\\').Where(value => !string.IsNullOrWhiteSpace(value)))
            {
                NavigatorNodeCommand command = new NavigatorNodeCommand();
                command.Command += (sender, args) =>
                {
                    _currentIndex = args.Index;

                    _commandType = args.CommandType;
                    switch (_commandType)
                    {
                    case NavigatorNodeCommandType.Reduce:
                        string newPath = Path.Substring(0, Path.IndexOf(args.Path, StringComparison.Ordinal) + args.Path.Length);
                        Path = newPath;
                        break;

                    case NavigatorNodeCommandType.ShowList:
                        double positionX = args.PointerPositionX;
                        if (_popupList != null && ItemListArray[_currentIndex].Count > 0)
                        {
                            _listBoxDropDown.ItemsSource = ItemListArray[_currentIndex];
                            _popupList.Margin            = new Thickness(positionX - _popupList.Width, ActualHeight, 0, -342.0);
                            _popupList.IsOpen            = true;
                            _droppedButton = args.Button;
                            _droppedButton.BeginShowAnimation();
                        }
                        break;
                    }
                };
                if (index < size)
                {
                    nodes.Add(new NavigatorNode(index, value, command, Background, index == size - 1, ItemListArray[index]));
                }
                index++;
            }

            _path       = nodes;
            ItemsSource = _path;
            if (NPathChanged != null)
            {
                NPathChanged(this, argument);
            }
        }
Esempio n. 2
0
        public void NavigatorPathChanged(
            DependencyPropertyChangedEventArgs e)
        {
            NavigatorNodeCommandArgument argument =
                new NavigatorNodeCommandArgument(
                    _currentIndex,
                    (string)e.NewValue,
                    _commandType);

            int index = 0,
                size = ItemListArray.Count();
            List<NavigatorNode> nodes = new List<NavigatorNode>();
            foreach (string value in argument.Path.Split('\\').Where(value => !string.IsNullOrWhiteSpace(value)))
            {
                NavigatorNodeCommand command = new NavigatorNodeCommand();
                command.Command += (sender, args) =>
                {
                    _currentIndex = args.Index;

                    _commandType = args.CommandType;
                    switch (_commandType)
                    {
                        case NavigatorNodeCommandType.Reduce:
                            string newPath = Path.Substring(0, Path.IndexOf(args.Path, StringComparison.Ordinal) + args.Path.Length);
                            Path = newPath;
                            break;
                        case NavigatorNodeCommandType.ShowList:
                            double positionX = args.PointerPositionX;
                            if (_popupList != null && ItemListArray[_currentIndex].Count > 0)
                            {
                                _listBoxDropDown.ItemsSource = ItemListArray[_currentIndex];
                                _popupList.Margin = new Thickness(positionX - _popupList.Width, ActualHeight, 0, -342.0);
                                _popupList.IsOpen = true;
                                _droppedButton = args.Button;
                                _droppedButton.BeginShowAnimation();
                            }
                            break;
                    }

                };
                if (index < size)
                    nodes.Add(new NavigatorNode(index, value, command, Background, index == size - 1, ItemListArray[index]));
                index++;
            }

            _path = nodes;
            ItemsSource = _path;
            if (NPathChanged != null)
                NPathChanged(this, argument);
        }