예제 #1
0
        /// <summary>
        /// 选中节点
        /// </summary>
        /// <param name="cascaderNode"></param>
        /// <param name="selectedType"></param>
        internal void SetSelectedNode(CascaderNode cascaderNode, SelectedTypeEnum selectedType)
        {
            if (cascaderNode == null)
            {
                return;
            }

            SelectedType = selectedType;
            if (selectedType == SelectedTypeEnum.Click)
            {
                _selectedNodes.Clear();
                SetSelectedNodeWithParent(cascaderNode, ref _selectedNodes);
                _renderNodes = _selectedNodes;

                if (ChangeOnSelect || !cascaderNode.HasChildren)
                {
                    SetValue(cascaderNode.Value);
                }
            }
            else
            {
                _hoverSelectedNodes.Clear();
                SetSelectedNodeWithParent(cascaderNode, ref _hoverSelectedNodes);
                _renderNodes = _hoverSelectedNodes;
            }
            _renderNodes.Sort((x, y) => x.Level.CompareTo(y.Level));  //Level 升序排序

            if (!cascaderNode.HasChildren)
            {
                ToggleState  = false;
                IsOnCascader = false;
            }
        }
예제 #2
0
 /// <summary>
 /// 输入框单击(显示/隐藏浮层)
 /// </summary>
 private void InputOnToggle()
 {
     SelectedType = SelectedTypeEnum.Click;
     _hoverSelectedNodes.Clear();
     ToggleState = !ToggleState;
 }