Virtualizing Tree View 使用文档

树形结构使用插件Virtualizing Tree View Self Demo

前段时间公司要求开发了个本地视频播放器,使用Virtualizing Tree View插件编辑了视频目录,以下附部分核心代码

事件监听、数据绑定、目录展开、目录点击、双击、事件解除监听

        private void TreeViewAddEvent()
        {
            //数据绑定
            _tree.ItemDataBinding += DataBinding;
            //选中
            _tree.SelectionChanged += SelectionChanged;
            //展开
            _tree.ItemExpanding += Expanding;
            //双击
            VirtualizingItemContainer.DoubleClick += DoubleClick;

            _tree.Items = _treeNodes;
        }

        /// <summary>
        /// 双击
        /// </summary>
        /// <param name="_sender"></param>
        /// <param name="e"></param>
        public void DoubleClick(VirtualizingItemContainer _sender, PointerEventData e)
        {
            if (_sender.Item == null) return;

            if (_currentNode._type == Org.file)
            {

            }
        }

        /// <summary>
        /// 解除绑定
        /// </summary>
        private void TreeViewRemoveEvent()
        {
            _tree.ItemDataBinding -= DataBinding;
            _tree.SelectionChanged -= SelectionChanged;
            _tree.ItemExpanding -= Expanding;
            VirtualizingItemContainer.DoubleClick -= DoubleClick;
        }

        /// <summary>
        /// 展开和关闭
        /// </summary>
        /// <param name="_sender"></param>
        /// <param name="e"></param>
        private void Expanding(object _sender, VirtualizingItemExpandingArgs e)
        {
            var _data = e.Item as TreeView_Node;
            if (_data == null) return;
            e.Children = _data._children;
        }

        /// <summary>
        /// 选中
        /// </summary>
        /// <param name="_sender"></param>
        /// <param name="e"></param>
        public void SelectionChanged(object _sender, SelectionChangedArgs e)
        {
            if (e.NewItem == null) return;
            var _treeNode = e.NewItem as TreeView_Node;
            _currentNode = _treeNode;
            if (_currentNode._type == Org.file)
            {

            }
        }

        /// <summary>
        /// 绑定数据
        /// </summary>
        /// <param name="_sender"></param>
        /// <param name="e"></param>
        private void DataBinding(object _sender, VirtualizingTreeViewItemDataBindingArgs e)
        {
            var _treeNode = e.Item as TreeView_Node;

            if (_treeNode == null) return;
            e.HasChildren = _treeNode._children.Count > 0;
            var _item = e.ItemPresenter.GetComponent<TreeView_UIItem>();
            _item._tetx.text = _treeNode._name;

            if (_treeNode._type == Org.file)
            {
                _item._icon.gameObject.SetActive(false);
            }
            else if (_treeNode._type == Org.folder)
            {
                _item._icon.sprite = _item.icon_file;
                _item._icon.gameObject.SetActive(true);
            }
        }

插件具体使用Demo下载链接:VirtualizingTreeViewSelfDemo-互联网文档类资源-CSDN下载

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
V5.3.0: (04 Jan 2014) - Fix for issue #159 (Cursor missing in edit with non-standard DPI): Ensuring a minimum size of the edit control - Fixed issue #403: Declare TVTGetNodeProc as reference to procedure (for D2009+) - Fixed issue #402: TVTEdit.CNCommand discard all notification except EN_UPDATE due to missing inherited - Corrected fix for issue #376 (Incorrect selection paint when toGridExtensions is included in the MiscOptions) - Fixed issue #401: OnNodeClick event doesn't trigger in some case, coFixed set for a column - Modified #316 (concerning r498). The fix for #316 will only be applied in case toMultiSelect is set. If toMultiSelect is not set we can start a drag anywhere in the row. - ContentToHTML() and ContentToRTF() now return a string of type RawByteString. Because the generated strings are pre-encoded in UTF-8, the previous type AnsiString caused problems in Delphi 2009+ e.g. when this string was written using the VCL TStreamWriter class. The helper class TBufferedAnsiString therefore uses RywByteString now as type too. - Fixed issue #399: EditDelay not working - Fixed issue #400: AltGr+A does not behave as expected for foreign keyboard layouts in VTEdit - Fixed issue #388: VirtualStringTree with toFixedIndent causes range check error - Edit box when editing a node in a tree with toFixedIndent now has the correct indent - Fixed issue #392: Now ensuring that MeasureItemHeight() is only called from the main thread. - Fixed #383: Clear vsHasChildren for a node without children even if the children count didn't change. - Fixed #377: Wrong font (size, etc) in TargetCanvas in MeasureItem for first node - Fixed issue #398 (hoAutoResize causes DFM designer to be modified after loading) by calling TControl.Updating()/Updated() in AdjustAutoSize() - Preventing possible AV in TBaseVirtualTree.FontChanged() - Fixed 32Bit Integer overflows in Win64 build in TBufferedAnsiString.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值