Exemple #1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.superTree = ((WPFSuperTreeView.SuperTreeView)(target));
                return;

            case 2:
                this.scrollViewer1 = ((System.Windows.Controls.ScrollViewer)(target));
                return;

            case 3:
                this.tree = ((System.Windows.Controls.TreeView)(target));

            #line 15 "..\..\SuperTreeView.xaml"
                this.tree.SelectedItemChanged += new System.Windows.RoutedPropertyChangedEventHandler <object>(this.InnerTreeSelectedItemChanged);

            #line default
            #line hidden

            #line 15 "..\..\SuperTreeView.xaml"
                this.tree.PreviewMouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.ClickToReName);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.tree = ((WPFSuperTreeView.SuperTreeView)(target));

            #line 13 "..\..\OutLineView.xaml"
                this.tree.SelectedItemChanged2 += new System.Windows.RoutedPropertyChangedEventHandler <object>(this.OnTreeViewSelectedItemChanged);

            #line default
            #line hidden

            #line 14 "..\..\OutLineView.xaml"
                this.tree.ContextMenuOpening += new System.Windows.Controls.ContextMenuEventHandler(this.treeView1_ContextMenuOpening);

            #line default
            #line hidden

            #line 15 "..\..\OutLineView.xaml"
                this.tree.PreviewMouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.treeView1_PreviewMouseRightButtonDown);

            #line default
            #line hidden

            #line 16 "..\..\OutLineView.xaml"
                this.tree.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.treeView1_PreviewKeyDown);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
 public void SetTree(SuperTreeView tree)
 {
     _tree = tree;
     //绑定显示数据
     dgNodes.ItemsSource = _tree.Nodes;
     //获取集合视图
     nodesCollectionView = CollectionViewSource.GetDefaultView(dgNodes.ItemsSource) as ListCollectionView;
     txtSearch.Focus();
     EFConnectionString = _tree.EFConnectionString;
 }
 public FindNodes(SuperTreeView tree)
 {
     InitializeComponent();
     _tree = tree;
     //绑定显示数据
     dgNodes.ItemsSource = _tree.Nodes;
     //获取集合视图
     nodesCollectionView = CollectionViewSource.GetDefaultView(dgNodes.ItemsSource) as ListCollectionView;
     txtSearch.Focus();
 }
        public TreeViewIconsItem(SuperTreeView tree, NodeDataObject dataObject)
        {
            belongToTreeView = tree;
            _dataObject      = dataObject;

            //以下处理UI控件
            headerContainer = new StackPanel();


            //  设置StackPanel中的内容水平排列
            headerContainer.Orientation = Orientation.Horizontal;
            //将Header设置为StackPanel
            Header = headerContainer;
            //设置正常状态下的显示控件
            _iconImageControl = new Image();
            _iconImageControl.VerticalAlignment = VerticalAlignment.Center;
            _iconImageControl.Margin            = new Thickness(0, 0, 4, 0);
            _iconImageControl.Source            = _icon;
            //  向StackPanel对象中添加一个图标对象
            headerContainer.Children.Add(_iconImageControl);

            //  创建用于添加文本信息的TextBlock对象
            textBlock                   = new TextBlock();
            textBlock.FontSize          = TreeNodeDefaultFontSize;
            textBlock.VerticalAlignment = VerticalAlignment.Center;
            //  向StackPanel对象中添加文本信息
            headerContainer.Children.Add(textBlock);

            //实例化文本框控件,准备用于编辑
            edtText          = new TextBox();
            edtText.FontSize = TreeNodeDefaultFontSize;
            edtText.MinWidth = 100;
            //对事件进行响应
            edtText.KeyDown   += edtText_KeyDown;
            edtText.LostFocus += edtText_LostFocus;
            //由于默认情况下WPF的TextBox的Cut存在BUG:即完成复制工作但却不删除选中的文字,因此不得不用自己的代码取代默认的命令响应代码
            CommandBinding bind = new CommandBinding();

            bind.Command     = ApplicationCommands.Cut;
            bind.Executed   += bind_Executed;
            bind.CanExecute += bind_CanExecute;
            edtText.CommandBindings.Add(bind);
            //使用当前时间作为本Item的ID
            id = TimerUtils.getHighPrecisionCurrentTime();
        }
 public VisitedNodesManager(SuperTreeView treeView)
 {
     _treeView = treeView;
 }
        public TreeViewIconsItem(SuperTreeView tree, NodeDataObject dataObject, string iconType)
        {
            belongToTreeView = tree;
            _dataObject      = dataObject;

            //以下处理UI控件
            headerContainer = new StackPanel();


            //  设置StackPanel中的内容水平排列
            headerContainer.Orientation = Orientation.Horizontal;
            //将Header设置为StackPanel
            Header = headerContainer;
            //设置正常状态下的显示控件
            _iconImageControl = new Image();
            _iconImageControl.VerticalAlignment = VerticalAlignment.Center;
            _iconImageControl.Margin            = new Thickness(0, 0, 4, 0);


            _iconImageControl.Source = _icon;
            //  向StackPanel对象中添加一个图标对象
            headerContainer.Children.Add(_iconImageControl);

            //  创建用于添加文本信息的TextBlock对象
            textBlock                   = new TextBlock();
            textBlock.FontSize          = TreeNodeDefaultFontSize;
            textBlock.VerticalAlignment = VerticalAlignment.Center;
            //  向StackPanel对象中添加文本信息
            headerContainer.Children.Add(textBlock);

            //实例化文本框控件,准备用于编辑
            edtText          = new TextBox();
            edtText.FontSize = TreeNodeDefaultFontSize;
            edtText.MinWidth = 100;
            //对事件进行响应
            edtText.KeyDown   += edtText_KeyDown;
            edtText.LostFocus += edtText_LostFocus;
            //由于默认情况下WPF的TextBox的Cut存在BUG:即完成复制工作但却不删除选中的文字,因此不得不用自己的代码取代默认的命令响应代码
            CommandBinding bind = new CommandBinding();

            bind.Command     = ApplicationCommands.Cut;
            bind.Executed   += bind_Executed;
            bind.CanExecute += bind_CanExecute;
            edtText.CommandBindings.Add(bind);
            //使用当前时间作为本Item的ID
            id = TimerUtils.getHighPrecisionCurrentTime();

            //给节点添加样式,直接在xaml文件中添加,貌似只能添加第一层的样式
            //TabItem样式绑定的几种方式
            //item.SetValue(TabItem.StyleProperty, Application.Current.Resources["TabItemStyle1"] );
            //item.Style = Resources["TabItemStyle1"] as Style;
            //item.Style = (Style)this.FindResource("TabItemStyle1.2");

            this.Style = (Style)this.FindResource("TreeViewItem1");


            IconType = iconType;
            if (IconType == "FileIcon")
            {
                Icon = ImageUtils.GetBitmapSourceFromImageFileName("pack://application:,,,/WPFSuperTreeView;component/Images/FileIcon.png", UriKind.Absolute);
            }
            else if (IconType == "LabelNode")
            {
                Icon = ImageUtils.GetBitmapSourceFromImageFileName("pack://application:,,,/WPFSuperTreeView;component/Images/LabelNode.png", UriKind.Absolute);
            }
            else
            {
                Icon = ImageUtils.GetBitmapSourceFromImageFileName("pack://application:,,,/WPFSuperTreeView;component/Images/InfoNode.png", UriKind.Absolute);
            }
        }
Exemple #8
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 10 "..\..\LabelWindow.xaml"
                ((MyInfoBase.LabelWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden
                return;

            case 2:
                this.btnAddRoot = ((System.Windows.Controls.Button)(target));

            #line 14 "..\..\LabelWindow.xaml"
                this.btnAddRoot.Click += new System.Windows.RoutedEventHandler(this.btnAddRoot_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.btnAddBrother = ((System.Windows.Controls.Button)(target));

            #line 15 "..\..\LabelWindow.xaml"
                this.btnAddBrother.Click += new System.Windows.RoutedEventHandler(this.btnAddSibling_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.btnAddSon = ((System.Windows.Controls.Button)(target));

            #line 16 "..\..\LabelWindow.xaml"
                this.btnAddSon.Click += new System.Windows.RoutedEventHandler(this.btnAddChild_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.btnOk = ((System.Windows.Controls.Button)(target));

            #line 17 "..\..\LabelWindow.xaml"
                this.btnOk.Click += new System.Windows.RoutedEventHandler(this.btnOk_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.btnCancel = ((System.Windows.Controls.Button)(target));

            #line 18 "..\..\LabelWindow.xaml"
                this.btnCancel.Click += new System.Windows.RoutedEventHandler(this.btnCancel_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.labeltree = ((WPFSuperTreeView.SuperTreeView)(target));

            #line 20 "..\..\LabelWindow.xaml"
                this.labeltree.SelectedItemChanged2 += new System.Windows.RoutedPropertyChangedEventHandler <object>(this.OnTreeViewSelectedItemChanged);

            #line default
            #line hidden

            #line 21 "..\..\LabelWindow.xaml"
                this.labeltree.PreviewMouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.treeView1_PreviewMouseRightButtonDown);

            #line default
            #line hidden

            #line 22 "..\..\LabelWindow.xaml"
                this.labeltree.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.treeView1_PreviewKeyDown);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }