├── .gitignore
├── 00_Docu
├── 00_Docu
│ ├── EditOverlay
│ │ ├── Step1.png
│ │ ├── Step2.png
│ │ ├── Step3.png
│ │ └── Step4_Result.png
│ ├── ErrorHandling
│ │ └── PopUpMessage.png
│ └── SpaceLimits
│ │ ├── Step1.png
│ │ ├── Step2.png
│ │ ├── Step3.png
│ │ ├── Step4.png
│ │ └── Step5_Result.png
└── screenshot.png
├── LICENSE
├── README.md
├── SwitchToDesignMode_64x.png
├── appveyor.yml
└── source
├── CleanAll.bat
├── InPlaceEditBoxDemo
├── App.xaml
├── App.xaml.cs
├── Behaviours
│ ├── TreeViewItemBehaviour.cs
│ ├── TreeViewSelectionChangedBehavior.cs
│ └── TreeViewVirtualItemBehaviour.cs
├── Converters
│ └── BoolToVisibilityConverter.cs
├── Demo
│ ├── Create.cs
│ └── CreateTestObject.cs
├── InPlaceEditBoxDemo.csproj
├── InPlaceEditBoxDemo.csproj.user
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── ViewModels
│ ├── AppViewModel.cs
│ ├── Base
│ │ ├── BaseViewModel.cs
│ │ └── RelayCommand.cs
│ └── ViewModelModelConverter.cs
└── converters
│ ├── ISolutionItemItemTypeToTupleConverter.cs
│ └── ItemTypeDisplayNameToTextConverter.cs
├── InPlaceEditTextBoxDemo.sln
├── InplaceEditBoxLib
├── AssemblyInfo.cs
├── Events
│ └── EditEvent.cs
├── InplaceEditBoxLib.csproj
├── InplaceEditBoxLib.csproj.user
├── Interfaces
│ └── IEditBox.cs
├── Local
│ ├── Strings.Designer.cs
│ ├── Strings.pt-PTresx
│ └── Strings.resx
├── Themes
│ ├── DarkBrushs.xaml
│ ├── Generic.xaml
│ ├── LightBrushs.xaml
│ └── ResourceKeys.cs
├── ViewModels
│ ├── Base
│ │ └── ViewModelBase.cs
│ └── EditInPlaceViewModel.cs
└── Views
│ ├── Attach.cs
│ ├── BindingProxy.cs
│ ├── EditBox.xaml
│ ├── EditBox.xaml.cs
│ └── EditBoxAdorner.cs
├── Services
├── ExplorerLib
│ ├── Explorer.cs
│ ├── ExplorerLib.csproj
│ ├── ExplorerMultiFileResult.cs
│ ├── ExplorerResult.cs
│ ├── IExplorer.cs
│ ├── IExplorerMultiFileResult.cs
│ ├── IExplorerResult.cs
│ └── Local
│ │ ├── Strings.Designer.cs
│ │ └── Strings.resx
└── ServiceLocator
│ ├── ServiceContainer.cs
│ ├── ServiceInjector.cs
│ └── ServiceLocator.csproj
└── Solution
├── SolutionLib
├── Converters
│ ├── ISolutionBaseItemToImageConverter.cs
│ └── InvertedBooleanToVisibilityConverter.cs
├── Factory.cs
├── Interfaces
│ ├── IFile.cs
│ ├── IFolder.cs
│ ├── IItem.cs
│ ├── IItemChildren.cs
│ ├── IParent.cs
│ ├── IProject.cs
│ ├── ISolution.cs
│ ├── ISolutionRootItem.cs
│ └── IViewModelBase.cs
├── Models
│ └── SolutionItemType.cs
├── Resources
│ ├── Files
│ │ └── Light
│ │ │ ├── Document_128x.png
│ │ │ ├── Document_16x.png
│ │ │ ├── Document_16x.xaml
│ │ │ ├── Document_24x..png
│ │ │ ├── Document_24x.xaml
│ │ │ ├── Document_256x.png
│ │ │ ├── Document_256x.xaml
│ │ │ ├── Document_32x.png
│ │ │ ├── Document_32x.xaml
│ │ │ ├── Document_48x.png
│ │ │ ├── Document_48x.xaml
│ │ │ ├── Document_64x.png
│ │ │ └── Document_64x.xaml
│ ├── Folders
│ │ └── Light
│ │ │ ├── FolderOpen_128x.png
│ │ │ ├── FolderOpen_256x.png
│ │ │ ├── FolderOpen_256x.xaml
│ │ │ ├── FolderOpen_32x.png
│ │ │ ├── FolderOpen_32x.xaml
│ │ │ ├── FolderOpen_32xLG.png
│ │ │ ├── FolderOpen_32xLG.xaml
│ │ │ ├── FolderOpen_32xMD.png
│ │ │ ├── FolderOpen_32xMD.xaml
│ │ │ ├── FolderOpen_32xSM.png
│ │ │ ├── FolderOpen_32xSM.xaml
│ │ │ ├── FolderOpen_48x.png
│ │ │ ├── FolderOpen_48x.xaml
│ │ │ ├── FolderOpen_64x.png
│ │ │ ├── FolderOpen_64x.xaml
│ │ │ ├── Folder_128x.png
│ │ │ ├── Folder_256x.png
│ │ │ ├── Folder_256x.xaml
│ │ │ ├── Folder_25x.png
│ │ │ ├── Folder_25x.xaml
│ │ │ ├── Folder_32x.png
│ │ │ ├── Folder_32x.xaml
│ │ │ ├── Folder_32xLG.png
│ │ │ ├── Folder_32xLG.xaml
│ │ │ ├── Folder_32xMD.png
│ │ │ ├── Folder_32xMD.xaml
│ │ │ ├── Folder_32xSM.png
│ │ │ ├── Folder_32xSM.xaml
│ │ │ ├── Folder_48x.png
│ │ │ ├── Folder_48x.xaml
│ │ │ ├── Folder_64x.png
│ │ │ └── Folder_64x.xaml
│ ├── LightIcons.xaml
│ ├── Projects
│ │ └── Light
│ │ │ ├── Application_128x.png
│ │ │ ├── Application_12x.png
│ │ │ ├── Application_12x.xaml
│ │ │ ├── Application_16x.png
│ │ │ ├── Application_16x.xaml
│ │ │ ├── Application_256x.png
│ │ │ ├── Application_256x.xaml
│ │ │ ├── Application_32x.png
│ │ │ ├── Application_32x.xaml
│ │ │ ├── Application_64x.png
│ │ │ └── Application_64x.xaml
│ └── Solutions
│ │ └── Light
│ │ ├── AppFlyout_128x.png
│ │ ├── AppFlyout_12x.png
│ │ ├── AppFlyout_12x.xaml
│ │ ├── AppFlyout_16x.png
│ │ ├── AppFlyout_16x.xaml
│ │ ├── AppFlyout_256x.png
│ │ ├── AppFlyout_256x.xaml
│ │ ├── AppFlyout_32x.png
│ │ ├── AppFlyout_32x.xaml
│ │ ├── AppFlyout_48x.png
│ │ ├── AppFlyout_48x.xaml
│ │ ├── AppFlyout_64x.png
│ │ └── AppFlyout_64x.xaml
├── SolutionLib.csproj
├── Themes
│ └── Generic.xaml
├── ViewModels
│ ├── Base
│ │ ├── BaseViewModel.cs
│ │ └── RelayCommand.cs
│ ├── Browser
│ │ ├── Base
│ │ │ ├── ItemChildrenViewModel.cs
│ │ │ └── ItemViewModel.cs
│ │ ├── FileViewModel.cs
│ │ ├── FolderViewModel.cs
│ │ ├── ProjectViewModel.cs
│ │ ├── SolutionRootItemViewModel.cs
│ │ └── SolutionViewModel.cs
│ └── Collections
│ │ ├── SortableObservableCollection.cs
│ │ └── SortableObservableDictionaryCollection.cs
└── Views
│ └── TreeViewItemSelector.cs
└── SolutionLibModels
├── Enums
└── SolutionItemType.cs
├── Factory.cs
├── Interfaces
├── IFileItemModel.cs
├── IFolderItemModel .cs
├── IItemChildrenModel.cs
├── IItemModel.cs
├── IModelBase.cs
├── IProjectItemModel.cs
├── ISolutionModel.cs
└── ISolutionRootItemModel.cs
├── Models
├── Base
│ ├── ItemChildrenModel.cs
│ └── ItemModel.cs
├── FileItemModel.cs
├── FolderItemModel.cs
├── ProjectItemModel.cs
├── SolutionModel.cs
└── SolutionRootItemModel.cs
├── SQLite
├── JournalMode.cs
├── SQLiteDatabase.cs
└── SolutionDB.cs
├── SolutionLibModels.csproj
└── Xml
└── Storage.cs
/.gitignore:
--------------------------------------------------------------------------------
1 | source/packages/
2 | packages/
3 | 00_Release/
4 | 01_Nuget/
5 | 02_SamplesData/
6 | debug/
7 | release/
8 | build/
9 | bin/
10 | obj/
11 | cache/
12 | log/
13 | tmp/
14 | /source/.vs/
15 | .vs/
16 |
17 | *~
18 | *.lock
19 | *.DS_Store
20 | *.swp
21 | *.out
22 | *.sou
23 | *.suo
24 | *.sqlite
25 |
--------------------------------------------------------------------------------
/00_Docu/00_Docu/EditOverlay/Step1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/00_Docu/00_Docu/EditOverlay/Step1.png
--------------------------------------------------------------------------------
/00_Docu/00_Docu/EditOverlay/Step2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/00_Docu/00_Docu/EditOverlay/Step2.png
--------------------------------------------------------------------------------
/00_Docu/00_Docu/EditOverlay/Step3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/00_Docu/00_Docu/EditOverlay/Step3.png
--------------------------------------------------------------------------------
/00_Docu/00_Docu/EditOverlay/Step4_Result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/00_Docu/00_Docu/EditOverlay/Step4_Result.png
--------------------------------------------------------------------------------
/00_Docu/00_Docu/ErrorHandling/PopUpMessage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/00_Docu/00_Docu/ErrorHandling/PopUpMessage.png
--------------------------------------------------------------------------------
/00_Docu/00_Docu/SpaceLimits/Step1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/00_Docu/00_Docu/SpaceLimits/Step1.png
--------------------------------------------------------------------------------
/00_Docu/00_Docu/SpaceLimits/Step2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/00_Docu/00_Docu/SpaceLimits/Step2.png
--------------------------------------------------------------------------------
/00_Docu/00_Docu/SpaceLimits/Step3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/00_Docu/00_Docu/SpaceLimits/Step3.png
--------------------------------------------------------------------------------
/00_Docu/00_Docu/SpaceLimits/Step4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/00_Docu/00_Docu/SpaceLimits/Step4.png
--------------------------------------------------------------------------------
/00_Docu/00_Docu/SpaceLimits/Step5_Result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/00_Docu/00_Docu/SpaceLimits/Step5_Result.png
--------------------------------------------------------------------------------
/00_Docu/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/00_Docu/screenshot.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Dirkster99
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/SwitchToDesignMode_64x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dirkster99/InplaceEditBoxLib/d987f597c4d713a6238a872393609aa9d00b4177/SwitchToDesignMode_64x.png
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 1.4.{build}
2 |
3 | configuration: Release
4 |
5 | platform: Any CPU
6 |
7 | image: Visual Studio 2019 Preview
8 |
9 | install:
10 | - cmd: choco install dotnetcore-sdk --pre
11 |
12 | before_build:
13 | - cmd: nuget restore source\InPlaceEditTextBoxDemo.sln
14 |
15 | build:
16 | verbosity: minimal
17 |
18 | artifacts:
19 | - path: source\InPlaceEditBoxDemo\bin\Release
20 | name: InPlaceEditBoxDemo
21 |
22 | - path: source\InplaceEditBoxLib\bin\Release
23 | name: InplaceEditBoxLib
24 |
--------------------------------------------------------------------------------
/source/CleanAll.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 | pushd "%~dp0"
3 | ECHO.
4 | ECHO.
5 | ECHO This script deletes all temporary build files in their
6 | ECHO corresponding BIN and OBJ Folder contained in the following projects
7 | ECHO.
8 | ECHO InPlaceEditBoxDemo
9 | ECHO InplaceEditBoxLib
10 | ECHO Solution\SolutionLib
11 | ECHO Solution\SolutionLibModels
12 | ECHO Services\ExplorerLib
13 | ECHO Services\ServiceLocator
14 | ECHO.
15 | REM Ask the user if hes really sure to continue beyond this point XXXXXXXX
16 | set /p choice=Are you sure to continue (Y/N)?
17 | if not '%choice%'=='Y' Goto EndOfBatch
18 | REM Script does not continue unless user types 'Y' in upper case letter
19 | ECHO.
20 | ECHO XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
21 | ECHO.
22 | ECHO XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
23 |
24 | ECHO.
25 | ECHO Deleting .vs and BIN, OBJ Folders in project folder
26 | ECHO.
27 | RMDIR .vs /S /Q
28 |
29 | RMDIR /S /Q InPlaceEditBoxDemo\bin
30 | RMDIR /S /Q InPlaceEditBoxDemo\obj
31 |
32 | RMDIR /S /Q InplaceEditBoxLib\bin
33 | RMDIR /S /Q InplaceEditBoxLib\obj
34 |
35 | RMDIR /S /Q Solution\SolutionLib\bin
36 | RMDIR /S /Q Solution\SolutionLib\obj
37 |
38 | RMDIR /S /Q Solution\SolutionLibModels\bin
39 | RMDIR /S /Q Solution\SolutionLibModels\obj
40 |
41 | RMDIR /S /Q Services\ExplorerLib\bin
42 | RMDIR /S /Q Services\ExplorerLib\obj
43 |
44 | RMDIR /S /Q Services\ServiceLocator\bin
45 | RMDIR /S /Q Services\ServiceLocator\obj
46 |
47 | PAUSE
48 |
49 | :EndOfBatch
50 |
--------------------------------------------------------------------------------
/source/InPlaceEditBoxDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/source/InPlaceEditBoxDemo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace InPlaceEditBoxDemo
2 | {
3 | using System.Windows;
4 |
5 | ///
6 | /// Interaction logic for App.xaml
7 | ///
8 | public partial class App : Application
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/source/InPlaceEditBoxDemo/Behaviours/TreeViewItemBehaviour.cs:
--------------------------------------------------------------------------------
1 | namespace InPlaceEditBoxDemo.Behaviours
2 | {
3 | using System.ComponentModel;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 |
7 | ///
8 | /// Class implements an attached behaviour to bring a selected TreeViewItem
9 | /// into view when selection is driven by the viewmodel (not the user).
10 | ///
11 | /// Sample Usage:
12 | /// <TreeView.ItemContainerStyle>
13 | /// <Style TargetType="{x:Type TreeViewItem}">
14 | /// <Setter Property="behav:TreeViewItemBehaviour.IsBroughtIntoViewWhenSelected" Value="True" />
15 | /// <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
16 | /// <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
17 | ///
18 | /// <!-- Setter Property="FontWeight" Value="Normal" />
19 | /// <Style.Triggers>
20 | /// <Trigger Property="IsSelected" Value="True">
21 | /// <Setter Property="FontWeight" Value="Bold" />
22 | /// </Trigger>
23 | /// </Style.Triggers -->
24 | /// </Style>
25 | /// </TreeView.ItemContainerStyle>
26 | ///
27 | ///
28 | public static class TreeViewItemBehaviour
29 | {
30 | #region IsBroughtIntoViewWhenSelected
31 | #region IsBroughtIntoViewWhenSelectedDependencyProperty
32 |
33 | ///
34 | /// Backing storage of the IsBroughtIntoViewWhenSelected dependency property.
35 | ///
36 | public static readonly DependencyProperty IsBroughtIntoViewWhenSelectedProperty =
37 | DependencyProperty.RegisterAttached(
38 | "IsBroughtIntoViewWhenSelected",
39 | typeof(bool),
40 | typeof(TreeViewItemBehaviour),
41 | new UIPropertyMetadata(false, OnIsBroughtIntoViewWhenSelectedChanged));
42 |
43 | ///
44 | /// Gets the value of the IsBroughtIntoViewWhenSelected dependency property.
45 | ///
46 | public static bool GetIsBroughtIntoViewWhenSelected(TreeViewItem treeViewItem)
47 | {
48 | return (bool)treeViewItem.GetValue(IsBroughtIntoViewWhenSelectedProperty);
49 | }
50 |
51 | ///
52 | /// Sets the value of the IsBroughtIntoViewWhenSelected dependency property.
53 | ///
54 | public static void SetIsBroughtIntoViewWhenSelected(TreeViewItem treeViewItem, bool value)
55 | {
56 | treeViewItem.SetValue(IsBroughtIntoViewWhenSelectedProperty, value);
57 | }
58 | #endregion IsBroughtIntoViewWhenSelectedDependencyProperty
59 |
60 | #region methods
61 | private static void OnIsBroughtIntoViewWhenSelectedChanged(DependencyObject depObj, DependencyPropertyChangedEventArgs e)
62 | {
63 | // do not implement interaction logic for WPF Design-Time
64 | if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
65 | return;
66 |
67 | TreeViewItem item = depObj as TreeViewItem;
68 | if (item == null)
69 | return;
70 |
71 | if (e.NewValue is bool == false)
72 | return;
73 |
74 | if ((bool)e.NewValue)
75 | {
76 | item.Selected += item_Selected;
77 | }
78 | else
79 | {
80 | item.Selected -= item_Selected;
81 | }
82 | }
83 |
84 | private static void item_Selected(object sender, RoutedEventArgs e)
85 | {
86 | TreeViewItem item = e.OriginalSource as TreeViewItem;
87 |
88 | if (item != null)
89 | {
90 | item.BringIntoView();
91 | item.Focus();
92 | }
93 | }
94 | #endregion methods
95 | #endregion // IsBroughtIntoViewWhenSelected
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/source/InPlaceEditBoxDemo/Behaviours/TreeViewSelectionChangedBehavior.cs:
--------------------------------------------------------------------------------
1 | namespace InPlaceEditBoxDemo.Behaviours
2 | {
3 | using System.ComponentModel;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 | using System.Windows.Input;
7 |
8 | ///
9 | /// Source:
10 | /// http://stackoverflow.com/questions/1034374/drag-and-drop-in-mvvm-with-scatterview
11 | /// http://social.msdn.microsoft.com/Forums/de-DE/wpf/thread/21bed380-c485-44fb-8741-f9245524d0ae
12 | ///
13 | /// Attached behaviour to implement the SelectionChanged command/event via delegate command binding or routed commands.
14 | ///
15 | public static class TreeViewSelectionChangedBehavior
16 | {
17 | ///
18 | /// Field of attached ICommand property
19 | ///
20 | private static readonly DependencyProperty ChangedCommandProperty = DependencyProperty.RegisterAttached(
21 | "ChangedCommand",
22 | typeof(ICommand),
23 | typeof(TreeViewSelectionChangedBehavior),
24 | new PropertyMetadata(null, OnSelectionChangedCommandChange));
25 |
26 | ///
27 | /// Setter method of the attached ChangedCommand property
28 | ///
29 | ///
30 | ///
31 | public static void SetChangedCommand(DependencyObject source, ICommand value)
32 | {
33 | source.SetValue(ChangedCommandProperty, value);
34 | }
35 |
36 | ///
37 | /// Getter method of the attached ChangedCommand property
38 | ///
39 | ///
40 | ///
41 | public static ICommand GetChangedCommand(DependencyObject source)
42 | {
43 | return (ICommand)source.GetValue(ChangedCommandProperty);
44 | }
45 |
46 | ///
47 | /// This method is hooked in the definition of the .
48 | /// It is called whenever the attached property changes - in our case the event of binding
49 | /// and unbinding the property to a sink is what we are looking for.
50 | ///
51 | ///
52 | ///
53 | private static void OnSelectionChangedCommandChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
54 | {
55 | // do not implement interaction logic for WPF Design-Time
56 | if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
57 | return;
58 |
59 | TreeView uiElement = d as TreeView; // Remove the handler if it exist to avoid memory leaks
60 |
61 | if (uiElement != null)
62 | {
63 | uiElement.SelectedItemChanged -= Selection_Changed;
64 |
65 | var command = e.NewValue as ICommand;
66 | if (command != null)
67 | {
68 | // the property is attached so we attach the Drop event handler
69 | uiElement.SelectedItemChanged += Selection_Changed;
70 | }
71 | }
72 | }
73 |
74 | ///
75 | /// This method is called when the selection changed event occurs. The sender should be the control
76 | /// on which this behaviour is attached - so we convert the sender into a
77 | /// and receive the Command through the getter listed above.
78 | ///
79 | /// The parameter contains the standard EventArgs data,
80 | /// which is unpacked and reales upon the bound command.
81 | ///
82 | /// This implementation supports binding of delegate commands and routed commands.
83 | ///
84 | ///
85 | ///
86 | private static void Selection_Changed(object sender, RoutedPropertyChangedEventArgs