├── .gitattributes ├── .gitignore ├── DragablzPrism.sln ├── DragablzPrism ├── App.config ├── App.xaml ├── App.xaml.cs ├── Bootstrapper.cs ├── DragablzPrism.csproj ├── Interfaces │ └── ICommonData.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── RegionNames.cs ├── Regions │ ├── DragablzWindowEvent.cs │ ├── InterTabClient.cs │ ├── RegionUtility.cs │ ├── TabClientProxy.cs │ └── TabablzRegionBehavior.cs ├── ViewModels │ ├── BaseViewModel.cs │ └── MainWindowViewModel.cs ├── Views │ ├── View1.xaml │ ├── View1.xaml.cs │ ├── View2.xaml │ ├── View2.xaml.cs │ ├── View3.xaml │ └── View3.xaml.cs └── packages.config └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opensdf 78 | *.sdf 79 | *.cachefile 80 | 81 | # Visual Studio profiler 82 | *.psess 83 | *.vsp 84 | *.vspx 85 | 86 | # TFS 2012 Local Workspace 87 | $tf/ 88 | 89 | # Guidance Automation Toolkit 90 | *.gpState 91 | 92 | # ReSharper is a .NET coding add-in 93 | _ReSharper*/ 94 | *.[Rr]e[Ss]harper 95 | *.DotSettings.user 96 | 97 | # JustCode is a .NET coding add-in 98 | .JustCode 99 | 100 | # TeamCity is a build add-in 101 | _TeamCity* 102 | 103 | # DotCover is a Code Coverage Tool 104 | *.dotCover 105 | 106 | # NCrunch 107 | _NCrunch_* 108 | .*crunch*.local.xml 109 | 110 | # MightyMoose 111 | *.mm.* 112 | AutoTest.Net/ 113 | 114 | # Web workbench (sass) 115 | .sass-cache/ 116 | 117 | # Installshield output folder 118 | [Ee]xpress/ 119 | 120 | # DocProject is a documentation generator add-in 121 | DocProject/buildhelp/ 122 | DocProject/Help/*.HxT 123 | DocProject/Help/*.HxC 124 | DocProject/Help/*.hhc 125 | DocProject/Help/*.hhk 126 | DocProject/Help/*.hhp 127 | DocProject/Help/Html2 128 | DocProject/Help/html 129 | 130 | # Click-Once directory 131 | publish/ 132 | 133 | # Publish Web Output 134 | *.[Pp]ublish.xml 135 | *.azurePubxml 136 | ## TODO: Comment the next line if you want to checkin your 137 | ## web deploy settings but do note that will include unencrypted 138 | ## passwords 139 | #*.pubxml 140 | 141 | *.publishproj 142 | 143 | # NuGet Packages 144 | *.nupkg 145 | # The packages folder can be ignored because of Package Restore 146 | **/packages/* 147 | # except build/, which is used as an MSBuild target. 148 | !**/packages/build/ 149 | # Uncomment if necessary however generally it will be regenerated when needed 150 | #!**/packages/repositories.config 151 | 152 | # Windows Azure Build Output 153 | csx/ 154 | *.build.csdef 155 | 156 | # Windows Store app package directory 157 | AppPackages/ 158 | 159 | # Visual Studio cache files 160 | # files ending in .cache can be ignored 161 | *.[Cc]ache 162 | # but keep track of directories ending in .cache 163 | !*.[Cc]ache/ 164 | 165 | # Others 166 | ClientBin/ 167 | [Ss]tyle[Cc]op.* 168 | ~$* 169 | *~ 170 | *.dbmdl 171 | *.dbproj.schemaview 172 | *.pfx 173 | *.publishsettings 174 | node_modules/ 175 | orleans.codegen.cs 176 | 177 | # RIA/Silverlight projects 178 | Generated_Code/ 179 | 180 | # Backup & report files from converting an old project file 181 | # to a newer Visual Studio version. Backup files are not needed, 182 | # because we have git ;-) 183 | _UpgradeReport_Files/ 184 | Backup*/ 185 | UpgradeLog*.XML 186 | UpgradeLog*.htm 187 | 188 | # SQL Server files 189 | *.mdf 190 | *.ldf 191 | 192 | # Business Intelligence projects 193 | *.rdl.data 194 | *.bim.layout 195 | *.bim_*.settings 196 | 197 | # Microsoft Fakes 198 | FakesAssemblies/ 199 | 200 | # Node.js Tools for Visual Studio 201 | .ntvs_analysis.dat 202 | 203 | # Visual Studio 6 build log 204 | *.plg 205 | 206 | # Visual Studio 6 workspace options file 207 | *.opt 208 | 209 | # LightSwitch generated files 210 | GeneratedArtifacts/ 211 | _Pvt_Extensions/ 212 | ModelManifest.xml 213 | -------------------------------------------------------------------------------- /DragablzPrism.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DragablzPrism", "DragablzPrism\DragablzPrism.csproj", "{B94334A7-4034-4A66-AF61-38D57653AABF}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {B94334A7-4034-4A66-AF61-38D57653AABF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {B94334A7-4034-4A66-AF61-38D57653AABF}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {B94334A7-4034-4A66-AF61-38D57653AABF}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {B94334A7-4034-4A66-AF61-38D57653AABF}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /DragablzPrism/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /DragablzPrism/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /DragablzPrism/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.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace DragablzPrism 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | protected override void OnStartup(StartupEventArgs e) 17 | { 18 | base.OnStartup(e); 19 | Bootstrapper bootstrapper = new Bootstrapper(); 20 | bootstrapper.Run(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DragablzPrism/Bootstrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using CHRobinson.Enterprise.Shell.Regions.Behaviors; 8 | using DragablzPrism.Views; 9 | using Microsoft.Practices.Prism.Regions; 10 | using Microsoft.Practices.Prism.UnityExtensions; 11 | using Microsoft.Practices.Unity; 12 | 13 | namespace DragablzPrism 14 | { 15 | public class Bootstrapper : UnityBootstrapper 16 | { 17 | protected override DependencyObject CreateShell() 18 | { 19 | var view = Container.TryResolve(); 20 | return view; 21 | } 22 | 23 | protected override void InitializeShell() 24 | { 25 | base.InitializeShell(); 26 | Application.Current.MainWindow = (Window)Shell; 27 | Application.Current.MainWindow.Show(); 28 | } 29 | 30 | protected override void ConfigureContainer() 31 | { 32 | Container.RegisterType("View1"); 33 | Container.RegisterType("View2"); 34 | Container.RegisterType("View3"); 35 | 36 | base.ConfigureContainer(); 37 | } 38 | 39 | protected override RegionAdapterMappings ConfigureRegionAdapterMappings() 40 | { 41 | Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose; 42 | // create region 43 | var region = new SingleActiveRegion() { Name = RegionNames.MainRegion }; 44 | 45 | region.Behaviors.Add(DragablzWindowBehavior.BehaviorKey, new DragablzWindowBehavior()); 46 | 47 | Container.Resolve().Regions.Add(RegionNames.MainRegion, region); 48 | 49 | return base.ConfigureRegionAdapterMappings(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /DragablzPrism/DragablzPrism.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B94334A7-4034-4A66-AF61-38D57653AABF} 8 | WinExe 9 | Properties 10 | DragablzPrism 11 | DragablzPrism 12 | v4.5.2 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | true 17 | 18 | 19 | AnyCPU 20 | true 21 | full 22 | false 23 | bin\Debug\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | AnyCPU 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | ..\packages\Dragablz.0.0.2.120\lib\net45\Dragablz.dll 40 | True 41 | 42 | 43 | ..\packages\Prism.Composition.5.0.0\lib\NET45\Microsoft.Practices.Prism.Composition.dll 44 | True 45 | 46 | 47 | ..\packages\Prism.Interactivity.5.0.0\lib\NET45\Microsoft.Practices.Prism.Interactivity.dll 48 | True 49 | 50 | 51 | ..\packages\Prism.Mvvm.1.0.0\lib\net45\Microsoft.Practices.Prism.Mvvm.dll 52 | True 53 | 54 | 55 | ..\packages\Prism.Mvvm.1.0.0\lib\net45\Microsoft.Practices.Prism.Mvvm.Desktop.dll 56 | True 57 | 58 | 59 | ..\packages\Prism.PubSubEvents.1.0.0\lib\portable-sl4+wp7+windows8+net40\Microsoft.Practices.Prism.PubSubEvents.dll 60 | True 61 | 62 | 63 | ..\packages\Prism.Mvvm.1.0.0\lib\net45\Microsoft.Practices.Prism.SharedInterfaces.dll 64 | True 65 | 66 | 67 | ..\packages\Prism.UnityExtensions.5.0.1\lib\NET45\Microsoft.Practices.Prism.UnityExtensions.dll 68 | True 69 | 70 | 71 | ..\packages\CommonServiceLocator.1.2\lib\portable-windows8+net40+sl5+windowsphone8\Microsoft.Practices.ServiceLocation.dll 72 | True 73 | 74 | 75 | ..\packages\Unity.3.5.1404.0\lib\net45\Microsoft.Practices.Unity.dll 76 | True 77 | 78 | 79 | ..\packages\Unity.3.5.1404.0\lib\net45\Microsoft.Practices.Unity.Configuration.dll 80 | True 81 | 82 | 83 | ..\packages\Unity.3.5.1404.0\lib\net45\Microsoft.Practices.Unity.RegistrationByConvention.dll 84 | True 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 4.0 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | MSBuild:Compile 104 | Designer 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | View1.xaml 117 | 118 | 119 | View2.xaml 120 | 121 | 122 | View3.xaml 123 | 124 | 125 | MSBuild:Compile 126 | Designer 127 | 128 | 129 | App.xaml 130 | Code 131 | 132 | 133 | 134 | MainWindow.xaml 135 | Code 136 | 137 | 138 | Designer 139 | MSBuild:Compile 140 | 141 | 142 | Designer 143 | MSBuild:Compile 144 | 145 | 146 | Designer 147 | MSBuild:Compile 148 | 149 | 150 | 151 | 152 | Code 153 | 154 | 155 | True 156 | True 157 | Resources.resx 158 | 159 | 160 | True 161 | Settings.settings 162 | True 163 | 164 | 165 | ResXFileCodeGenerator 166 | Resources.Designer.cs 167 | 168 | 169 | 170 | SettingsSingleFileGenerator 171 | Settings.Designer.cs 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 187 | -------------------------------------------------------------------------------- /DragablzPrism/Interfaces/ICommonData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DragablzPrism.Interfaces 8 | { 9 | public interface ICommonData 10 | { 11 | string Title { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DragablzPrism/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /DragablzPrism/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using Dragablz; 16 | using DragablzPrism.Regions; 17 | using DragablzPrism.ViewModels; 18 | using Microsoft.Practices.Prism.PubSubEvents; 19 | using Microsoft.Practices.Unity; 20 | 21 | namespace DragablzPrism 22 | { 23 | /// 24 | /// Interaction logic for MainWindow.xaml 25 | /// 26 | public partial class MainWindow : DragablzWindow 27 | { 28 | private readonly IEventAggregator eventAggregator; 29 | 30 | public MainWindow() 31 | { 32 | InitializeComponent(); 33 | } 34 | 35 | [InjectionConstructor] 36 | public MainWindow(MainWindowViewModel vm, IEventAggregator eventAggregator) : this() 37 | { 38 | this.eventAggregator = eventAggregator; 39 | DataContext = vm; 40 | 41 | eventAggregator.GetEvent().Publish(new DragablzWindowEventArgs() { TabControl = TabablzControl, Type = DragablzWindowEventType.Opened }); 42 | } 43 | 44 | private void MainWindow_OnClosed(object sender, EventArgs e) 45 | { 46 | eventAggregator.GetEvent().Publish(new DragablzWindowEventArgs() { TabControl = TabablzControl, Type = DragablzWindowEventType.Closed }); 47 | } 48 | 49 | private void MainWindow_OnActivated(object sender, EventArgs e) 50 | { 51 | eventAggregator.GetEvent().Publish(new DragablzWindowEventArgs() { TabControl = TabablzControl, Type = DragablzWindowEventType.Activated }); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /DragablzPrism/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("DragablzPrism")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("DragablzPrism")] 15 | [assembly: AssemblyCopyright("Copyright © 2015")] 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 | -------------------------------------------------------------------------------- /DragablzPrism/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 DragablzPrism.Properties 12 | { 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 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DragablzPrism.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /DragablzPrism/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /DragablzPrism/Properties/Settings.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 DragablzPrism.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.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 | -------------------------------------------------------------------------------- /DragablzPrism/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /DragablzPrism/RegionNames.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DragablzPrism 8 | { 9 | public static class RegionNames 10 | { 11 | public const string MainRegion = "MainRegion"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DragablzPrism/Regions/DragablzWindowEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Dragablz; 7 | using Microsoft.Practices.Prism.Events; 8 | using Microsoft.Practices.Prism.PubSubEvents; 9 | 10 | namespace DragablzPrism.Regions 11 | { 12 | public class DragablzWindowEvent : PubSubEvent 13 | { 14 | 15 | } 16 | 17 | public class DragablzWindowEventArgs 18 | { 19 | public DragablzWindowEventType Type { get; set; } 20 | public TabablzControl TabControl { get; set; } 21 | } 22 | 23 | public enum DragablzWindowEventType 24 | { 25 | Opened, 26 | Closed, 27 | Activated 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /DragablzPrism/Regions/InterTabClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using Dragablz; 8 | using Microsoft.Practices.ServiceLocation; 9 | 10 | namespace DragablzPrism.Regions 11 | { 12 | public class InterTabClient : IInterTabClient 13 | { 14 | public INewTabHost GetNewHost(IInterTabClient interTabClient, object partition, TabablzControl source) 15 | { 16 | var view = ServiceLocator.Current.GetInstance(); 17 | 18 | return new NewTabHost(view, view.TabablzControl); 19 | } 20 | 21 | public TabEmptiedResponse TabEmptiedHandler(TabablzControl tabControl, Window window) 22 | { 23 | return TabEmptiedResponse.CloseWindowOrLayoutBranch; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DragablzPrism/Regions/RegionUtility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | 8 | namespace DragablzPrism.Regions 9 | { 10 | public static class RegionUtility 11 | { 12 | public static T GetInterfaceFromView(object view) 13 | { 14 | if (view is T) 15 | { 16 | return (T)view; 17 | } 18 | else 19 | { 20 | FrameworkElement viewAsFrameworkElement = view as FrameworkElement; 21 | 22 | if (viewAsFrameworkElement?.DataContext is T) 23 | { 24 | return (T)viewAsFrameworkElement.DataContext; 25 | } 26 | } 27 | 28 | return default(T); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DragablzPrism/Regions/TabClientProxy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using DragablzPrism.Interfaces; 7 | 8 | namespace DragablzPrism.Regions 9 | { 10 | public class TabClientProxy 11 | { 12 | public ICommonData CommonData { get; set; } 13 | public object Content { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DragablzPrism/Regions/TabablzRegionBehavior.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Collections.Specialized; 5 | using System.Diagnostics; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows; 9 | using System.Windows.Input; 10 | using System.Windows.Threading; 11 | using Dragablz; 12 | using DragablzPrism.Interfaces; 13 | using DragablzPrism.Regions; 14 | using Microsoft.Practices.Prism.Events; 15 | using Microsoft.Practices.Prism.PubSubEvents; 16 | using Microsoft.Practices.Prism.Regions; 17 | using Microsoft.Practices.ServiceLocation; 18 | 19 | namespace CHRobinson.Enterprise.Shell.Regions.Behaviors 20 | { 21 | public class DragablzWindowBehavior : RegionBehavior 22 | { 23 | public const string BehaviorKey = "DragablzWindowBehavior"; 24 | 25 | private TabablzControl activeWindow; 26 | private readonly ObservableCollection windows; 27 | private readonly Dictionary itemToTabClientMapping; 28 | 29 | public DragablzWindowBehavior() 30 | { 31 | this.windows = new ObservableCollection(); 32 | this.itemToTabClientMapping = new Dictionary(); 33 | } 34 | 35 | protected override void OnAttach() 36 | { 37 | this.Region.Views.CollectionChanged += Views_CollectionChanged; 38 | this.Region.ActiveViews.CollectionChanged += ActiveViews_CollectionChanged; 39 | 40 | var eventAggregator = ServiceLocator.Current.GetInstance(); 41 | eventAggregator.GetEvent().Subscribe(OnDragablzWindowEvent); 42 | } 43 | 44 | public void OnDragablzWindowEvent(DragablzWindowEventArgs args) 45 | { 46 | switch (args.Type) 47 | { 48 | case DragablzWindowEventType.Opened: 49 | OnWindowOpened(args.TabControl); 50 | break; 51 | 52 | case DragablzWindowEventType.Closed: 53 | OnWindowClosed(args.TabControl); 54 | break; 55 | 56 | case DragablzWindowEventType.Activated: 57 | OnWindowActivated(args.TabControl); 58 | break; 59 | } 60 | } 61 | 62 | private void OnWindowActivated(TabablzControl tabControl) 63 | { 64 | if (this.activeWindow != tabControl) 65 | { 66 | SetActiveView(tabControl); 67 | } 68 | } 69 | 70 | private void OnWindowClosed(TabablzControl tabControl) 71 | { 72 | ClearRelatedTabs(tabControl); 73 | this.windows.Remove(tabControl); 74 | tabControl.SelectionChanged -= TabControl_SelectionChanged; 75 | 76 | if (this.activeWindow == tabControl) 77 | { 78 | this.activeWindow = this.windows.FirstOrDefault(); 79 | } 80 | } 81 | 82 | private void ClearRelatedTabs(TabablzControl tabControl) 83 | { 84 | var items = tabControl.Items.OfType().ToList(); 85 | 86 | items.ForEach(item => 87 | { 88 | try 89 | { 90 | this.Region.Remove(item.Content); 91 | } 92 | catch (ArgumentException) { } 93 | }); 94 | } 95 | 96 | private void OnWindowOpened(TabablzControl tabControl) 97 | { 98 | this.activeWindow = tabControl; 99 | this.windows.Add(tabControl); 100 | tabControl.ClosingItemCallback = ClosingItemCallback; 101 | tabControl.SelectionChanged += TabControl_SelectionChanged; 102 | } 103 | 104 | private void TabControl_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) 105 | { 106 | if (e.AddedItems.Count > 0) 107 | { 108 | var item = e.AddedItems[0] as TabClientProxy; 109 | if (item != null) 110 | { 111 | var regionItem = item.Content; 112 | 113 | if (this.Region.Views.Contains(regionItem)) 114 | { 115 | this.Region.Activate(regionItem); 116 | } 117 | } 118 | } 119 | } 120 | 121 | 122 | private void ClosingItemCallback(ItemActionCallbackArgs args) 123 | { 124 | // remove from region 125 | this.Region.Remove(((TabClientProxy)args.DragablzItem.DataContext).Content); 126 | } 127 | 128 | private void ActiveViews_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) 129 | { 130 | switch (e.Action) 131 | { 132 | case NotifyCollectionChangedAction.Add: 133 | ActivateView(e.NewItems[0]); 134 | 135 | break; 136 | } 137 | } 138 | 139 | private void Views_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) 140 | { 141 | switch (e.Action) 142 | { 143 | case NotifyCollectionChangedAction.Add: 144 | AddView(e.NewItems[0]); 145 | break; 146 | 147 | case NotifyCollectionChangedAction.Remove: 148 | RemoveView(e.OldItems[0]); 149 | break; 150 | } 151 | } 152 | 153 | private void ActivateView(object view) 154 | { 155 | var proxy = GetProxy(view); 156 | var window = GetWindow(view); 157 | 158 | Debug.WriteLine($"Activating {proxy.CommonData.Title}"); 159 | 160 | if (window.SelectedItem != proxy || window != this.activeWindow) 161 | { 162 | window.SelectedItem = proxy; 163 | window.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); 164 | } 165 | } 166 | 167 | private void SetActiveView(TabablzControl window) 168 | { 169 | if (this.activeWindow != window) 170 | { 171 | this.activeWindow = window; 172 | this.activeWindow.BringIntoView(); 173 | this.activeWindow.Focus(); 174 | 175 | var view = this.activeWindow.SelectedItem as TabClientProxy; 176 | if (view != null && this.Region.Views.Contains(view.Content)) 177 | { 178 | this.Region.Activate(view.Content); 179 | } 180 | } 181 | } 182 | 183 | private void RemoveView(object view) 184 | { 185 | var window = GetWindow(view); 186 | var proxy = GetProxy(view); 187 | window.Items.Remove(proxy); 188 | 189 | CleanUp(view); 190 | } 191 | 192 | private void CleanUp(object view) 193 | { 194 | this.itemToTabClientMapping.Remove(view); 195 | } 196 | 197 | private void AddView(object view) 198 | { 199 | this.activeWindow.Items.Add(CreateProxy(view)); 200 | } 201 | 202 | private TabablzControl GetWindow(object view) 203 | { 204 | var proxy = GetProxy(view); 205 | 206 | foreach (var window in this.windows) 207 | { 208 | if (ContainsView(window, proxy)) 209 | { 210 | return window; 211 | } 212 | } 213 | 214 | return null; 215 | } 216 | 217 | private bool ContainsView(TabablzControl window, TabClientProxy proxy) 218 | { 219 | if (proxy == null || window == null) return false; 220 | 221 | return window.Items.OfType().Any(tc => tc == proxy); 222 | } 223 | 224 | private TabClientProxy GetProxy(object view) 225 | { 226 | return this.itemToTabClientMapping[view]; 227 | } 228 | 229 | private TabClientProxy CreateProxy(object view) 230 | { 231 | var proxy = new TabClientProxy 232 | { 233 | Content = view, 234 | CommonData = RegionUtility.GetInterfaceFromView(view) 235 | }; 236 | 237 | this.itemToTabClientMapping.Add(view, proxy); 238 | 239 | return proxy; 240 | } 241 | } 242 | } 243 | -------------------------------------------------------------------------------- /DragablzPrism/ViewModels/BaseViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using DragablzPrism.Interfaces; 7 | using Microsoft.Practices.Prism.Mvvm; 8 | 9 | namespace DragablzPrism.ViewModels 10 | { 11 | public class BaseViewModel : BindableBase, ICommonData 12 | { 13 | private string title; 14 | 15 | public string Title 16 | { 17 | get { return title; } 18 | set 19 | { 20 | title = value; 21 | OnPropertyChanged("Title"); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DragablzPrism/ViewModels/MainWindowViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Input; 7 | using Dragablz; 8 | using DragablzPrism.Regions; 9 | using Microsoft.Practices.Prism.Commands; 10 | using Microsoft.Practices.Prism.Mvvm; 11 | using Microsoft.Practices.Prism.PubSubEvents; 12 | using Microsoft.Practices.Prism.Regions; 13 | 14 | namespace DragablzPrism.ViewModels 15 | { 16 | public class MainWindowViewModel : BindableBase 17 | { 18 | private readonly IRegionManager regionManager; 19 | public ICommand OpenView1 { get; } 20 | public ICommand OpenView2 { get; } 21 | public ICommand OpenView3 { get; } 22 | public IInterTabClient InterTabClient { get; } 23 | 24 | public MainWindowViewModel(IRegionManager regionManager) 25 | { 26 | this.regionManager = regionManager; 27 | 28 | OpenView1 = new DelegateCommand(OpenView1Action); 29 | OpenView2 = new DelegateCommand(OpenView2Action); 30 | OpenView3 = new DelegateCommand(OpenView3Action); 31 | InterTabClient = new InterTabClient(); 32 | } 33 | 34 | private void OpenView3Action() 35 | { 36 | this.regionManager.RequestNavigate(RegionNames.MainRegion, "View3"); 37 | } 38 | 39 | private void OpenView2Action() 40 | { 41 | this.regionManager.RequestNavigate(RegionNames.MainRegion, "View2"); 42 | } 43 | 44 | private void OpenView1Action() 45 | { 46 | this.regionManager.RequestNavigate(RegionNames.MainRegion, "View1"); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /DragablzPrism/Views/View1.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | View 1 11 | 12 | 13 | -------------------------------------------------------------------------------- /DragablzPrism/Views/View1.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using DragablzPrism.ViewModels; 16 | using Microsoft.Practices.Unity; 17 | 18 | namespace DragablzPrism.Views 19 | { 20 | /// 21 | /// Interaction logic for View1.xaml 22 | /// 23 | public partial class View1 : UserControl 24 | { 25 | public View1() 26 | { 27 | InitializeComponent(); 28 | } 29 | 30 | [InjectionConstructor] 31 | public View1(BaseViewModel vm) : this() 32 | { 33 | vm.Title = "View 1"; 34 | this.DataContext = vm; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /DragablzPrism/Views/View2.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | View 2 11 | 12 | 13 | -------------------------------------------------------------------------------- /DragablzPrism/Views/View2.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using DragablzPrism.ViewModels; 16 | using Microsoft.Practices.Unity; 17 | 18 | namespace DragablzPrism.Views 19 | { 20 | /// 21 | /// Interaction logic for View2.xaml 22 | /// 23 | public partial class View2 : UserControl 24 | { 25 | public View2() 26 | { 27 | InitializeComponent(); 28 | } 29 | 30 | [InjectionConstructor] 31 | public View2(BaseViewModel vm) : this() 32 | { 33 | vm.Title = "View 2"; 34 | this.DataContext = vm; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /DragablzPrism/Views/View3.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | View 3 11 | 12 | 13 | -------------------------------------------------------------------------------- /DragablzPrism/Views/View3.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using DragablzPrism.ViewModels; 16 | using Microsoft.Practices.Unity; 17 | 18 | namespace DragablzPrism.Views 19 | { 20 | /// 21 | /// Interaction logic for View3.xaml 22 | /// 23 | public partial class View3 : UserControl 24 | { 25 | public View3() 26 | { 27 | InitializeComponent(); 28 | } 29 | 30 | [InjectionConstructor] 31 | public View3(BaseViewModel vm) : this() 32 | { 33 | vm.Title = "View 3"; 34 | this.DataContext = vm; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /DragablzPrism/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DragablzPrism 2 | 3 | Proof of concept of a single region named MainRegion that will synchronize with multiple Tabablz controls to allow activation/removal/deactivation via both the IRegionManager API as well as the user interacting via the tabablz stuff 4 | 5 | 6 | --------------------------------------------------------------------------------