├── 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 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 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 | 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 execute; 15 | readonly Predicate canExecute; 16 | 17 | #endregion // Fields 18 | 19 | #region Constructors 20 | 21 | public RelayCommand(Action execute) 22 | : this(execute, null) 23 | { 24 | } 25 | 26 | public RelayCommand(Action execute, Predicate canExecute) 27 | { 28 | if (execute == null) 29 | throw new ArgumentNullException("execute"); 30 | 31 | this.execute = execute; 32 | this.canExecute = canExecute; 33 | } 34 | #endregion // Constructors 35 | 36 | #region ICommand Members 37 | 38 | [DebuggerStepThrough] 39 | public bool CanExecute(object parameter) 40 | { 41 | return canExecute == null ? true : canExecute(parameter); 42 | } 43 | 44 | public event EventHandler CanExecuteChanged 45 | { 46 | add { CommandManager.RequerySuggested += value; } 47 | remove { CommandManager.RequerySuggested -= value; } 48 | } 49 | 50 | public void Execute(object parameter) 51 | { 52 | execute(parameter); 53 | } 54 | 55 | #endregion // ICommand Members 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Samples/DragNDropSample/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Samples/EditColorsSample/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Samples/EditColorsSample/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 EditSample 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples/EditColorsSample/ColorPicker.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Samples/EditColorsSample/ColorPicker.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace TreeViewEx.SimpleSample 16 | { 17 | /// 18 | /// Interaction logic for ColorPicker.xaml 19 | /// 20 | public partial class ColorPicker : UserControl 21 | { 22 | public ColorPicker() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | 28 | 29 | public bool Editing 30 | { 31 | get { return (bool)GetValue(EditingProperty); } 32 | set { SetValue(EditingProperty, value); } 33 | } 34 | 35 | // Using a DependencyProperty as the backing store for Editing. This enables animation, styling, binding, etc... 36 | public static readonly DependencyProperty EditingProperty = 37 | DependencyProperty.Register("Editing", typeof(bool), typeof(ColorPicker), new UIPropertyMetadata(false)); 38 | 39 | public Brush SelectedColor 40 | { 41 | get { return (Brush)GetValue(SelectedColorProperty); } 42 | set { SetValue(SelectedColorProperty, value); } 43 | } 44 | 45 | // Using a DependencyProperty as the backing store for SelectedColor. This enables animation, styling, binding, etc... 46 | public static readonly DependencyProperty SelectedColorProperty = 47 | DependencyProperty.Register("SelectedColor", typeof(Brush), typeof(ColorPicker), new UIPropertyMetadata(null)); 48 | 49 | 50 | 51 | public List Colors 52 | { 53 | get { return (List)GetValue(ColorsProperty); } 54 | set { SetValue(ColorsProperty, value); } 55 | } 56 | 57 | // Using a DependencyProperty as the backing store for Colors. This enables animation, styling, binding, etc... 58 | public static readonly DependencyProperty ColorsProperty = 59 | DependencyProperty.Register("Colors", typeof(List), typeof(ColorPicker), new UIPropertyMetadata(new List())); 60 | 61 | private void Border_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) 62 | { 63 | FrameworkElement fe = (FrameworkElement)sender; 64 | SelectedColor = (Brush)fe.DataContext; 65 | } 66 | 67 | private void Button_Click(object sender, RoutedEventArgs e) 68 | { 69 | Editing = false; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Samples/EditColorsSample/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Samples/EditColorsSample/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace EditSample 2 | { 3 | #region 4 | 5 | using EditSample.Model; 6 | using System.Windows.Media; 7 | using System.Collections.Generic; 8 | 9 | #endregion 10 | 11 | /// 12 | /// Interaction logic for MainWindow.xaml 13 | /// 14 | public partial class MainWindow 15 | { 16 | #region Constructors and Destructors 17 | 18 | public MainWindow() 19 | { 20 | List blueColors = new List { Brushes.AliceBlue, Brushes.BlueViolet, Brushes.Blue, Brushes.CornflowerBlue }; 21 | List greenColors = new List { Brushes.GreenYellow, Brushes.Green, Brushes.LawnGreen, Brushes.LightGreen }; 22 | 23 | var firstNode = new Node { Name = "element" }; 24 | var first1 = new Node { Name = "Blue Colors", Editable = false, Color = Brushes.LightBlue }; 25 | var first11 = new Node { Name = "Press F2 to select blue color", Color = Brushes.AliceBlue, Colors = blueColors }; 26 | var first12 = new Node { Name = "Press F2 to select blue color", Color = Brushes.BlueViolet, Colors = blueColors }; 27 | var first13 = new Node { Name = "Press F2 to select blue color", Color = Brushes.Blue, Colors = blueColors }; 28 | var first14 = new Node { Name = "Press F2 to select blue color", Color = Brushes.CadetBlue, Colors = blueColors }; 29 | var first15 = new Node { Name = "Press F2 to select blue color", Color = Brushes.CornflowerBlue, Colors = blueColors }; 30 | 31 | var first2 = new Node { Name = "Green Colors", Editable = false, Color = Brushes.LightGreen }; 32 | var first21 = new Node { Name = "Press F2 to select green color", Color = Brushes.GreenYellow, Colors = greenColors }; 33 | var first22 = new Node { Name = "Press F2 to select green color", Color = Brushes.Green, Colors = greenColors }; 34 | 35 | firstNode.Children.Add(first1); 36 | firstNode.Children.Add(first2); 37 | first1.Children.Add(first11); 38 | first1.Children.Add(first12); 39 | first1.Children.Add(first13); 40 | first1.Children.Add(first14); 41 | first1.Children.Add(first15); 42 | first2.Children.Add(first21); 43 | first2.Children.Add(first22); 44 | 45 | DataContext = firstNode; 46 | 47 | InitializeComponent(); 48 | } 49 | 50 | #endregion 51 | } 52 | } -------------------------------------------------------------------------------- /Samples/EditColorsSample/Model/Node.cs: -------------------------------------------------------------------------------- 1 | namespace EditSample.Model 2 | { 3 | #region 4 | 5 | using System.Collections.ObjectModel; 6 | using System.Windows.Media; 7 | using System.Collections.Generic; 8 | 9 | #endregion 10 | 11 | /// 12 | /// Model for testing 13 | /// 14 | public class Node 15 | { 16 | #region Constructors and Destructors 17 | 18 | public Node() 19 | { 20 | Children = new ObservableCollection(); 21 | Editable = true; 22 | } 23 | 24 | #endregion 25 | 26 | #region Public Properties 27 | 28 | public ObservableCollection Children { get; set; } 29 | 30 | public string Name { get; set; } 31 | 32 | public Brush Color { get; set; } 33 | 34 | public List Colors { get; set; } 35 | 36 | #endregion 37 | 38 | #region Public Methods 39 | 40 | public override string ToString() 41 | { 42 | return Name; 43 | } 44 | 45 | #endregion 46 | 47 | public bool Editable { get; set; } 48 | } 49 | } -------------------------------------------------------------------------------- /Samples/EditColorsSample/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("EditSample")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Microsoft")] 14 | [assembly: AssemblyProduct("EditSample")] 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/EditColorsSample/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 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.SimpleSample.Properties 12 | { 13 | using System; 14 | 15 | 16 | /// 17 | /// A strongly-typed resource class, for looking up localized strings, etc. 18 | /// 19 | // This class was auto-generated by the StronglyTypedResourceBuilder 20 | // class via a tool like ResGen or Visual Studio. 21 | // To add or remove a member, edit your .ResX file then rerun ResGen 22 | // with the /str option, or rebuild your VS project. 23 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 24 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 25 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 26 | internal class Resources 27 | { 28 | 29 | private static global::System.Resources.ResourceManager resourceMan; 30 | 31 | private static global::System.Globalization.CultureInfo resourceCulture; 32 | 33 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 34 | internal Resources() 35 | { 36 | } 37 | 38 | /// 39 | /// Returns the cached ResourceManager instance used by this class. 40 | /// 41 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 42 | internal static global::System.Resources.ResourceManager ResourceManager 43 | { 44 | get 45 | { 46 | if (object.ReferenceEquals(resourceMan, null)) 47 | { 48 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TreeViewEx.SimpleSample.Properties.Resources", typeof(Resources).Assembly); 49 | resourceMan = temp; 50 | } 51 | return resourceMan; 52 | } 53 | } 54 | 55 | /// 56 | /// Overrides the current thread's CurrentUICulture property for all 57 | /// resource lookups using this strongly typed resource class. 58 | /// 59 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 60 | internal static global::System.Globalization.CultureInfo Culture 61 | { 62 | get 63 | { 64 | return resourceCulture; 65 | } 66 | set 67 | { 68 | resourceCulture = value; 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Samples/EditColorsSample/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 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.SimpleSample.Properties 12 | { 13 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 14 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 15 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 16 | { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default 21 | { 22 | get 23 | { 24 | return defaultInstance; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Samples/EditColorsSample/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/InvisibleItemsSample/App.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/InvisibleItemsSample/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 W7StyleSample 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples/InvisibleItemsSample/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 13 | 16 | 17 | 18 | 20 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Samples/InvisibleItemsSample/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace W7StyleSample 2 | { 3 | #region 4 | 5 | using W7StyleSample.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 | var firstNode = new Node { Name = "element" }; 19 | var first1 = new Node { Name = "element1" }; 20 | var first2 = new Node { Name = "element2" }; 21 | var first11 = new Node { Name = "element11" , IsVisible = false}; 22 | var first12 = new Node { Name = "element12", Visibility = System.Windows.Visibility.Collapsed }; 23 | var first13 = new Node { Name = "element13" }; 24 | var first14 = new Node { Name = "element14", Visibility = System.Windows.Visibility.Hidden }; 25 | var first15 = new Node { Name = "element15" , IsVisible = false}; 26 | var first131 = new Node { Name = "element131" }; 27 | var first132 = new Node { Name = "element132" }; 28 | 29 | firstNode.Children.Add(first1); 30 | firstNode.Children.Add(first2); 31 | first1.Children.Add(first11); 32 | first1.Children.Add(first12); 33 | first1.Children.Add(first13); 34 | first1.Children.Add(first14); 35 | first1.Children.Add(first15); 36 | first13.Children.Add(first131); 37 | first13.Children.Add(first132); 38 | 39 | DataContext = firstNode; 40 | 41 | InitializeComponent(); 42 | } 43 | 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /Samples/InvisibleItemsSample/Model/Node.cs: -------------------------------------------------------------------------------- 1 | namespace W7StyleSample.Model 2 | { 3 | #region 4 | 5 | using System.Collections.ObjectModel; 6 | using System.Windows; 7 | 8 | #endregion 9 | 10 | /// 11 | /// Model for testing 12 | /// 13 | public class Node 14 | { 15 | #region Constructors and Destructors 16 | 17 | public Node() 18 | { 19 | Children = new ObservableCollection(); 20 | IsVisible = true; 21 | } 22 | 23 | #endregion 24 | 25 | #region Public Properties 26 | 27 | public ObservableCollection Children { get; set; } 28 | 29 | public string Name { get; set; } 30 | 31 | public Visibility Visibility { get; set; } 32 | public bool IsVisible { get; set; } 33 | #endregion 34 | 35 | #region Public Methods 36 | 37 | public override string ToString() 38 | { 39 | return Name; 40 | } 41 | 42 | #endregion 43 | } 44 | } -------------------------------------------------------------------------------- /Samples/InvisibleItemsSample/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/InvisibleItemsSample/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 InvisibleSample.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("InvisibleSample.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/InvisibleItemsSample/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 InvisibleSample.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/InvisibleItemsSample/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/ScrollTestSample/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Samples/ScrollTestSample/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 W7StyleSample 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples/ScrollTestSample/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Samples/ScrollTestSample/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace W7StyleSample 2 | { 3 | #region 4 | 5 | using System; 6 | 7 | using W7StyleSample.Model; 8 | 9 | #endregion 10 | 11 | /// 12 | /// Interaction logic for MainWindow.xaml 13 | /// 14 | public partial class MainWindow 15 | { 16 | #region Constructors and Destructors 17 | 18 | public MainWindow() 19 | { 20 | var firstNode = new Node { Name = "element" }; 21 | var first1 = new Node { Name = "element1" }; 22 | var first2 = new Node { Name = "element2" }; 23 | var first11 = new Node { Name = "element11" }; 24 | var first12 = new Node { Name = "element12" }; 25 | var first13 = new Node { Name = "element13" }; 26 | var first14 = new Node { Name = "element14" }; 27 | var first15 = new Node { Name = "element15" }; 28 | var first131 = new Node { Name = "element131" }; 29 | var first132 = new Node { Name = "element132" }; 30 | 31 | firstNode.Children.Add(first1); 32 | firstNode.Children.Add(first2); 33 | first1.Children.Add(first11); 34 | first1.Children.Add(first12); 35 | first1.Children.Add(first13); 36 | first1.Children.Add(first14); 37 | first1.Children.Add(first15); 38 | first13.Children.Add(first131); 39 | first13.Children.Add(first132); 40 | 41 | DataContext = firstNode; 42 | 43 | InitializeComponent(); 44 | } 45 | 46 | #endregion 47 | 48 | private void Button_Click(object sender, System.Windows.RoutedEventArgs e) 49 | { 50 | var node = DataContext as Node; 51 | for (int i = 0; i < 5; i++) 52 | { 53 | node.Children.Add( 54 | new Node { Name = DateTime.Now.Millisecond.ToString() }); 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Samples/ScrollTestSample/Model/Node.cs: -------------------------------------------------------------------------------- 1 | namespace W7StyleSample.Model 2 | { 3 | #region 4 | 5 | using System.Collections.ObjectModel; 6 | 7 | #endregion 8 | 9 | /// 10 | /// Model for testing 11 | /// 12 | public class Node 13 | { 14 | #region Constructors and Destructors 15 | 16 | public Node() 17 | { 18 | Children = new ObservableCollection(); 19 | } 20 | 21 | #endregion 22 | 23 | #region Public Properties 24 | 25 | public ObservableCollection Children { get; set; } 26 | 27 | public string Name { get; set; } 28 | 29 | #endregion 30 | 31 | #region Public Methods 32 | 33 | public override string ToString() 34 | { 35 | return Name; 36 | } 37 | 38 | #endregion 39 | } 40 | } -------------------------------------------------------------------------------- /Samples/ScrollTestSample/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/ScrollTestSample/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 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.SimpleSample.Properties 12 | { 13 | using System; 14 | 15 | 16 | /// 17 | /// A strongly-typed resource class, for looking up localized strings, etc. 18 | /// 19 | // This class was auto-generated by the StronglyTypedResourceBuilder 20 | // class via a tool like ResGen or Visual Studio. 21 | // To add or remove a member, edit your .ResX file then rerun ResGen 22 | // with the /str option, or rebuild your VS project. 23 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 24 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 25 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 26 | internal class Resources 27 | { 28 | 29 | private static global::System.Resources.ResourceManager resourceMan; 30 | 31 | private static global::System.Globalization.CultureInfo resourceCulture; 32 | 33 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 34 | internal Resources() 35 | { 36 | } 37 | 38 | /// 39 | /// Returns the cached ResourceManager instance used by this class. 40 | /// 41 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 42 | internal static global::System.Resources.ResourceManager ResourceManager 43 | { 44 | get 45 | { 46 | if (object.ReferenceEquals(resourceMan, null)) 47 | { 48 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TreeViewEx.SimpleSample.Properties.Resources", typeof(Resources).Assembly); 49 | resourceMan = temp; 50 | } 51 | return resourceMan; 52 | } 53 | } 54 | 55 | /// 56 | /// Overrides the current thread's CurrentUICulture property for all 57 | /// resource lookups using this strongly typed resource class. 58 | /// 59 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 60 | internal static global::System.Globalization.CultureInfo Culture 61 | { 62 | get 63 | { 64 | return resourceCulture; 65 | } 66 | set 67 | { 68 | resourceCulture = value; 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Samples/ScrollTestSample/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 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.SimpleSample.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Samples/ScrollTestSample/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/SelectionBinding/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Samples/SelectionBinding/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 BindingSample 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples/SelectionBinding/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace BindingSample 2 | { 3 | #region 4 | 5 | using BindingSample.Model; 6 | using System.Windows; 7 | 8 | #endregion 9 | 10 | /// 11 | /// Interaction logic for MainWindow.xaml 12 | /// 13 | public partial class MainWindow: Window 14 | { 15 | #region Constructors and Destructors 16 | 17 | Node firstNode; 18 | Node first1; 19 | Node first2; 20 | Node first11; 21 | 22 | public MainWindow() 23 | { 24 | firstNode = new Node { Name = "element" }; 25 | first1 = new Node { Name = "element1" }; 26 | first2 = new Node { Name = "element2" }; 27 | first11 = new Node { Name = "element11" }; 28 | var first12 = new Node { Name = "element12" }; 29 | var first13 = new Node { Name = "element13" }; 30 | var first14 = new Node { Name = "element14" }; 31 | var first15 = new Node { Name = "element15" }; 32 | var first131 = new Node { Name = "element131" }; 33 | var first132 = new Node { Name = "element132" }; 34 | 35 | firstNode.Children.Add(first1); 36 | firstNode.Children.Add(first2); 37 | first1.Children.Add(first11); 38 | first1.Children.Add(first12); 39 | first1.Children.Add(first13); 40 | first1.Children.Add(first14); 41 | first1.Children.Add(first15); 42 | first13.Children.Add(first131); 43 | first13.Children.Add(first132); 44 | 45 | // for (int i = 0; i < 1000; i++) 46 | // { 47 | // first.Children.Add(new Node { Name = "element" + (i + 2) }); 48 | // } 49 | DataContext = firstNode; 50 | 51 | InitializeComponent(); 52 | 53 | this.KeyDown += MainWindow_KeyDown; 54 | } 55 | 56 | void MainWindow_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) 57 | { 58 | if(e.Key==System.Windows.Input.Key.Space) 59 | { 60 | var newNode = new Node { Name = "elementNew" }; 61 | firstNode.Children.Add(newNode); 62 | leftTree.BringIntoView(newNode); 63 | } 64 | } 65 | 66 | #endregion 67 | 68 | private void leftTree_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) 69 | { 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /Samples/SelectionBinding/Model/Node.cs: -------------------------------------------------------------------------------- 1 | namespace BindingSample.Model 2 | { 3 | #region 4 | 5 | using System.Collections.ObjectModel; 6 | 7 | #endregion 8 | 9 | /// 10 | /// Model for testing 11 | /// 12 | public class Node 13 | { 14 | #region Constructors and Destructors 15 | 16 | public Node() 17 | { 18 | Children = new ObservableCollection(); 19 | } 20 | 21 | #endregion 22 | 23 | #region Public Properties 24 | 25 | public ObservableCollection Children { get; set; } 26 | 27 | private string name; 28 | 29 | public string Name 30 | { 31 | get 32 | { 33 | return name; 34 | } 35 | set 36 | { 37 | name = value; 38 | } 39 | } 40 | 41 | #endregion 42 | 43 | #region Public Methods 44 | 45 | public override string ToString() 46 | { 47 | return Name; 48 | } 49 | 50 | #endregion 51 | } 52 | } -------------------------------------------------------------------------------- /Samples/SelectionBinding/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("SelectionBinding")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Microsoft")] 14 | [assembly: AssemblyProduct("SelectionBinding")] 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/SelectionBinding/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 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 BindingSample.Properties 12 | { 13 | using System; 14 | 15 | 16 | /// 17 | /// A strongly-typed resource class, for looking up localized strings, etc. 18 | /// 19 | // This class was auto-generated by the StronglyTypedResourceBuilder 20 | // class via a tool like ResGen or Visual Studio. 21 | // To add or remove a member, edit your .ResX file then rerun ResGen 22 | // with the /str option, or rebuild your VS project. 23 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 24 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 25 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 26 | internal class Resources 27 | { 28 | 29 | private static global::System.Resources.ResourceManager resourceMan; 30 | 31 | private static global::System.Globalization.CultureInfo resourceCulture; 32 | 33 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 34 | internal Resources() 35 | { 36 | } 37 | 38 | /// 39 | /// Returns the cached ResourceManager instance used by this class. 40 | /// 41 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 42 | internal static global::System.Resources.ResourceManager ResourceManager 43 | { 44 | get 45 | { 46 | if (object.ReferenceEquals(resourceMan, null)) 47 | { 48 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BindingSample.Properties.Resources", typeof(Resources).Assembly); 49 | resourceMan = temp; 50 | } 51 | return resourceMan; 52 | } 53 | } 54 | 55 | /// 56 | /// Overrides the current thread's CurrentUICulture property for all 57 | /// resource lookups using this strongly typed resource class. 58 | /// 59 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 60 | internal static global::System.Globalization.CultureInfo Culture 61 | { 62 | get 63 | { 64 | return resourceCulture; 65 | } 66 | set 67 | { 68 | resourceCulture = value; 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Samples/SelectionBinding/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 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 BindingSample.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Samples/SelectionBinding/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/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 BindingWithControllerSample 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/CommandMgr/CommandBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace BindingWithControllerSample.CommandMgr 7 | { 8 | 9 | abstract internal class CommandBase 10 | { 11 | internal IReceiver receiver; 12 | 13 | public CommandBase(IReceiver receiver) 14 | { 15 | this.receiver = receiver; 16 | } 17 | 18 | public abstract void Execute(); 19 | public abstract void Undo(); 20 | 21 | } 22 | 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/CommandMgr/CommandController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace BindingWithControllerSample.CommandMgr 6 | { 7 | internal class CommandController 8 | { 9 | private Stack _commandStack; 10 | private Stack _undoStack; 11 | 12 | public CommandController() 13 | { 14 | _commandStack = new Stack(); 15 | _undoStack = new Stack(); 16 | } 17 | 18 | public void ExecuteCommand() 19 | { 20 | if (_commandStack.Count == 0) return; 21 | 22 | //Trace.WriteLine("EXECUTING COMMAND"); 23 | 24 | CommandBase command = _commandStack.Pop(); 25 | command.Execute(); 26 | _undoStack.Push(command); 27 | } 28 | 29 | public void UndoCommand() 30 | { 31 | if (_undoStack.Count == 0) return; 32 | 33 | //Trace.WriteLine("REVERSING COMMAND"); 34 | 35 | CommandBase command = _undoStack.Pop(); 36 | command.Undo(); 37 | _commandStack.Push(command); 38 | } 39 | 40 | public void AddAndExecute(CommandBase command) 41 | { 42 | _commandStack.Clear(); 43 | _commandStack.Push(command); 44 | ExecuteCommand(); 45 | } 46 | 47 | public void ClearHistory() 48 | { 49 | _undoStack.Clear(); 50 | _commandStack.Clear(); 51 | } 52 | 53 | public int RedoCount { get { return _commandStack.Count; } } 54 | public int UndoCount { get { return _undoStack.Count; } } 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/CommandMgr/Commands/CommandGroupCmd.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace BindingWithControllerSample.CommandMgr.Commands 6 | { 7 | /// 8 | /// Execute/Undo more than one command in a single step. 9 | /// Useful for compiling simple commands into more complex one. 10 | /// 11 | class CommandGroupCmd : CommandBase 12 | { 13 | CommandBase[] commandGroup; 14 | 15 | public CommandGroupCmd(IReceiver receiver, CommandBase[] commandGroup): base(receiver) 16 | { 17 | this.commandGroup = commandGroup; 18 | } 19 | 20 | public override void Execute() 21 | { 22 | // execute all commands in a row 23 | for(int i=0;i=0; i--) 31 | commandGroup[i].Undo(); 32 | } 33 | 34 | 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/CommandMgr/Commands/DeselectAllItemsCmd.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using BindingWithControllerSample.Model; 5 | using BindingWithControllerSample.ViewModel; 6 | 7 | namespace BindingWithControllerSample.CommandMgr.Commands 8 | { 9 | class DeselectAllItemsCmd : CommandBase 10 | { 11 | Node[] selectedItems; 12 | 13 | public DeselectAllItemsCmd(MainViewModel receiver): base(receiver) 14 | { 15 | } 16 | 17 | public override void Execute() 18 | { 19 | selectedItems = ((MainViewModel)receiver).__DeselectAllItems(); 20 | } 21 | 22 | public override void Undo() 23 | { 24 | foreach (Node gc in selectedItems) 25 | ((MainViewModel)receiver).__SelectItem(gc); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/CommandMgr/Commands/DeselectItemCmd.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using BindingWithControllerSample.Model; 6 | using BindingWithControllerSample.ViewModel; 7 | 8 | namespace BindingWithControllerSample.CommandMgr.Commands 9 | { 10 | class DeselectItemCmd : CommandBase 11 | { 12 | Node gc; 13 | 14 | public DeselectItemCmd(MainViewModel receiver, Node gc): base(receiver) 15 | { 16 | this.gc = gc; 17 | } 18 | 19 | public override void Execute() 20 | { 21 | ((MainViewModel)receiver).__DeselectItem(gc); 22 | } 23 | 24 | 25 | public override void Undo() 26 | { 27 | ((MainViewModel)receiver).__SelectItem(gc); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/CommandMgr/Commands/SelectItemCmd.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using BindingWithControllerSample.Model; 5 | using BindingWithControllerSample.ViewModel; 6 | 7 | namespace BindingWithControllerSample.CommandMgr.Commands 8 | { 9 | class SelectItemCmd:CommandBase 10 | { 11 | Node gc; 12 | 13 | public SelectItemCmd(MainViewModel receiver, Node gc): base(receiver) 14 | { 15 | this.gc = gc; 16 | } 17 | 18 | public override void Execute() 19 | { 20 | ((MainViewModel)receiver).__SelectItem(gc); 21 | } 22 | 23 | 24 | public override void Undo() 25 | { 26 | ((MainViewModel)receiver).__DeselectItem(gc); 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/CommandMgr/IReceiver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace BindingWithControllerSample.CommandMgr 7 | { 8 | internal interface IReceiver 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/Model/Node.cs: -------------------------------------------------------------------------------- 1 | namespace BindingWithControllerSample.Model 2 | { 3 | #region 4 | 5 | using System.Collections.ObjectModel; 6 | 7 | #endregion 8 | 9 | /// 10 | /// Model for testing 11 | /// 12 | public class Node 13 | { 14 | #region Constructors and Destructors 15 | 16 | public Node() 17 | { 18 | Children = new ObservableCollection(); 19 | } 20 | 21 | #endregion 22 | 23 | #region Public Properties 24 | 25 | public ObservableCollection Children { get; set; } 26 | 27 | private string name; 28 | 29 | public string Name 30 | { 31 | get 32 | { 33 | return name; 34 | } 35 | set 36 | { 37 | name = value; 38 | } 39 | } 40 | 41 | #endregion 42 | 43 | #region Public Methods 44 | 45 | public override string ToString() 46 | { 47 | return Name; 48 | } 49 | 50 | #endregion 51 | } 52 | } -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/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("SelectionBindingWithController")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("nkast")] 14 | [assembly: AssemblyProduct("SelectionBindingWithController")] 15 | [assembly: AssemblyCopyright("Copyright © nkast 2013")] 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/SelectionBindingWithController/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 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 BindingWithControllerSample.Properties 12 | { 13 | using System; 14 | 15 | 16 | /// 17 | /// A strongly-typed resource class, for looking up localized strings, etc. 18 | /// 19 | // This class was auto-generated by the StronglyTypedResourceBuilder 20 | // class via a tool like ResGen or Visual Studio. 21 | // To add or remove a member, edit your .ResX file then rerun ResGen 22 | // with the /str option, or rebuild your VS project. 23 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 24 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 25 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 26 | internal class Resources 27 | { 28 | 29 | private static global::System.Resources.ResourceManager resourceMan; 30 | 31 | private static global::System.Globalization.CultureInfo resourceCulture; 32 | 33 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 34 | internal Resources() 35 | { 36 | } 37 | 38 | /// 39 | /// Returns the cached ResourceManager instance used by this class. 40 | /// 41 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 42 | internal static global::System.Resources.ResourceManager ResourceManager 43 | { 44 | get 45 | { 46 | if (object.ReferenceEquals(resourceMan, null)) 47 | { 48 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BindingSample.Properties.Resources", typeof(Resources).Assembly); 49 | resourceMan = temp; 50 | } 51 | return resourceMan; 52 | } 53 | } 54 | 55 | /// 56 | /// Overrides the current thread's CurrentUICulture property for all 57 | /// resource lookups using this strongly typed resource class. 58 | /// 59 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 60 | internal static global::System.Globalization.CultureInfo Culture 61 | { 62 | get 63 | { 64 | return resourceCulture; 65 | } 66 | set 67 | { 68 | resourceCulture = value; 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 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 BindingWithControllerSample.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/SelectionBindingWithController/ViewModel/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | using BindingWithControllerSample.CommandMgr; 2 | using BindingWithControllerSample.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace BindingWithControllerSample.ViewModel 10 | { 11 | public class MainViewModel:IReceiver 12 | { 13 | CommandController _controller; 14 | 15 | public ObservableCollection Children { get; set; } 16 | internal CommandController Controller { get { return _controller; } } 17 | 18 | public int RedoCount { get { return _controller.RedoCount; } } 19 | public int UndoCount { get { return _controller.UndoCount; } } 20 | 21 | 22 | public MainViewModel() 23 | { 24 | _controller = new CommandController(); 25 | Children = new ObservableCollection(); 26 | } 27 | 28 | ObservableCollection _selectedItems = new ObservableCollection(); 29 | public ObservableCollection SelectedItems 30 | { 31 | get { return _selectedItems; } 32 | } 33 | ReadOnlyObservableCollection _readonlySelectedItems = null; 34 | public ReadOnlyObservableCollection ReadOnlySelectedItems 35 | { 36 | get 37 | { 38 | if (_readonlySelectedItems == null) 39 | _readonlySelectedItems = new ReadOnlyObservableCollection(_selectedItems); 40 | return _readonlySelectedItems; 41 | } 42 | } 43 | 44 | 45 | #region Reciever Selection 46 | 47 | internal void __SelectItem(Node gc) 48 | { 49 | if (!_selectedItems.Contains(gc)) 50 | { 51 | _selectedItems.Add(gc); 52 | //OnSelectionChanged(EventArgs.Empty); 53 | } 54 | } 55 | 56 | internal void __DeselectItem(Node gc) 57 | { 58 | if (_selectedItems.Contains(gc)) 59 | { 60 | _selectedItems.Remove(gc); 61 | //OnSelectionChanged(EventArgs.Empty); 62 | } 63 | } 64 | 65 | internal Node[] __DeselectAllItems() 66 | { 67 | //make a copy of currert selections and return it. 68 | Node[] prevSelectedItems = new Node[_selectedItems.Count]; 69 | _selectedItems.CopyTo(prevSelectedItems, 0); 70 | 71 | _selectedItems.Clear(); 72 | //OnSelectionChanged(EventArgs.Empty); 73 | 74 | return prevSelectedItems; 75 | } 76 | 77 | #endregion 78 | 79 | 80 | 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Samples/SimpleEditSample/App.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/SimpleEditSample/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 W7StyleSample 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples/SimpleEditSample/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 21 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Samples/SimpleEditSample/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace W7StyleSample 2 | { 3 | #region 4 | 5 | using W7StyleSample.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 | var firstNode = new Node { Name = "element" }; 19 | var first1 = new Node { Name = "element1" }; 20 | var first2 = new Node { Name = "element2" }; 21 | var first11 = new Node { Name = "element11" }; 22 | var first12 = new Node { Name = "element12" }; 23 | var first13 = new Node { Name = "element13", IsExpandedValue = false }; 24 | var first14 = new Node { Name = "element14", IsExpandedValue = false }; 25 | var first15 = new Node { Name = "element15" }; 26 | var first131 = new Node { Name = "element131" }; 27 | var first132 = new Node { Name = "element132" }; 28 | 29 | for (int i = 1; i <= 50; i++) 30 | { 31 | first14.Children.Add(new Node { Name = "element14_" + i }); 32 | } 33 | 34 | firstNode.Children.Add(first1); 35 | firstNode.Children.Add(first2); 36 | first1.Children.Add(first11); 37 | first1.Children.Add(first12); 38 | first1.Children.Add(first13); 39 | first1.Children.Add(first14); 40 | first1.Children.Add(first15); 41 | first13.Children.Add(first131); 42 | first13.Children.Add(first132); 43 | 44 | DataContext = firstNode; 45 | 46 | InitializeComponent(); 47 | } 48 | 49 | #endregion 50 | } 51 | } -------------------------------------------------------------------------------- /Samples/SimpleEditSample/Model/Node.cs: -------------------------------------------------------------------------------- 1 | namespace W7StyleSample.Model 2 | { 3 | #region 4 | 5 | using System.Collections.ObjectModel; 6 | 7 | #endregion 8 | 9 | /// 10 | /// Model for testing 11 | /// 12 | public class Node 13 | { 14 | #region Constructors and Destructors 15 | 16 | public Node() 17 | { 18 | Children = new ObservableCollection(); 19 | IsExpandedValue = true; 20 | } 21 | 22 | #endregion 23 | 24 | #region Public Properties 25 | 26 | public ObservableCollection Children { get; set; } 27 | string name; 28 | public string Name { get { return name; } set { name = value; } } 29 | public bool IsExpandedValue { get; set; } 30 | #endregion 31 | 32 | #region Public Methods 33 | 34 | public override string ToString() 35 | { 36 | return Name; 37 | } 38 | 39 | #endregion 40 | } 41 | } -------------------------------------------------------------------------------- /Samples/SimpleEditSample/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/SimpleEditSample/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17929 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.SimpleSample.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.SimpleSample.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/SimpleEditSample/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17929 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.SimpleSample.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.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/SimpleEditSample/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/SimpleEditSample/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Samples/SimpleSample/App.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/SimpleSample/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 W7StyleSample 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples/SimpleSample/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Samples/SimpleSample/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace W7StyleSample 2 | { 3 | #region 4 | 5 | using System.Diagnostics; 6 | using W7StyleSample.Model; 7 | 8 | #endregion 9 | 10 | /// 11 | /// Interaction logic for MainWindow.xaml 12 | /// 13 | public partial class MainWindow 14 | { 15 | #region Constructors and Destructors 16 | 17 | public MainWindow() 18 | { 19 | var firstNode = new Node { Name = "element" }; 20 | var first1 = new Node { Name = "element1" }; 21 | var first2 = new Node { Name = "element2" }; 22 | var first11 = new Node { Name = "element11" }; 23 | var first12 = new Node { Name = "element12" }; 24 | var first13 = new Node { Name = "element13", IsExpandedValue = false }; 25 | var first14 = new Node { Name = "element14", IsExpandedValue = false }; 26 | var first15 = new Node { Name = "element15" }; 27 | var first131 = new Node { Name = "element131" }; 28 | var first132 = new Node { Name = "element132" }; 29 | 30 | for (int i = 1; i <= 50; i++) 31 | { 32 | first14.Children.Add(new Node { Name = "element14_" + i }); 33 | } 34 | 35 | firstNode.Children.Add(first1); 36 | firstNode.Children.Add(first2); 37 | first1.Children.Add(first11); 38 | first1.Children.Add(first12); 39 | first1.Children.Add(first13); 40 | first1.Children.Add(first14); 41 | first1.Children.Add(first15); 42 | first13.Children.Add(first131); 43 | first13.Children.Add(first132); 44 | 45 | DataContext = firstNode; 46 | 47 | InitializeComponent(); 48 | } 49 | 50 | #endregion 51 | } 52 | } -------------------------------------------------------------------------------- /Samples/SimpleSample/Model/Node.cs: -------------------------------------------------------------------------------- 1 | namespace W7StyleSample.Model 2 | { 3 | #region 4 | 5 | using System.Collections.ObjectModel; 6 | 7 | #endregion 8 | 9 | /// 10 | /// Model for testing 11 | /// 12 | public class Node 13 | { 14 | #region Constructors and Destructors 15 | 16 | public Node() 17 | { 18 | Children = new ObservableCollection(); 19 | IsExpandedValue = true; 20 | } 21 | 22 | #endregion 23 | 24 | #region Public Properties 25 | 26 | public ObservableCollection Children { get; set; } 27 | 28 | public string Name { get; set; } 29 | public bool IsExpandedValue { get; set; } 30 | #endregion 31 | 32 | #region Public Methods 33 | 34 | public override string ToString() 35 | { 36 | return Name; 37 | } 38 | 39 | #endregion 40 | } 41 | } -------------------------------------------------------------------------------- /Samples/SimpleSample/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/SimpleSample/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17929 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.SimpleSample.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.SimpleSample.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/SimpleSample/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17929 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.SimpleSample.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.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/SimpleSample/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/SimpleSample/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Samples/VirtualizationSample/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Samples/VirtualizationSample/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 TreeViewEx.VirtualizationSample 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples/VirtualizationSample/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 13 | Virtualize Items 16 | 17 | 18 | 19 | Time to load: 20 | 21 | 22 | 23 | Memory after action: 24 | 25 | 26 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Samples/VirtualizationSample/Model/Node.cs: -------------------------------------------------------------------------------- 1 | namespace W7StyleSample.Model 2 | { 3 | #region 4 | 5 | using System.Collections.ObjectModel; 6 | using System.Collections.Generic; 7 | 8 | #endregion 9 | 10 | /// 11 | /// Model for testing 12 | /// 13 | public class Node 14 | { 15 | #region Constructors and Destructors 16 | 17 | public Node() 18 | { 19 | Children = new List(); 20 | } 21 | 22 | #endregion 23 | 24 | #region Public Properties 25 | 26 | public List Children { get; set; } 27 | 28 | public string Name { get; set; } 29 | 30 | #endregion 31 | 32 | #region Public Methods 33 | 34 | public override string ToString() 35 | { 36 | return Name; 37 | } 38 | 39 | #endregion 40 | } 41 | } -------------------------------------------------------------------------------- /Samples/VirtualizationSample/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/VirtualizationSample/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18034 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.VirtualizationSample.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.VirtualizationSample.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/VirtualizationSample/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18034 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.VirtualizationSample.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.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/VirtualizationSample/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Samples/VirtualizationSample/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /TreeViewEx.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TreeViewEx.Test")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("TreeViewEx.Test")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1a47613b-36d1-4afc-91f6-1877a6006b02")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /TreeViewEx.Test/UiTesting/ExpandCollapseTests.cs: -------------------------------------------------------------------------------- 1 | namespace TreeViewEx.Test.Model 2 | { 3 | #region 4 | using System.Windows.Automation; 5 | 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | 8 | using TreeViewEx.Test.Model.Helper; 9 | 10 | #endregion 11 | 12 | [TestClass] 13 | [DeploymentItem("SimpleSample.exe")] 14 | [DeploymentItem("TreeViewEx.dll")] 15 | public class ExpandCollapseTests 16 | { 17 | #region Public Properties 18 | 19 | public TestContext TestContext { get; set; } 20 | 21 | #endregion 22 | 23 | #region Public Methods 24 | 25 | [TestMethod] 26 | public void Collapse() 27 | { 28 | using (TreeApplication app = new TreeApplication("SimpleSample")) 29 | { 30 | SimpleSampleTree sst = new SimpleSampleTree(app); 31 | sst.Element1.Expand(); 32 | sst.Element1.Collapse(); 33 | 34 | Assert.IsFalse(sst.Element1.IsExpanded); 35 | } 36 | } 37 | 38 | [TestMethod] 39 | public void Expand() 40 | { 41 | using (TreeApplication app = new TreeApplication("SimpleSample")) 42 | { 43 | SimpleSampleTree sst = new SimpleSampleTree(app); 44 | sst.Element1.Expand(); 45 | 46 | Assert.IsTrue(sst.Element1.IsExpanded); 47 | } 48 | } 49 | 50 | #endregion 51 | } 52 | } -------------------------------------------------------------------------------- /TreeViewEx.Test/UiTesting/Helper/AutomationElementHelper.cs: -------------------------------------------------------------------------------- 1 | namespace TreeViewEx.Test.Model.Helper 2 | { 3 | #region 4 | 5 | using System; 6 | using System.Windows.Automation; 7 | using System.Linq; 8 | #endregion 9 | 10 | /// 11 | /// Helper methods for AutomationElements 12 | /// 13 | public static class AutomationElementHelper 14 | { 15 | #region Methods 16 | 17 | public static AutomationPattern GetPattern() where T : BasePattern 18 | { 19 | if (typeof(T) == typeof(ExpandCollapsePattern)) 20 | { 21 | return ExpandCollapsePattern.Pattern; 22 | } 23 | 24 | if (typeof(T) == typeof(SelectionItemPattern)) 25 | { 26 | return SelectionItemPattern.Pattern; 27 | } 28 | 29 | if (typeof(T) == typeof(ValuePattern)) 30 | { 31 | return ValuePattern.Pattern; 32 | } 33 | 34 | throw new InvalidOperationException("Pattern not supported of GetPattern extension method."); 35 | } 36 | 37 | public static T GetPattern(this AutomationElement treeItem) where T : BasePattern 38 | { 39 | T t = treeItem.GetCurrentPattern(GetPattern()) as T; 40 | if (t == null) 41 | { 42 | throw new InvalidOperationException("Pattern was not found for object."); 43 | } 44 | 45 | return t; 46 | } 47 | 48 | public static AutomationElement FindFirstDescendant(this AutomationElement element, ControlType type) 49 | { 50 | PropertyCondition cond = new PropertyCondition(AutomationElement.ControlTypeProperty, type); 51 | 52 | AutomationElement treeItem = element.FindFirst(TreeScope.Descendants, cond); 53 | 54 | return treeItem; 55 | } 56 | 57 | public static AutomationElement FindDescendant(this AutomationElement element, ControlType type, int index) 58 | { 59 | PropertyCondition cond = new PropertyCondition(AutomationElement.ControlTypeProperty, type); 60 | 61 | AutomationElementCollection treeItems = element.FindAll(TreeScope.Descendants, cond); 62 | 63 | return treeItems[index]; 64 | } 65 | 66 | public static AutomationElement FindDescendantByName(this AutomationElement element, ControlType type, string name) 67 | { 68 | PropertyCondition typeCond = new PropertyCondition(AutomationElement.ControlTypeProperty, type); 69 | PropertyCondition nameCond = new PropertyCondition(AutomationElement.NameProperty, name); 70 | AndCondition and = new AndCondition(new Condition[] { typeCond, nameCond }); 71 | 72 | return element.FindFirst(TreeScope.Descendants, and); 73 | } 74 | 75 | public static AutomationElement FindDescendantByAutomationId(this AutomationElement element, ControlType type, string automationId) 76 | { 77 | PropertyCondition typeCond = new PropertyCondition(AutomationElement.ControlTypeProperty, type); 78 | PropertyCondition nameCond = new PropertyCondition(AutomationElement.AutomationIdProperty, automationId); 79 | AndCondition and = new AndCondition(new Condition[] { typeCond, nameCond }); 80 | 81 | return element.FindFirst(TreeScope.Descendants, and); 82 | } 83 | #endregion 84 | } 85 | } -------------------------------------------------------------------------------- /TreeViewEx.Test/UiTesting/Helper/NativeStructs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace TreeViewEx.Test.Model.Helper 8 | { 9 | public class Const 10 | { 11 | public const int INPUT_MOUSE = 0; 12 | public const int INPUT_KEYBOARD = 1; 13 | } 14 | 15 | [StructLayout(LayoutKind.Sequential)] 16 | public struct INPUT 17 | { 18 | public int type; 19 | public INPUTUNION union; 20 | }; 21 | 22 | [StructLayout(LayoutKind.Explicit)] 23 | public struct INPUTUNION 24 | { 25 | [FieldOffset(0)] 26 | public MOUSEINPUT mouseInput; 27 | [FieldOffset(0)] 28 | public KEYBDINPUT keyboardInput; 29 | }; 30 | 31 | [StructLayout(LayoutKind.Sequential)] 32 | public struct MOUSEINPUT 33 | { 34 | public int dx; 35 | public int dy; 36 | public int mouseData; 37 | public int dwFlags; 38 | public int time; 39 | public IntPtr dwExtraInfo; 40 | }; 41 | 42 | [StructLayout(LayoutKind.Sequential)] 43 | public struct KEYBDINPUT 44 | { 45 | public short wVk; 46 | public short wScan; 47 | public int dwFlags; 48 | public int time; 49 | public IntPtr dwExtraInfo; 50 | }; 51 | } 52 | -------------------------------------------------------------------------------- /TreeViewEx.Test/UiTesting/Helper/TreeApplication.cs: -------------------------------------------------------------------------------- 1 | namespace TreeViewEx.Test.Model.Helper 2 | { 3 | #region 4 | 5 | using System; 6 | using System.Diagnostics; 7 | using System.Linq; 8 | using System.Threading; 9 | using System.Windows.Automation; 10 | using System.Runtime.InteropServices; 11 | 12 | #endregion 13 | 14 | /// 15 | /// Helper to handle a processes automation element 16 | /// 17 | public class TreeApplication : IDisposable 18 | { 19 | #region Constants and Fields 20 | 21 | private readonly string processName; 22 | 23 | private static Process p; 24 | 25 | private AutomationElement app; 26 | 27 | #endregion 28 | 29 | #region Constructors and Destructors 30 | 31 | public TreeApplication(string fileName) 32 | { 33 | processName = fileName;// +".exe"; 34 | 35 | p = GetProcess(processName); 36 | if (p != null) 37 | { 38 | p.Kill(); 39 | } 40 | 41 | ProcessStartInfo ps = new ProcessStartInfo { FileName = fileName }; 42 | p = new Process(); 43 | p.StartInfo = ps; 44 | p.Start(); 45 | 46 | while (!p.Responding) 47 | { 48 | Trace.WriteLine("waiting process"); 49 | Thread.Sleep(200); 50 | } 51 | 52 | while (app == null) 53 | { 54 | app = InitializeAutomationElement(); 55 | Trace.WriteLine("waiting for app"); 56 | Thread.Sleep(200); 57 | } 58 | } 59 | #endregion 60 | 61 | #region Public Properties 62 | 63 | public AutomationElement Ae 64 | { 65 | get 66 | { 67 | return app; 68 | } 69 | } 70 | 71 | #endregion 72 | 73 | #region Public Methods 74 | 75 | public void Dispose() 76 | { 77 | if (p != null && p.MainWindowHandle != IntPtr.Zero) 78 | { 79 | p.Kill(); 80 | while (GetProcess(processName) != null) 81 | { 82 | Thread.Sleep(50); 83 | } 84 | } 85 | } 86 | 87 | #endregion 88 | 89 | #region Methods 90 | 91 | private static Process GetProcess(string processname) 92 | { 93 | Process[] processes = Process.GetProcessesByName(processname); 94 | return processes.FirstOrDefault(); 95 | } 96 | 97 | private AutomationElement InitializeAutomationElement() 98 | { 99 | AutomationElement ae = AutomationElement.RootElement; 100 | PropertyCondition cond = new PropertyCondition(AutomationElement.ProcessIdProperty, p.Id); 101 | 102 | return ae.FindFirst(TreeScope.Children, cond); 103 | } 104 | 105 | #endregion 106 | } 107 | } -------------------------------------------------------------------------------- /TreeViewEx.Test/UiTesting/Model/BindingTree.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using TreeViewEx.Test.Model.Helper; 6 | using System.Windows.Automation; 7 | 8 | namespace TreeViewEx.Test.Model 9 | { 10 | class BindingTrees 11 | { 12 | public BindingTrees(TreeApplication app) 13 | { 14 | LeftTree = new Tree(app.Ae.FindDescendantByAutomationId(ControlType.Tree, "leftTree")); 15 | RightTree = new Tree(app.Ae.FindDescendantByAutomationId(ControlType.Tree, "rightTree")); 16 | } 17 | 18 | public Tree LeftTree { get; set; } 19 | public Tree RightTree { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /TreeViewEx.Test/UiTesting/Model/Element.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Automation; 6 | using TreeViewEx.Test.Model.Helper; 7 | 8 | namespace TreeViewEx.Test.Model 9 | { 10 | class Element 11 | { 12 | public Element(AutomationElement automationElement) 13 | { 14 | if (automationElement == null) 15 | { 16 | throw new ArgumentNullException("automationElement"); 17 | } 18 | 19 | Ae = automationElement; 20 | } 21 | 22 | internal AutomationElement Ae { get; private set; } 23 | 24 | public void Expand() 25 | { 26 | ExpandCollapsePattern expandPattern = Ae.GetPattern(); 27 | expandPattern.Expand(); 28 | } 29 | 30 | public void Collapse() 31 | { 32 | ExpandCollapsePattern expandPattern = Ae.GetPattern(); 33 | expandPattern.Collapse(); 34 | } 35 | 36 | public void Select() 37 | { 38 | SelectionItemPattern pattern = Ae.GetPattern(); 39 | pattern.Select(); 40 | } 41 | 42 | public bool IsSelected 43 | { 44 | get 45 | { 46 | SelectionItemPattern pattern = Ae.GetPattern(); 47 | return pattern.Current.IsSelected; 48 | } 49 | } 50 | 51 | public bool IsExpanded 52 | { 53 | get 54 | { 55 | ExpandCollapsePattern pattern = Ae.GetPattern(); 56 | return pattern.Current.ExpandCollapseState == ExpandCollapseState.Expanded; 57 | } 58 | } 59 | 60 | public bool IsFocused 61 | { 62 | get 63 | { 64 | //throw new InvalidOperationException( 65 | // "Focus of item cannot be requested, because the focus is set by UIAutomation."; 66 | return Convert.ToBoolean(GetValue("node;IsFocused")); 67 | } 68 | } 69 | 70 | public string GetValue(string id) 71 | { 72 | ValuePattern pattern = Ae.GetPattern(); 73 | pattern.SetValue(id); 74 | return pattern.Current.Value; 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /TreeViewEx.Test/UiTesting/Model/SimpleSampleTree.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using TreeViewEx.Test.Model.Helper; 6 | using System.Windows.Automation; 7 | 8 | namespace TreeViewEx.Test.Model 9 | { 10 | class SimpleSampleTree : Tree 11 | { 12 | public SimpleSampleTree(TreeApplication app) 13 | : base(app.Ae.FindDescendant(ControlType.Tree,0)) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /TreeViewEx.Test/UiTesting/Model/Tree.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using TreeViewEx.Test.Model.Helper; 6 | using System.Windows.Automation; 7 | 8 | namespace TreeViewEx.Test.Model 9 | { 10 | class Tree 11 | { 12 | AutomationElement treeAutomationElement; 13 | Element element1; 14 | Element element11; 15 | Element element12; 16 | Element element13; 17 | Element element14; 18 | Element element15; 19 | Element element2; 20 | 21 | public Tree(AutomationElement treeAutomationElement) 22 | { 23 | this.treeAutomationElement = treeAutomationElement; 24 | } 25 | 26 | public Element Element1 { get { return new Element(treeAutomationElement.FindFirstDescendant(ControlType.TreeItem)); } } 27 | public Element Element11 { get { return new Element(treeAutomationElement.FindDescendantByName(ControlType.TreeItem, "element11")); } } 28 | public Element Element12 { get { return new Element(treeAutomationElement.FindDescendantByName(ControlType.TreeItem, "element12")); } } 29 | public Element Element13 { get { return new Element(treeAutomationElement.FindDescendantByName(ControlType.TreeItem, "element13")); } } 30 | public Element Element14 { get { return new Element(treeAutomationElement.FindDescendantByName(ControlType.TreeItem, "element14")); } } 31 | public Element Element15 { get { return new Element(treeAutomationElement.FindDescendantByName(ControlType.TreeItem, "element15")); } } 32 | public Element Element2 { get { return new Element(treeAutomationElement.FindDescendantByName(ControlType.TreeItem, "element2")); } } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /TreeViewEx.Test/UnitTesting/Controls/SizesCacheTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows.Controls; 7 | using tainicom.TreeViewEx; 8 | 9 | namespace TreeViewEx.Test.Model.UnitTesting.Controls.SizesCacheTests 10 | { 11 | [TestClass] 12 | public class SizesCacheTests 13 | { 14 | [TestMethod] 15 | public void AddInEmptyCache() 16 | { 17 | var expected = 43.0; 18 | var target = new SizesCache(); 19 | target.AddOrChange(0, expected); 20 | 21 | Assert.AreEqual(expected, target.GetEstimate(0)); 22 | } 23 | 24 | [TestMethod] 25 | public void AddInFilledCache() 26 | { 27 | var target = new SizesCache(); 28 | target.AddOrChange(0, 43); 29 | target.AddOrChange(0, 46); 30 | target.AddOrChange(0, 46); 31 | 32 | Assert.AreEqual(46, target.GetEstimate(0)); 33 | } 34 | 35 | [TestMethod] 36 | public void Change() 37 | { 38 | var target = new SizesCache(); 39 | target.AddOrChange(0, 43); 40 | target.AddOrChange(0, 46); 41 | target.AddOrChange(0, 46); 42 | target.AddOrChange(0, 43); 43 | target.AddOrChange(0, 43); 44 | 45 | Assert.AreEqual(43, target.GetEstimate(0)); 46 | } 47 | 48 | [TestMethod] 49 | public void ChangeWithMaxItems() 50 | { 51 | var target = new SizesCache(); 52 | target.AddOrChange(0, 1); 53 | target.AddOrChange(0, 1); 54 | target.AddOrChange(0, 3); 55 | target.AddOrChange(0, 3); 56 | target.AddOrChange(0, 5); 57 | target.AddOrChange(0, 7); 58 | target.AddOrChange(0, 7); 59 | target.AddOrChange(0, 9); 60 | target.AddOrChange(0, 9); 61 | target.AddOrChange(0, 11); 62 | target.AddOrChange(0, 11); 63 | target.AddOrChange(0, 11); 64 | 65 | Assert.AreEqual(11, target.GetEstimate(0)); 66 | } 67 | 68 | [TestMethod] 69 | public void CleanUpEmptyCache() 70 | { 71 | var target = new SizesCache(); 72 | target.CleanUp(0); // ShouldNotThrow 73 | } 74 | 75 | [TestMethod] 76 | public void CleanUpFilledCacheNormalCase() 77 | { 78 | var target = new SizesCache(); 79 | target.AddOrChange(0, 40); 80 | target.AddOrChange(0, 41); 81 | target.AddOrChange(0, 42); 82 | target.AddOrChange(0, 43); 83 | 84 | target.CleanUp(0); 85 | Assert.AreEqual(0, target.GetEstimate(0)); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /TreeViewEx.Test/UnitTesting/Controls/VerticalAreaTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows.Controls; 7 | using tainicom.TreeViewEx; 8 | 9 | namespace TreeViewEx.Test.Model.UnitTesting.Controls.SizesCacheTests 10 | { 11 | [TestClass] 12 | public class VerticalAreaTests 13 | { 14 | [TestMethod] 15 | public void IsWithin() 16 | { 17 | var va = new VerticalArea { Top = 100, Bottom = 200 }; 18 | Assert.IsTrue(va.IsWithin(new VerticalArea { Top = 100, Bottom = 200 })); 19 | Assert.IsTrue(va.IsWithin(new VerticalArea { Top = 110, Bottom = 200 })); 20 | Assert.IsTrue(va.IsWithin(new VerticalArea { Top = 100, Bottom = 150 })); 21 | Assert.IsTrue(va.IsWithin(new VerticalArea { Top = 150, Bottom = 250 })); 22 | Assert.IsTrue(va.IsWithin(new VerticalArea { Top = 0, Bottom = 150 })); 23 | Assert.IsTrue(va.IsWithin(new VerticalArea { Top = 0, Bottom = 300 })); 24 | 25 | 26 | Assert.IsFalse(va.IsWithin(new VerticalArea { Top = 0, Bottom = 10 })); 27 | Assert.IsFalse(va.IsWithin(new VerticalArea { Top = 250, Bottom = 300 })); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/AutoScroller.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Timers; 7 | using System.Windows; 8 | using System.Windows.Input; 9 | 10 | namespace tainicom.TreeViewEx 11 | { 12 | class AutoScroller : InputSubscriberBase 13 | { 14 | public const uint scrollBorderSize = 10; 15 | public const double scrollDelta = 30; 16 | public const uint scrollDelay = 50; 17 | Timer timer; 18 | 19 | internal bool IsEnabled { get; set; } 20 | 21 | internal override void OnMouseMove(MouseEventArgs e) 22 | { 23 | base.OnMouseMove(e); 24 | if (!IsEnabled) return; 25 | if (!IsLeftButtonDown) return; 26 | if (timer != null) return; 27 | Point position = e.GetPosition(TreeView); 28 | if (position.Y < scrollBorderSize) 29 | { 30 | //scroll down 31 | ScrollContinously(-scrollDelta); 32 | } 33 | else if ((TreeView.RenderSize.Height - position.Y) < scrollBorderSize) 34 | { 35 | //scroll up 36 | ScrollContinously(scrollDelta); 37 | } 38 | } 39 | 40 | private void ScrollContinously(double delta) 41 | { 42 | timer = new Timer(200); 43 | timer.AutoReset = true; 44 | timer.Elapsed += OnTimerElapsed; 45 | timer.Start(); //starts scrolling after given time 46 | } 47 | 48 | void OnTimerElapsed(object sender, ElapsedEventArgs e) 49 | { 50 | TreeView.Dispatcher.Invoke(new Action(() => 51 | { 52 | if (Mouse.LeftButton == MouseButtonState.Released) 53 | { 54 | timer.Elapsed -= OnTimerElapsed; 55 | timer = null; 56 | return; 57 | } 58 | 59 | Point mousePosition = GetMousePosition(); 60 | if (mousePosition.Y < scrollBorderSize) 61 | { 62 | //scroll down 63 | Scroll(-scrollDelta); 64 | } 65 | else if ((TreeView.RenderSize.Height - mousePosition.Y) < scrollBorderSize) 66 | { 67 | //scroll up 68 | Scroll(scrollDelta); 69 | } 70 | else 71 | { 72 | timer.Elapsed -= OnTimerElapsed; 73 | timer = null; 74 | } 75 | })); 76 | } 77 | 78 | internal void Scroll(double delta) 79 | { 80 | TreeView.ScrollViewer.ScrollToVerticalOffset(TreeView.ScrollViewer.VerticalOffset + delta); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/BoolToVisibilityConverterHidden.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | namespace tainicom.TreeViewEx 10 | { 11 | [ValueConversion(typeof(bool), typeof(Visibility))] 12 | public sealed class BoolToVisibilityConverterHidden : IValueConverter 13 | { 14 | public Visibility TrueValue { get; set; } 15 | public Visibility FalseValue { get; set; } 16 | 17 | public BoolToVisibilityConverterHidden() 18 | { 19 | // set defaults 20 | TrueValue = Visibility.Visible; 21 | FalseValue = Visibility.Hidden; 22 | } 23 | 24 | public object Convert(object value, Type targetType, 25 | object parameter, CultureInfo culture) 26 | { 27 | if (!(value is bool)) 28 | return null; 29 | return (bool)value ? TrueValue : FalseValue; 30 | } 31 | 32 | public object ConvertBack(object value, Type targetType, 33 | object parameter, CultureInfo culture) 34 | { 35 | if (Equals(value, TrueValue)) 36 | return true; 37 | if (Equals(value, FalseValue)) 38 | return false; 39 | return null; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/BorderSelectionAdorner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Media; 10 | 11 | namespace tainicom.TreeViewEx 12 | { 13 | class BorderSelectionAdorner : Adorner, IDisposable 14 | { 15 | Point position; 16 | AdornerLayer layer; 17 | Border border; 18 | TreeViewEx treeViewEx; 19 | 20 | // Be sure to call the base class constructor. 21 | public BorderSelectionAdorner(TreeViewEx treeViewEx) 22 | : base(treeViewEx) 23 | { 24 | this.treeViewEx = treeViewEx; 25 | this.border = new Border { BorderThickness = new Thickness(1), CornerRadius = new CornerRadius(1), Opacity = 0.5 }; 26 | 27 | Binding brushBinding = new Binding("BorderBrushSelectionRectangle"); 28 | brushBinding.Source = treeViewEx; 29 | border.SetBinding(Border.BorderBrushProperty, brushBinding); 30 | Binding backgroundBinding = new Binding("BackgroundSelectionRectangle"); 31 | backgroundBinding.Source = treeViewEx; 32 | border.SetBinding(Border.BackgroundProperty, backgroundBinding); 33 | 34 | layer = AdornerLayer.GetAdornerLayer(treeViewEx); 35 | layer.Add(this); 36 | } 37 | 38 | public void UpdatePosition(Rect position) 39 | { 40 | this.Width = position.Width; 41 | this.Height = position.Height; 42 | this.position = position.Location; 43 | layer.Update(); 44 | } 45 | 46 | public override GeneralTransform GetDesiredTransform(GeneralTransform transform) 47 | { 48 | GeneralTransformGroup result = new GeneralTransformGroup(); 49 | result.Children.Add(base.GetDesiredTransform(transform)); 50 | result.Children.Add(new TranslateTransform( 51 | position.X - treeViewEx.ScrollViewer.ContentHorizontalOffset, position.Y - treeViewEx.ScrollViewer.ContentVerticalOffset)); 52 | return result; 53 | } 54 | 55 | protected override int VisualChildrenCount 56 | { 57 | get { return 1; } 58 | } 59 | 60 | protected override Visual GetVisualChild(int index) 61 | { 62 | return border; 63 | } 64 | 65 | protected override Size MeasureOverride(Size constraint) 66 | { 67 | border.Measure(AdornedElement.RenderSize); 68 | return border.DesiredSize; 69 | } 70 | 71 | protected override Size ArrangeOverride(Size finalSize) 72 | { 73 | border.Arrange(new Rect(finalSize)); 74 | return finalSize; 75 | } 76 | 77 | public void Dispose() 78 | { 79 | if (layer != null) 80 | { 81 | layer.Remove(this); 82 | layer = null; 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/Constants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace tainicom.TreeViewEx 7 | { 8 | public static class Constants 9 | { 10 | public const int ItemIndent = 19; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/DoubleToThicknessLeftConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | 8 | namespace tainicom.TreeViewEx 9 | { 10 | public class DoubleToThicknessLeftConverter : IValueConverter 11 | { 12 | 13 | public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) 14 | { 15 | return new Thickness(System.Convert.ToDouble(value), 0, 0, 0); 16 | } 17 | 18 | public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) 19 | { 20 | return null; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/DragNDrop/CanInsertReturn.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace tainicom.TreeViewEx.DragNDrop 7 | { 8 | class CanInsertReturn 9 | { 10 | public CanInsertReturn(string format, int index, bool before) 11 | { 12 | Format = format; 13 | Index = index; 14 | Before = before; 15 | } 16 | 17 | public string Format { get; set; } 18 | 19 | public int Index { get; set; } 20 | 21 | public bool Before { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/DragNDrop/DragParameters.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Windows; 3 | using System.Windows.Input; 4 | 5 | namespace tainicom.TreeViewEx.DragNDrop 6 | { 7 | public class CanDragParameters 8 | { 9 | public readonly IEnumerable Items; 10 | public readonly Point Position; 11 | public readonly MouseButton Button; 12 | 13 | internal CanDragParameters(IEnumerable draggableItems, Point dragPosition, MouseButton mouseButton) 14 | { 15 | this.Items = draggableItems; 16 | this.Position = dragPosition; 17 | this.Button = mouseButton; 18 | } 19 | } 20 | 21 | public class DragParameters 22 | { 23 | public readonly IDataObject Data = new DataObject(); 24 | public readonly IEnumerable Items; 25 | public readonly Point Position; 26 | public readonly MouseButton Button; 27 | 28 | public DragDropEffects AllowedEffects = DragDropEffects.All; 29 | 30 | internal DragParameters(IEnumerable draggableItems, Point dragPosition, MouseButton mouseButton) 31 | { 32 | this.Items = draggableItems; 33 | this.Position = dragPosition; 34 | this.Button = mouseButton; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/DragNDrop/DropParameters.cs: -------------------------------------------------------------------------------- 1 |  2 | using System.Windows; 3 | namespace tainicom.TreeViewEx.DragNDrop 4 | { 5 | public class DropParameters 6 | { 7 | public readonly TreeViewExItem DropToItem; 8 | public readonly IDataObject Data; 9 | public readonly int Index; 10 | 11 | public DropParameters(TreeViewExItem dropToItem, IDataObject data): this(dropToItem, data, -1) 12 | { 13 | } 14 | 15 | public DropParameters(TreeViewExItem dropToItem, IDataObject data, int index) 16 | { 17 | this.DropToItem = dropToItem; 18 | this.Data = data; 19 | this.Index = index; 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/DragNDrop/InsertContent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Media; 7 | 8 | namespace tainicom.TreeViewEx.DragNDrop 9 | { 10 | class InsertContent 11 | { 12 | public bool Before { get; set; } 13 | 14 | public Point Position { get; set; } 15 | 16 | public Brush InsertionMarkerBrush { get; set; } 17 | 18 | public TreeViewExItem Item { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/EditTextBox.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Data; 4 | using System.Windows.Input; 5 | 6 | namespace tainicom.TreeViewEx 7 | { 8 | /// 9 | /// Text box which focuses itself on load and selects all text in it. 10 | /// 11 | public class EditTextBox : TextBox 12 | { 13 | #region Constants and Fields 14 | 15 | private string startText; 16 | 17 | #endregion 18 | 19 | #region Constructors and Destructors 20 | 21 | static EditTextBox() 22 | { 23 | DefaultStyleKeyProperty.OverrideMetadata(typeof(EditTextBox), new FrameworkPropertyMetadata(typeof(EditTextBox))); 24 | } 25 | 26 | public EditTextBox() 27 | { 28 | Loaded += OnTreeViewExEditTextBoxLoaded; 29 | } 30 | 31 | #endregion 32 | 33 | #region Methods 34 | 35 | protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e) 36 | { 37 | base.OnGotKeyboardFocus(e); 38 | startText = Text; 39 | SelectAll(); 40 | } 41 | 42 | protected override void OnKeyDown(KeyEventArgs e) 43 | { 44 | base.OnKeyDown(e); 45 | if (!e.Handled) 46 | { 47 | Key key = e.Key; 48 | switch (key) 49 | { 50 | case Key.Escape: 51 | Text = startText; 52 | break; 53 | } 54 | } 55 | } 56 | 57 | protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e) 58 | { 59 | BindingExpression bindingExpression = GetBindingExpression(TextProperty); 60 | if (bindingExpression != null) 61 | bindingExpression.UpdateSource(); 62 | } 63 | 64 | private void OnTreeViewExEditTextBoxLoaded(object sender, RoutedEventArgs e) 65 | { 66 | BindingExpression be = GetBindingExpression(TextProperty); 67 | if (be != null) be.UpdateTarget(); 68 | FocusHelper.Focus(this); 69 | } 70 | 71 | #endregion 72 | } 73 | } -------------------------------------------------------------------------------- /TreeViewEx/Controls/FocusHelper.cs: -------------------------------------------------------------------------------- 1 | namespace tainicom.TreeViewEx 2 | { 3 | #region 4 | 5 | using System.Threading; 6 | using System.Windows; 7 | using System.Windows.Threading; 8 | using System.Diagnostics; 9 | 10 | #endregion 11 | 12 | /// 13 | /// Helper methods to focus. 14 | /// 15 | public static class FocusHelper 16 | { 17 | #region Public Methods 18 | 19 | public static void Focus(EditTextBox element) 20 | { 21 | //System.Diagnostics.Debug.WriteLine("Focus textbox with helper:" + element.Text); 22 | FocusCore(element); 23 | } 24 | 25 | public static void Focus(TreeViewExItem element) 26 | { 27 | // System.Diagnostics.Debug.WriteLine("Focus with helper item: " + element.DataContext); 28 | FocusCore(element); 29 | } 30 | 31 | public static void Focus(TreeViewEx element) 32 | { 33 | //System.Diagnostics.Debug.WriteLine("Focus Tree with helper"); 34 | FocusCore(element); 35 | } 36 | 37 | private static void FocusCore(FrameworkElement element) 38 | { 39 | // System.Diagnostics.Debug.WriteLine("Focus core: " + element.DataContext); 40 | if (!element.Focus()) 41 | { 42 | element.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => element.Focus())); 43 | } 44 | 45 | #if DEBUG 46 | // no good idea, seems to block sometimes 47 | int i = 0; 48 | while (i < 5) 49 | { 50 | if (element.IsFocused) return; 51 | Thread.Sleep(100); 52 | i++; 53 | } 54 | if (i >= 5) 55 | { 56 | } 57 | #endif 58 | } 59 | 60 | #endregion 61 | } 62 | } -------------------------------------------------------------------------------- /TreeViewEx/Controls/IProvideStackingSize.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace tainicom.TreeViewEx 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/ISelectionStrategy.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | namespace tainicom.TreeViewEx 3 | { 4 | /// 5 | /// TODO: Update summary. 6 | /// 7 | internal interface ISelectionStrategy 8 | { 9 | void SelectFromUiAutomation(TreeViewExItem item); 10 | 11 | void SelectPreviousFromKey(); 12 | 13 | void SelectNextFromKey(); 14 | 15 | void SelectCurrentBySpace(); 16 | 17 | void SelectFromProperty(TreeViewExItem item, bool isSelected); 18 | 19 | void SelectFirst(); 20 | 21 | void SelectLast(); 22 | 23 | void ClearObsoleteItems(IEnumerable items); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/InputEventRouter.cs: -------------------------------------------------------------------------------- 1 | namespace tainicom.TreeViewEx 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Reflection; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Input; 10 | 11 | internal class InputEventRouter : IDisposable 12 | { 13 | protected TreeViewEx treeView; 14 | 15 | private List inputSubscribers; 16 | 17 | private bool isLeftMouseButtonDown; 18 | 19 | private Point mouseDownPoint; 20 | 21 | public InputEventRouter(TreeViewEx treeView) 22 | { 23 | inputSubscribers = new List(2); 24 | this.treeView = treeView; 25 | 26 | treeView.MouseDown += OnMouseDown; 27 | treeView.MouseMove += OnMouseMove; 28 | treeView.MouseUp += OnMouseUp; 29 | treeView.ScrollViewer.ScrollChanged += OnScrollChanged; 30 | } 31 | 32 | void OnScrollChanged(object sender, ScrollChangedEventArgs e) 33 | { 34 | Call("OnScrollChanged", e); 35 | } 36 | 37 | internal void Add(InputSubscriberBase inputSubscriber) 38 | { 39 | inputSubscriber.TreeView = treeView; 40 | inputSubscribers.Add(inputSubscriber); 41 | inputSubscriber.Initialized(); 42 | } 43 | 44 | private void OnMouseDown(object sender, MouseButtonEventArgs e) 45 | { 46 | Mouse.Capture(treeView, CaptureMode.SubTree); 47 | isLeftMouseButtonDown = true; 48 | mouseDownPoint = e.GetPosition(treeView); 49 | Call("OnMouseDown", e); 50 | } 51 | 52 | private void Call(string methodName, object e) 53 | { 54 | foreach (var inputSubscriber in inputSubscribers) 55 | { 56 | // initialize provider 57 | inputSubscriber.IsLeftButtonDown = isLeftMouseButtonDown; 58 | 59 | // Debug.WriteLine("Calling " + methodName + " on " + inputSubscriber.GetType()); 60 | MethodInfo methodInfo = typeof(InputSubscriberBase).GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance); 61 | methodInfo.Invoke(inputSubscriber, new object[] { e }); 62 | 63 | RoutedEventArgs re = e as RoutedEventArgs; 64 | if (re != null && re.Handled) break; 65 | } 66 | 67 | // Debug.WriteLine(DateTime.Now.Millisecond + " -----------------------------"); 68 | } 69 | 70 | private void OnMouseMove(object sender, MouseEventArgs e) 71 | { 72 | isLeftMouseButtonDown = e.LeftButton == MouseButtonState.Pressed; 73 | Call("OnMouseMove", e); 74 | } 75 | 76 | private void OnMouseUp(object sender, MouseButtonEventArgs e) 77 | { 78 | Call("OnMouseUp", e); 79 | isLeftMouseButtonDown = false; 80 | Mouse.Capture(null); 81 | } 82 | 83 | public void Dispose() 84 | { 85 | if (treeView != null) 86 | { 87 | treeView.MouseDown -= OnMouseDown; 88 | treeView.MouseMove -= OnMouseMove; 89 | treeView.MouseUp -= OnMouseUp; 90 | treeView.ScrollViewer.ScrollChanged -= OnScrollChanged; 91 | 92 | treeView = null; 93 | } 94 | 95 | if (inputSubscribers != null) 96 | { 97 | inputSubscribers.Clear(); 98 | inputSubscribers = null; 99 | } 100 | 101 | GC.SuppressFinalize(this); 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/InputSubscriberBase.cs: -------------------------------------------------------------------------------- 1 | namespace tainicom.TreeViewEx 2 | { 3 | using System.Diagnostics; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using tainicom.TreeViewEx.DragNDrop; 7 | using System.Windows.Documents; 8 | using System.Windows.Input; 9 | using System.Windows.Media; 10 | 11 | /// 12 | /// Base for a class, which wants to be provided with mouse events. 13 | /// 14 | internal class InputSubscriberBase 15 | { 16 | protected internal bool IsLeftButtonDown { get; set; } 17 | 18 | internal virtual void Initialized() 19 | { 20 | } 21 | 22 | internal virtual void OnScrollChanged(ScrollChangedEventArgs e) 23 | { 24 | } 25 | 26 | internal virtual void OnMouseDown(MouseButtonEventArgs e) 27 | { 28 | } 29 | 30 | internal virtual void OnMouseUp(MouseButtonEventArgs e) 31 | { 32 | } 33 | 34 | internal virtual void OnMouseMove(MouseEventArgs e) 35 | { 36 | } 37 | 38 | internal Point GetMousePosition() 39 | { 40 | Point currentPoint = Mouse.GetPosition(TreeView); 41 | return currentPoint; 42 | } 43 | 44 | internal Point GetMousePositionRelativeToContent() 45 | { 46 | Point currentPoint = Mouse.GetPosition(TreeView); 47 | 48 | currentPoint = new Point(currentPoint.X + TreeView.ScrollViewer.ContentHorizontalOffset, currentPoint.Y + TreeView.ScrollViewer.ContentVerticalOffset); 49 | return currentPoint; 50 | } 51 | 52 | protected bool IsMouseOverAdorner(Point positionRelativeToTree) 53 | { 54 | HitTestResult hitTestResult = VisualTreeHelper.HitTest(TreeView, positionRelativeToTree); 55 | if (hitTestResult == null || hitTestResult.VisualHit == null) return false; 56 | 57 | Adorner item = null; 58 | DependencyObject currentObject = hitTestResult.VisualHit; 59 | 60 | while (item == null && currentObject != null) 61 | { 62 | item = currentObject as Adorner; 63 | if (item != null) return true; 64 | 65 | currentObject = VisualTreeHelper.GetParent(currentObject); 66 | } 67 | 68 | return false; 69 | } 70 | 71 | protected TreeViewExItem GetTreeViewItemUnderMouse(Point positionRelativeToTree) 72 | { 73 | HitTestResult hitTestResult = VisualTreeHelper.HitTest(TreeView, positionRelativeToTree); 74 | if (hitTestResult == null || hitTestResult.VisualHit == null) return null; 75 | 76 | FrameworkElement child = hitTestResult.VisualHit as FrameworkElement; 77 | 78 | do 79 | { 80 | if (child is TreeViewExItem) return GetVisible(child as TreeViewExItem); 81 | if (child.DataContext is InsertContent) return GetVisible((child.DataContext as InsertContent).Item); 82 | if (child is TreeViewEx) return null; 83 | child = VisualTreeHelper.GetParent(child) as FrameworkElement; 84 | } while (child != null); 85 | 86 | return null; 87 | } 88 | 89 | private TreeViewExItem GetVisible(TreeViewExItem treeViewExItem) 90 | { 91 | if (treeViewExItem.IsVisible) return treeViewExItem; 92 | return null; 93 | } 94 | 95 | internal protected TreeViewEx TreeView { get; internal set; } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/IsEditingManager.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 tainicom.TreeViewEx 8 | { 9 | class IsEditingManager:InputSubscriberBase 10 | { 11 | TreeViewEx treeview; 12 | TreeViewExItem editedItem; 13 | 14 | public IsEditingManager(TreeViewEx treeview) 15 | { 16 | this.treeview = treeview; 17 | } 18 | 19 | internal override void OnMouseDown(MouseButtonEventArgs e) 20 | { 21 | base.OnMouseDown(e); 22 | StopEditing(); 23 | } 24 | 25 | public void StartEditing(TreeViewExItem item) 26 | { 27 | StopEditing(); 28 | editedItem = item; 29 | editedItem.IsEditing = true; 30 | } 31 | 32 | internal void StopEditing() 33 | { 34 | if (editedItem == null) return; 35 | 36 | Keyboard.Focus(editedItem); 37 | editedItem.IsEditing = false; 38 | FocusHelper.Focus(editedItem); 39 | editedItem = null; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/ItemWrapper.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.Collections.Generic; 3 | //using System.Linq; 4 | //using System.Text; 5 | 6 | //namespace tainicom.TreeViewEx 7 | //{ 8 | // internal class ItemWrapper 9 | // { 10 | // public object Data { get; set; } 11 | // public TreeViewExItem ParentItem { get; set; } 12 | // public TreeViewExItem Item { get; set; } 13 | 14 | // public int IndexInParent { get; set; } 15 | // } 16 | //} 17 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/MethodBinding.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Text; 7 | using System.Windows.Data; 8 | using System.Windows.Markup; 9 | 10 | namespace tainicom.TreeViewEx 11 | { 12 | public class MethodBinding : Binding 13 | { 14 | class MethodConverter : IValueConverter 15 | { 16 | string methodName; 17 | 18 | public MethodConverter(string methodName) 19 | { 20 | this.methodName = methodName; 21 | } 22 | 23 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 24 | { 25 | // I do use reflection for this. Another way would be to force the viewModel to implement sth like 26 | // IDragSource and IDropTarget. Then I could cast and return the method. Would probably be more 27 | // performant, but we force the viewmodel to reference an controls assembly. Lets try this code 28 | // until someone dont likes it. ;o) 29 | var mi = value.GetType().GetMethod(methodName, BindingFlags.Public | BindingFlags.Instance); 30 | if (mi == null) 31 | { 32 | throw new InvalidOperationException("Could not find method with name '" + methodName + "' on type '" + value.GetType() + "'."); 33 | } 34 | 35 | if (targetType == typeof(Func)) 36 | { 37 | return new Func(x => (bool)mi.Invoke(value, new object[] { x })); 38 | } 39 | else if (targetType == typeof(Func)) 40 | { 41 | return new Func((i, x) => (bool)mi.Invoke(value, new object[] { i, x })); 42 | } 43 | else if (targetType == typeof(Func)) 44 | { 45 | return new Func(s => (bool)mi.Invoke(value, new object[] { s })); 46 | } 47 | else if (targetType == typeof(Func)) 48 | { 49 | return new Func((i, s) => (bool)mi.Invoke(value, new object[] { i, s })); 50 | } 51 | else if (targetType == typeof(Action)) 52 | { 53 | return new Action(x => mi.Invoke(value, new object[] { x })); 54 | } 55 | else if (targetType == typeof(Action)) 56 | { 57 | return new Action((i, x) => mi.Invoke(value, new object[] { i, x })); 58 | } 59 | else if (targetType == typeof(Func)) 60 | { 61 | return new Func(() => (bool)mi.Invoke(value, new object[] { })); 62 | } 63 | else if (targetType == typeof(Func)) 64 | { 65 | return new Func(() => mi.Invoke(value, null)); 66 | } 67 | 68 | return null; 69 | } 70 | 71 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 72 | { 73 | throw new NotImplementedException(); 74 | } 75 | } 76 | 77 | public MethodBinding(string methodName) 78 | { 79 | Converter = new MethodConverter(methodName); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/SelectionChangedCancelEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ComponentModel; 6 | 7 | namespace tainicom.TreeViewEx 8 | { 9 | public class SelectionChangedCancelEventArgs : CancelEventArgs 10 | { 11 | public IEnumerable ItemsToUnSelect { get; private set; } 12 | public IEnumerable ItemsToSelect { get; private set; } 13 | 14 | public SelectionChangedCancelEventArgs(IEnumerable itemsToSelect, IEnumerable itemsToUnSelect) 15 | { 16 | ItemsToSelect = itemsToSelect; 17 | ItemsToUnSelect = itemsToUnSelect; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/SelectionSingle.cs: -------------------------------------------------------------------------------- 1 | namespace tainicom.TreeViewEx 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | /// 9 | /// TODO: Update summary. 10 | /// 11 | public class SelectionSingle 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /TreeViewEx/Controls/VerticalArea.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace tainicom.TreeViewEx 7 | { 8 | class VerticalArea 9 | { 10 | public double Top { get; set; } 11 | public double Bottom { get; set; } 12 | 13 | public bool IsWithin(VerticalArea area) 14 | { 15 | return 16 | (area.Top >= Top && area.Top <= Bottom) 17 | || 18 | (area.Bottom >= Top && area.Bottom <= Bottom) 19 | || 20 | (area.Top<= Top && area.Bottom >= Bottom); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /TreeViewEx/Core/DummyConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Windows.Data; 8 | 9 | namespace tainicom.TreeViewEx.Core 10 | { 11 | public class DummyConverter:IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | Debug.WriteLine("DummyConverter->Convert: " + value); 16 | return value; 17 | } 18 | 19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 20 | { 21 | return value; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /TreeViewEx/Core/IEnumerableExtenstions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace System.Collections 7 | { 8 | public static class IEnumerableExtensions 9 | { 10 | public static void AddOrInsert(this IList list, int index, object data) 11 | { 12 | if (index < list.Count) 13 | { 14 | list.Insert(index, data); 15 | } 16 | else 17 | { 18 | list.Add(data); 19 | } 20 | } 21 | 22 | public static int Count(this IEnumerable enumerable) 23 | { 24 | ICollection collection = enumerable as ICollection; 25 | if (collection != null) 26 | { 27 | return collection.Count; 28 | } 29 | 30 | int counter = 0; 31 | foreach (var item in enumerable) 32 | { 33 | counter++; 34 | } 35 | return counter; 36 | } 37 | 38 | public static object ElementAt(this IEnumerable enumerable, int index) 39 | { 40 | IList list = enumerable as IList; 41 | if (list != null) 42 | { 43 | return list[index]; 44 | } 45 | 46 | int counter = 0; 47 | foreach (var item in enumerable) 48 | { 49 | if (counter == index) return item; 50 | counter++; 51 | } 52 | 53 | throw new ArgumentOutOfRangeException("A item at the specified index was not found."); 54 | } 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /TreeViewEx/Nuget/TreeViewEx.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | TreeViewEx 5 | TreeViewEx 6 | 0.1.0.0 7 | Goroll 8 | Goroll 9 | http://treeviewex.codeplex.com/license 10 | http://treeviewex.codeplex.com/ 11 | true 12 | A tree view supporting multi select. 13 | Copyright 2012 14 | nuget wpf treeview tree control 15 | 16 | -------------------------------------------------------------------------------- /TreeViewEx/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 | [assembly: AssemblyVersion("1.0.0.0")] 8 | [assembly: AssemblyFileVersion("3.0.0.0")] 9 | 10 | 11 | // General Information about an assembly is controlled through the following 12 | // set of attributes. Change these attribute values to modify the information 13 | // associated with an assembly. 14 | [assembly: InternalsVisibleTo("TreeViewEx.Test,PublicKey=" 15 | + "002400000480000094000000060200000024000052534131000400000100010035833343f8533b" 16 | + "82ef2ba1c6c2d71d289456655c7ccbb0647d861d0259d58bf0dd98f92cd9ea40618b5ed4b8729b" 17 | + "9fcde9303efff3ab483057078d89598ea542edea150340e0f842a99aa7585cec36ded398f9121e" 18 | + "b0c19b6ef7791ac7b53940fce9bd04ae225097b69e7354da663168ddc415216903ac68a5d2698b" 19 | + "0dd9edc1")] 20 | [assembly: AssemblyTitle("TreeViewEx")] 21 | [assembly: AssemblyDescription("Library for a multi select TreeView")] 22 | [assembly: AssemblyConfiguration("Release")] 23 | [assembly: AssemblyCompany("-")] 24 | [assembly: AssemblyProduct("TreeViewEx")] 25 | [assembly: AssemblyCopyright("Copyright © Goroll 2012")] 26 | [assembly: AssemblyTrademark("")] 27 | [assembly: AssemblyCulture("")] 28 | [assembly: ComVisible(false)] 29 | [assembly: ThemeInfo( 30 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 31 | //(used if a resource is not found in the page, 32 | // or application resource dictionaries) 33 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 34 | //(used if a resource is not found in the page, 35 | // app, or any theme specific resource dictionaries) 36 | )] 37 | -------------------------------------------------------------------------------- /TreeViewEx/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 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 tainicom.TreeViewEx.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("tainicom.TreeViewEx.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 | -------------------------------------------------------------------------------- /TreeViewEx/key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tainicom/TreeViewEx/b445ec37cffd6a564ab4249392b8172358016c2b/TreeViewEx/key.snk -------------------------------------------------------------------------------- /TreeViewEx/themes/EditTextBox.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 39 | -------------------------------------------------------------------------------- /TreeViewEx/themes/Generic.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TreeViewEx/themes/SystemColors.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 30 | 31 | -------------------------------------------------------------------------------- /TreeViewEx/tools/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tainicom/TreeViewEx/b445ec37cffd6a564ab4249392b8172358016c2b/TreeViewEx/tools/NuGet.exe --------------------------------------------------------------------------------