diff --git a/ExtendedWPFToolkitSolution/ExtendedWPFToolkit.sln b/ExtendedWPFToolkitSolution/ExtendedWPFToolkit.sln index 475e236b..eeeb0197 100644 --- a/ExtendedWPFToolkitSolution/ExtendedWPFToolkit.sln +++ b/ExtendedWPFToolkitSolution/ExtendedWPFToolkit.sln @@ -13,9 +13,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Modules.BusyIndicat EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Infrastructure", "Src\Samples\Samples.Infrastructure\Samples.Infrastructure.csproj", "{A4A049A4-665A-4651-9046-7D06E9D0CCDC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Modules.ButtonSpinner", "Src\Samples\Modules\Samples.Modules.ButtonSpinner\Samples.Modules.ButtonSpinner.csproj", "{1CFCE8B5-5A5F-4161-BA12-F317ED0E6463}" +EndProject Global GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 5 + SccNumberOfProjects = 6 SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs02 SccLocalPath0 = . @@ -34,6 +36,10 @@ Global SccProjectTopLevelParentUniqueName4 = ExtendedWPFToolkit.sln SccProjectName4 = Src/Samples/Samples.Infrastructure SccLocalPath4 = Src\\Samples\\Samples.Infrastructure + SccProjectUniqueName5 = Src\\Samples\\Modules\\Samples.Modules.ButtonSpinner\\Samples.Modules.ButtonSpinner.csproj + SccProjectTopLevelParentUniqueName5 = ExtendedWPFToolkit.sln + SccProjectName5 = Src/Samples/Modules/Samples.Modules.ButtonSpinner + SccLocalPath5 = Src\\Samples\\Modules\\Samples.Modules.ButtonSpinner EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -84,6 +90,16 @@ Global {A4A049A4-665A-4651-9046-7D06E9D0CCDC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {A4A049A4-665A-4651-9046-7D06E9D0CCDC}.Release|Mixed Platforms.Build.0 = Release|Any CPU {A4A049A4-665A-4651-9046-7D06E9D0CCDC}.Release|x86.ActiveCfg = Release|Any CPU + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463}.Debug|x86.ActiveCfg = Debug|Any CPU + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463}.Release|Any CPU.Build.0 = Release|Any CPU + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -93,5 +109,6 @@ Global {F927B3FE-820C-4EE1-921F-D10D3AE287AE} = {01F2E61E-7F20-4F2E-8A3C-6604B18415B9} {A4A049A4-665A-4651-9046-7D06E9D0CCDC} = {01F2E61E-7F20-4F2E-8A3C-6604B18415B9} {1A9C0E21-DE3B-4B2D-9EF0-39AA1922CDA6} = {F927B3FE-820C-4EE1-921F-D10D3AE287AE} + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463} = {F927B3FE-820C-4EE1-921F-D10D3AE287AE} EndGlobalSection EndGlobal diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/BusyIndicatorModule.cs b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/BusyIndicatorModule.cs index 95fdf14e..2dc93141 100644 --- a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/BusyIndicatorModule.cs +++ b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/BusyIndicatorModule.cs @@ -7,14 +7,19 @@ namespace Samples.Modules.BusyIndicator { public class BusyIndicatorModule : ModuleBase { - protected BusyIndicatorModule(IUnityContainer container, IRegionManager regionManager) + public BusyIndicatorModule(IUnityContainer container, IRegionManager regionManager) : base(container, regionManager) { } protected override void RegisterViewsAndTypes() { + Container.RegisterType(typeof(object), typeof(HomeView), typeof(HomeView).FullName); + } + protected override void InitializeModule() + { + RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); } } } diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Samples.Modules.BusyIndicator.csproj b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Samples.Modules.BusyIndicator.csproj index cc65cec7..d7d9137d 100644 --- a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Samples.Modules.BusyIndicator.csproj +++ b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Samples.Modules.BusyIndicator.csproj @@ -59,6 +59,12 @@ + + HomeView.xaml + + + NavigationView.xaml + Code @@ -88,6 +94,16 @@ Samples.Infrastructure + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Properties/Settings.Designer.cs b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Properties/Settings.Designer.cs new file mode 100644 index 00000000..3a630328 --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.235 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Samples.Modules.ButtonSpinner.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Properties/Settings.settings b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Properties/Settings.settings new file mode 100644 index 00000000..8f2fd95d --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Samples.Modules.ButtonSpinner.csproj b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Samples.Modules.ButtonSpinner.csproj new file mode 100644 index 00000000..e66223d0 --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Samples.Modules.ButtonSpinner.csproj @@ -0,0 +1,122 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {1CFCE8B5-5A5F-4161-BA12-F317ED0E6463} + library + Properties + Samples.Modules.ButtonSpinner + Samples.Modules.ButtonSpinner + v4.0 + Client + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + SAK + SAK + SAK + SAK + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\..\..\Libs\Prism\Microsoft.Practices.Prism.dll + + + False + ..\..\..\..\Libs\Prism\Microsoft.Practices.Unity.dll + + + + + + + + + + 4.0 + + + + + + + + + HomeView.xaml + + + NavigationView.xaml + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + {72E591D6-8F83-4D8C-8F67-9C325E623234} + WPFToolkit.Extended + + + {A4A049A4-665A-4651-9046-7D06E9D0CCDC} + Samples.Infrastructure + + + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + \ No newline at end of file diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Samples.Modules.ButtonSpinner.csproj.vspscc b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Samples.Modules.ButtonSpinner.csproj.vspscc new file mode 100644 index 00000000..feffdeca --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Samples.Modules.ButtonSpinner.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/HomeView.xaml b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/HomeView.xaml new file mode 100644 index 00000000..64f9ad2b --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/HomeView.xaml @@ -0,0 +1,18 @@ + + + + + + + + + + diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/HomeView.xaml.cs b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/HomeView.xaml.cs new file mode 100644 index 00000000..5c6b4f3a --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/HomeView.xaml.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Samples.Modules.ButtonSpinner +{ + /// + /// Interaction logic for HomeView.xaml + /// + public partial class HomeView : UserControl + { + public HomeView() + { + InitializeComponent(); + } + } +} diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/NavigationView.xaml b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/NavigationView.xaml new file mode 100644 index 00000000..639a3651 --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/NavigationView.xaml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/NavigationView.xaml.cs b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/NavigationView.xaml.cs new file mode 100644 index 00000000..5e71b72e --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ButtonSpinner/Views/NavigationView.xaml.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Samples.Modules.ButtonSpinner +{ + /// + /// Interaction logic for NavigationView.xaml + /// + public partial class NavigationView : TreeViewItem + { + public NavigationView() + { + InitializeComponent(); + } + } +} diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Commands/TreeViewCommandBehavior.cs b/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Commands/TreeViewCommandBehavior.cs new file mode 100644 index 00000000..bb7f9d84 --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Commands/TreeViewCommandBehavior.cs @@ -0,0 +1,25 @@ +using System; +using Microsoft.Practices.Prism.Commands; +using System.Windows.Controls; +using System.Windows; + +namespace Samples.Infrastructure.Commands +{ + public class TreeViewCommandBehavior : CommandBehaviorBase + { + public TreeViewCommandBehavior(TreeView treeView) + : base(treeView) + { + treeView.SelectedItemChanged += SelectedItemChanged; + } + + void SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs e) + { + //This treeview command is specfic to the navigation region, + //so I always want to pass the tag of the selected treeviewitem + //because it will conatin the fully qualified navigation path + CommandParameter = (e.NewValue as FrameworkElement).Tag; + ExecuteCommand(); + } + } +} diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Commands/TreeViewSelected.cs b/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Commands/TreeViewSelected.cs new file mode 100644 index 00000000..4a5fb541 --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Commands/TreeViewSelected.cs @@ -0,0 +1,64 @@ +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; + +namespace Samples.Infrastructure.Commands +{ + public class TreeViewSelected + { + private static readonly DependencyProperty SelectedCommandBehaviorProperty = DependencyProperty.RegisterAttached("SelectedCommandBehavior", typeof(TreeViewCommandBehavior), typeof(TreeViewSelected), null); + + public static readonly DependencyProperty CommandProperty = DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(TreeViewSelected), new PropertyMetadata(OnSetCommandCallback)); + public static void SetCommand(TreeView menuItem, ICommand command) + { + menuItem.SetValue(CommandProperty, command); + } + public static ICommand GetCommand(TreeView menuItem) + { + return menuItem.GetValue(CommandProperty) as ICommand; + } + + public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.RegisterAttached("CommandParameter", typeof(object), typeof(TreeViewSelected), new PropertyMetadata(OnSetCommandParameterCallback)); + public static void SetCommandParameter(TreeView menuItem, object parameter) + { + menuItem.SetValue(CommandParameterProperty, parameter); + } + public static object GetCommandParameter(TreeView menuItem) + { + return menuItem.GetValue(CommandParameterProperty); + } + + private static void OnSetCommandCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) + { + TreeView menuItem = dependencyObject as TreeView; + if (menuItem != null) + { + TreeViewCommandBehavior behavior = GetOrCreateBehavior(menuItem); + behavior.Command = e.NewValue as ICommand; + } + } + + private static void OnSetCommandParameterCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) + { + TreeView menuItem = dependencyObject as TreeView; + if (menuItem != null) + { + TreeViewCommandBehavior behavior = GetOrCreateBehavior(menuItem); + behavior.CommandParameter = e.NewValue; + } + } + + private static TreeViewCommandBehavior GetOrCreateBehavior(TreeView menuItem) + { + TreeViewCommandBehavior behavior = menuItem.GetValue(SelectedCommandBehaviorProperty) as TreeViewCommandBehavior; + if (behavior == null) + { + behavior = new TreeViewCommandBehavior(menuItem); + menuItem.SetValue(SelectedCommandBehaviorProperty, behavior); + } + + return behavior; + } + } +} diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/ModuleBase.cs b/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/ModuleBase.cs index 435f55e1..f01576c8 100644 --- a/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/ModuleBase.cs +++ b/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/ModuleBase.cs @@ -18,9 +18,13 @@ namespace Samples.Infrastructure public void Initialize() { + //types must be registered first RegisterViewsAndTypes(); + //now initialize the module + InitializeModule(); } + protected abstract void InitializeModule(); protected abstract void RegisterViewsAndTypes(); } } diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/RegionNames.cs b/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/RegionNames.cs new file mode 100644 index 00000000..50690b6a --- /dev/null +++ b/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/RegionNames.cs @@ -0,0 +1,10 @@ +using System; + +namespace Samples.Infrastructure +{ + public static class RegionNames + { + public static readonly string NavigationRegion = "NavigationRegion"; + public static readonly string ContentRegion = "ContentRegion"; + } +} diff --git a/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Samples.Infrastructure.csproj b/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Samples.Infrastructure.csproj index 398ef30f..ef0e2949 100644 --- a/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Samples.Infrastructure.csproj +++ b/ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Samples.Infrastructure.csproj @@ -61,6 +61,8 @@ + + Code @@ -75,6 +77,7 @@ Settings.settings True + ResXFileCodeGenerator Resources.Designer.cs @@ -85,6 +88,7 @@ +