├── LICENSE
├── README.md
├── Samples
├── ComplexSample
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── ComplexSample.csproj
│ ├── DateStuff
│ │ ├── DateConverter.cs
│ │ └── DateValidationRule.cs
│ ├── DetailTemplateSelector.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Model
│ │ ├── DateNode.cs
│ │ ├── NodeBase.cs
│ │ ├── NumberNode.cs
│ │ ├── SimpleNode.cs
│ │ └── Vm.cs
│ ├── NumberStuff
│ │ ├── NumberConverter.cs
│ │ └── NumberValidationRule.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── RelayCommand.cs
│ ├── Resources
│ │ ├── DateNode.xaml
│ │ ├── NodeBase.xaml
│ │ ├── NumberNode.xaml
│ │ └── SimpleNode.xaml
│ └── TreeItemStyleSelector.cs
├── DragNDropSample
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── DragNDropSample.csproj
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Model
│ │ └── Node.cs
│ ├── PathsAndGradients.xaml
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── RelayCommand.cs
│ ├── ViewModel
│ │ └── MainViewModel.cs
│ └── app.config
├── EditColorsSample
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── ColorPicker.xaml
│ ├── ColorPicker.xaml.cs
│ ├── EditColorsSample.csproj
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Model
│ │ └── Node.cs
│ └── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
├── InvisibleItemsSample
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── InvisibleItemsSample.csproj
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Model
│ │ └── Node.cs
│ └── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
├── ScrollTestSample
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Model
│ │ └── Node.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ └── ScrollTestSample.csproj
├── SelectionBinding
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── BindingSample.csproj
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Model
│ │ └── Node.cs
│ └── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
├── SelectionBindingWithController
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── BindingWithControllerSample.csproj
│ ├── CommandMgr
│ │ ├── CommandBase.cs
│ │ ├── CommandController.cs
│ │ ├── Commands
│ │ │ ├── CommandGroupCmd.cs
│ │ │ ├── DeselectAllItemsCmd.cs
│ │ │ ├── DeselectItemCmd.cs
│ │ │ └── SelectItemCmd.cs
│ │ └── IReceiver.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Model
│ │ └── Node.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ └── ViewModel
│ │ └── MainViewModel.cs
├── SimpleEditSample
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Model
│ │ └── Node.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── SimpleEditSample.csproj
│ └── app.config
├── SimpleSample
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Model
│ │ └── Node.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── SimpleSample.csproj
│ └── app.config
└── VirtualizationSample
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Model
│ └── Node.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ ├── VirtualizationSample.csproj
│ └── app.config
├── TreeViewEx.Test
├── Properties
│ └── AssemblyInfo.cs
├── TreeViewEx.Test.csproj
├── UiTesting
│ ├── BindingTest.cs
│ ├── ExpandCollapseTests.cs
│ ├── Helper
│ │ ├── AutomationElementHelper.cs
│ │ ├── Keyboard.cs
│ │ ├── Mouse.cs
│ │ ├── NativeStructs.cs
│ │ └── TreeApplication.cs
│ ├── KeyboardReactionTest.cs
│ ├── Model
│ │ ├── BindingTree.cs
│ │ ├── Element.cs
│ │ ├── SimpleSampleTree.cs
│ │ └── Tree.cs
│ ├── MouseReactionTest.cs
│ └── SelectionTests.cs
└── UnitTesting
│ └── Controls
│ ├── SizesCacheTests.cs
│ └── VerticalAreaTests.cs
├── TreeViewEx.sln
└── TreeViewEx
├── Automation
└── Peers
│ ├── TreeViewExAutomationPeer.cs
│ └── TreeViewExItemAutomationPeer.cs
├── Controls
├── AutoScroller.cs
├── BoolToVisibilityConverterHidden.cs
├── BorderSelectionAdorner.cs
├── BorderSelectionLogic.cs
├── Constants.cs
├── DoubleToThicknessLeftConverter.cs
├── DoubleUtil.cs
├── DragNDrop
│ ├── CanInsertReturn.cs
│ ├── DragNDropController.cs
│ ├── DragParameters.cs
│ ├── DropParameters.cs
│ ├── InsertAdorner.cs
│ └── InsertContent.cs
├── EditTextBox.cs
├── FocusHelper.cs
├── IProvideStackingSize.cs
├── ISelectionStrategy.cs
├── InputEventRouter.cs
├── InputSubscriberBase.cs
├── IsEditingManager.cs
├── ItemWrapper.cs
├── MethodBinding.cs
├── PropertyChangedNotifier.cs
├── SelectionChangedCancelEventArgs.cs
├── SelectionMultiple.cs
├── SelectionMultiple.cs.bak
├── SelectionSingle.cs
├── SizesCache.cs
├── TreeViewElementFinder.cs
├── TreeViewEx.cs
├── TreeViewExItem.Brushes.cs
├── TreeViewExItem.cs
├── VerticalArea.cs
└── VirtualizingTreePanel.cs
├── Core
├── DummyConverter.cs
└── IEnumerableExtenstions.cs
├── Nuget
└── TreeViewEx.nuspec
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
└── Resources.resx
├── TreeViewEx.csproj
├── key.snk
├── themes
├── EditTextBox.xaml
├── Generic.xaml
├── SystemColors.xaml
├── TreeViewEx.xaml
└── TreeViewExItem.xaml
└── tools
└── NuGet.exe
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2012 Goroll
4 | Copyright (c) 2014 tainicom
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
23 |
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | TreeViewEx
2 | ==========
3 |
4 | A WPF Tree View.
5 |
6 | Fork of https://treeviewex.codeplex.com/
7 |
8 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/App.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace ComplexSample
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/DateStuff/DateConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Data;
6 |
7 | namespace TreeViewEx.ComplexSample.DateStuff
8 | {
9 | class DateConverter : IValueConverter
10 | {
11 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
12 | {
13 | return ((DateTime)value).ToShortDateString();
14 | }
15 |
16 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
17 | {
18 | return DateTime.Parse(value.ToString());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/DateStuff/DateValidationRule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Controls;
6 |
7 | namespace TreeViewEx.ComplexSample.DateStuff
8 | {
9 | class DateValidation : ValidationRule
10 | {
11 | public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
12 | {
13 | DateTime dt;
14 | if (DateTime.TryParse(value.ToString(), out dt)) return new ValidationResult(true, null);
15 | return new ValidationResult(false, "Invalid Date");
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/DetailTemplateSelector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Controls;
6 | using TreeViewEx.ComplexSample.Model;
7 | using System.Windows;
8 |
9 | namespace TreeViewEx.ComplexSample
10 | {
11 | class DetailTemplateSelector : DataTemplateSelector
12 | {
13 | public override DataTemplate SelectTemplate(object item, DependencyObject container)
14 | {
15 | FrameworkElement element = container as FrameworkElement;
16 | if (item != null && item is NodeBase)
17 | {
18 | return element.FindResource("detailTemplate") as DataTemplate;
19 | }
20 |
21 | return element.FindResource("noNodeTemplate") as DataTemplate;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
17 |
18 |
21 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
39 |
40 |
41 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace TreeViewEx.ComplexSample
2 | {
3 | #region
4 |
5 | using ComplexSample.Model;
6 |
7 | #endregion
8 |
9 | ///
10 | /// Interaction logic for MainWindow.xaml
11 | ///
12 | public partial class MainWindow
13 | {
14 | #region Constructors and Destructors
15 |
16 | public MainWindow()
17 | {
18 |
19 | DataContext = new Vm();
20 |
21 | InitializeComponent();
22 | }
23 |
24 | #endregion
25 |
26 | private void TreeViewEx_OnSelecting(object sender, System.Windows.Controls.SelectionChangedCancelEventArgs e)
27 | {
28 | foreach (NodeBase item in e.ItemsToSelect)
29 | {
30 | if (item.Name.ToLower().Contains("not selectable"))
31 | {
32 | e.Cancel = true;
33 | MessageLabel.Content = "Cannot select item " + item;
34 | break;
35 | }
36 | }
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/Samples/ComplexSample/Model/DateNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace TreeViewEx.ComplexSample.Model
7 | {
8 | class DateNode:NodeBase
9 | {
10 | public DateTime Date { get; set; }
11 |
12 | public override string ToString()
13 | {
14 | return "DateNode: " + Date.ToShortDateString();
15 | }
16 |
17 | public override string Tip
18 | {
19 | get { return "You can press F2 to edit the date."; }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/Model/NodeBase.cs:
--------------------------------------------------------------------------------
1 | namespace TreeViewEx.ComplexSample.Model
2 | {
3 | #region
4 |
5 | using System.Collections.ObjectModel;
6 |
7 | #endregion
8 |
9 | ///
10 | /// Model for testing
11 | ///
12 | public abstract class NodeBase
13 | {
14 | #region Constructors and Destructors
15 |
16 | public NodeBase()
17 | {
18 | Children = new ObservableCollection();
19 | IsVisible = true;
20 | IsEditable = true;
21 | }
22 |
23 | #endregion
24 |
25 | #region Public Properties
26 |
27 | public string Name { get { return ToString(); } }
28 |
29 | public bool IsSelected { get; set; }
30 |
31 | public bool IsVisible { get; set; }
32 |
33 | public bool IsEditable { get; set; }
34 |
35 | public bool IsExpanded { get; set; }
36 |
37 | public ObservableCollection Children { get; set; }
38 |
39 | public abstract string Tip { get; }
40 | #endregion
41 |
42 | #region Public Methods
43 |
44 | public override abstract string ToString();
45 |
46 | #endregion
47 | }
48 | }
--------------------------------------------------------------------------------
/Samples/ComplexSample/Model/NumberNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Input;
6 | using System.ComponentModel;
7 |
8 | namespace TreeViewEx.ComplexSample.Model
9 | {
10 | class NumberNode:NodeBase, INotifyPropertyChanged
11 | {
12 | public int Number { get; set; }
13 |
14 | public ICommand CountUp { get { return new RelayCommand(CountUpAction); } }
15 |
16 | public ICommand CountDown { get { return new RelayCommand(CountDownAction); } }
17 |
18 | public override string Tip
19 | {
20 | get { return "You can press F2 to edit the number or right click to open the context menu."; }
21 | }
22 |
23 | private void CountDownAction()
24 | {
25 | Number--;
26 | RaisePropertyChanged("Number");
27 | }
28 |
29 | private void CountUpAction()
30 | {
31 | Number++;
32 | RaisePropertyChanged("Number");
33 | }
34 |
35 | public override string ToString()
36 | {
37 | return "NumberNode: " + Number;
38 | }
39 |
40 | private void RaisePropertyChanged(string prop)
41 | {
42 | if (PropertyChanged != null)
43 | {
44 | PropertyChanged(this, new PropertyChangedEventArgs(prop));
45 | }
46 | }
47 |
48 | #region INotifyPropertyChanged Members
49 |
50 | public event PropertyChangedEventHandler PropertyChanged;
51 |
52 | #endregion
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/Model/SimpleNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace TreeViewEx.ComplexSample.Model
7 | {
8 | class SimpleNode : NodeBase
9 | {
10 | private string name;
11 | public SimpleNode(string name)
12 | {
13 | this.name = name;
14 | }
15 |
16 |
17 | public override string ToString()
18 | {
19 | return "SimpleNode: " + name;
20 | }
21 |
22 | public override string Tip
23 | {
24 | get { return string.Empty; }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/Model/Vm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Input;
6 |
7 | namespace TreeViewEx.ComplexSample.Model
8 | {
9 | class Vm
10 | {
11 | public Vm()
12 | {
13 | var first1 = new SimpleNode ("element1");
14 | var first2 = new SimpleNode ("element2");
15 | var first11 = new DateNode { Date = DateTime.Now };
16 | var first12 = new NumberNode { Number = 728 };
17 | var first13 = new SimpleNode ("element13");
18 | var first14 = new SimpleNode ("element14");
19 | var first15 = new SimpleNode ("element15 (Not selectable)");
20 | var first131 = new SimpleNode ("element131");
21 | var first132 = new SimpleNode ("element132");
22 |
23 | // add to tree
24 | NodeTree = new List();
25 | NodeTree.Add(first1);
26 | NodeTree.Add(first2);
27 | first1.Children.Add(first11);
28 | first1.Children.Add(first12);
29 | first1.Children.Add(first13);
30 | first1.Children.Add(first14);
31 | first1.Children.Add(first15);
32 | first13.Children.Add(first131);
33 | first13.Children.Add(first132);
34 |
35 | // add to list
36 | NodeList = new List();
37 | NodeList.Add(first1);
38 | NodeList.Add(first11);
39 | NodeList.Add(first12);
40 | NodeList.Add(first13);
41 | NodeList.Add(first131);
42 | NodeList.Add(first132);
43 | NodeList.Add(first14);
44 | NodeList.Add(first15);
45 | NodeList.Add(first2);
46 | }
47 |
48 | public List NodeTree { get; set; }
49 | public List NodeList { get; set; }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/NumberStuff/NumberConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Data;
6 |
7 | namespace TreeViewEx.ComplexSample.NumberStuff
8 | {
9 | class NumberConverter : IValueConverter
10 | {
11 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
12 | {
13 | return ((int)value).ToString();
14 | }
15 |
16 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
17 | {
18 | return int.Parse(value.ToString());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/NumberStuff/NumberValidationRule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Controls;
6 |
7 | namespace TreeViewEx.ComplexSample.NumberStuff
8 | {
9 | class NumberValidation : ValidationRule
10 | {
11 | public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
12 | {
13 | int i;
14 | if (int.TryParse(value.ToString(), out i)) return new ValidationResult(true, null);
15 | return new ValidationResult(false, "Invalid Number");
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("ComplexSample")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Microsoft")]
14 | [assembly: AssemblyProduct("ComplexSample")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.17626
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TreeViewEx.ComplexSample.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TreeViewEx.ComplexSample.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.17626
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TreeViewEx.ComplexSample.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/RelayCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Input;
6 |
7 | namespace TreeViewEx.ComplexSample
8 | {
9 | class RelayCommand : ICommand
10 | {
11 | Action action;
12 |
13 | public RelayCommand(Action action)
14 | {
15 | this.action = action;
16 | }
17 |
18 | #region ICommand Members
19 |
20 | public bool CanExecute(object parameter)
21 | {
22 | return true;
23 | }
24 |
25 | public event EventHandler CanExecuteChanged;
26 |
27 | public void Execute(object parameter)
28 | {
29 | action();
30 | }
31 |
32 | #endregion
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/Resources/DateNode.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/Resources/NodeBase.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/Resources/NumberNode.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/Resources/SimpleNode.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Samples/ComplexSample/TreeItemStyleSelector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Controls;
6 | using System.Windows;
7 | using TreeViewEx.ComplexSample.Model;
8 |
9 | namespace TreeViewEx.ComplexSample
10 | {
11 | class TreeItemStyleSelector : StyleSelector
12 | {
13 | public override Style SelectStyle(object item, DependencyObject container)
14 | {
15 | FrameworkElement element = container as FrameworkElement;
16 | if (item != null)
17 | {
18 | if (item is SimpleNode)
19 | {
20 | return element.FindResource("simpleNodeStyle") as Style;
21 | }
22 |
23 | if (item is DateNode)
24 | {
25 | return element.FindResource("dateNodeStyle") as Style;
26 | }
27 |
28 | if (item is NumberNode)
29 | {
30 | return element.FindResource("numberNodeStyle") as Style;
31 | }
32 | }
33 |
34 | return base.SelectStyle(item, container);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Samples/DragNDropSample/App.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/DragNDropSample/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace DragNDropSample
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Samples/DragNDropSample/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Samples/DragNDropSample/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace DragNDropSample
2 | {
3 | #region
4 |
5 | using System;
6 | using System.Windows;
7 | using System.Windows.Input;
8 | using DragNDropSample.Model;
9 | using DragNDropSample.ViewModel;
10 |
11 | #endregion
12 |
13 | ///
14 | /// Interaction logic for MainWindow.xaml
15 | ///
16 | public partial class MainWindow : Window
17 | {
18 | MainViewModel viewModel;
19 |
20 | private Point dragStartPoint;
21 |
22 | #region Constructors and Destructors
23 |
24 | public MainWindow()
25 | {
26 | InitializeComponent();
27 |
28 | viewModel = new MainViewModel();
29 | DataContext = viewModel;
30 | }
31 |
32 | private void OnMouseDown(object sender, MouseButtonEventArgs e)
33 | {
34 | dragStartPoint = e.GetPosition(null);
35 | }
36 |
37 | private void OnMouseMove(object sender, MouseEventArgs e)
38 | {
39 | Point mousePos = e.GetPosition(null);
40 | Vector diff = dragStartPoint - mousePos;
41 |
42 | if (e.LeftButton == MouseButtonState.Pressed
43 | && (Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance || Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance))
44 | {
45 | var frameworkElem = ((FrameworkElement)e.OriginalSource);
46 | DragDrop.DoDragDrop(frameworkElem, new DataObject("NewNode", frameworkElem.DataContext), DragDropEffects.Move);
47 | }
48 | }
49 | #endregion
50 | }
51 | }
--------------------------------------------------------------------------------
/Samples/DragNDropSample/Model/Node.cs:
--------------------------------------------------------------------------------
1 | namespace DragNDropSample.Model
2 | {
3 | #region
4 |
5 | using System.Collections.ObjectModel;
6 | using System.Windows.Controls;
7 | using System.Windows.Input;
8 | using tainicom.TreeViewEx.DragNDrop;
9 | using System.Linq;
10 | #endregion
11 |
12 | ///
13 | /// Model for testing
14 | ///
15 | public class Node
16 | {
17 | #region Constructors and Destructors
18 |
19 | public Node()
20 | {
21 | Children = new ObservableCollection();
22 | }
23 |
24 | #endregion
25 |
26 | #region Public Properties
27 |
28 | public ObservableCollection Children { get; set; }
29 |
30 | public string Name { get; set; }
31 | #endregion
32 |
33 | #region Public Methods
34 |
35 | public override string ToString()
36 | {
37 | return Name;
38 | }
39 |
40 | #endregion
41 |
42 |
43 | public bool AllowDrag { get; set; }
44 |
45 | public bool AllowDrop { get; set; }
46 |
47 | public bool AllowInsert { get; set; }
48 |
49 | }
50 | }
--------------------------------------------------------------------------------
/Samples/DragNDropSample/PathsAndGradients.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Samples/DragNDropSample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("W7StyleSample")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Microsoft")]
14 | [assembly: AssemblyProduct("W7StyleSample")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Samples/DragNDropSample/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18213
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DragNDropSample.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DragNDropSample.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Samples/DragNDropSample/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18213
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DragNDropSample.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Samples/DragNDropSample/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/DragNDropSample/RelayCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows.Input;
7 |
8 | namespace DragNDropSample
9 | {
10 | public class RelayCommand : ICommand
11 | {
12 | #region Fields
13 |
14 | readonly Action