Browse Source

Add a license description in the header of every .cs and .xaml files.

pull/1645/head
Nebuleux_cp 15 years ago
parent
commit
f0775d4061
  1. 35
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/BusyIndicatorModule.cs
  2. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/NavigationItems/BusyIndicatorNavItem.xaml
  3. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/NavigationItems/BusyIndicatorNavItem.xaml.cs
  4. 44
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Properties/AssemblyInfo.cs
  5. 38
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Resources/Common.xaml
  6. 36
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorCustomContentTemplateView.xaml
  7. 23
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorCustomContentTemplateView.xaml.cs
  8. 24
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorCustomContentView.xaml
  9. 23
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorCustomContentView.xaml.cs
  10. 32
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorView.xaml
  11. 32
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorView.xaml.cs
  12. 41
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/ButtonModule.cs
  13. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/ButtonSpinnerNavItem.xaml
  14. 19
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/ButtonSpinnerNavItem.xaml.cs
  15. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/DropDownButtonNavItem.xaml
  16. 19
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/DropDownButtonNavItem.xaml.cs
  17. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/SplitButtonNavItem.xaml
  18. 19
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/SplitButtonNavItem.xaml.cs
  19. 44
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Properties/AssemblyInfo.cs
  20. 36
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/ButtonSpinnerView.xaml
  21. 36
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/ButtonSpinnerView.xaml.cs
  22. 26
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/DropDownButtonView.xaml
  23. 27
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/DropDownButtonView.xaml.cs
  24. 27
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/SplitButtonView.xaml
  25. 29
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/SplitButtonView.xaml.cs
  26. 37
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/CalculatorModule.cs
  27. 22
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/NavigationItems/CalculatorNavItem.xaml
  28. 19
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/NavigationItems/CalculatorNavItem.xaml.cs
  29. 22
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/NavigationItems/CalculatorUpDownNavItem.xaml
  30. 19
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/NavigationItems/CalculatorUpDownNavItem.xaml.cs
  31. 44
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/Properties/AssemblyInfo.cs
  32. 32
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/Views/CalculatorUpDownView.xaml
  33. 23
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/Views/CalculatorUpDownView.xaml.cs
  34. 26
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/Views/CalculatorView.xaml
  35. 23
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/Views/CalculatorView.xaml.cs
  36. 33
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/ChildWindowModule.cs
  37. 44
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/Properties/AssemblyInfo.cs
  38. 46
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/Views/HomeView.xaml
  39. 23
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/Views/HomeView.xaml.cs
  40. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/Views/NavigationView.xaml
  41. 30
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/Views/NavigationView.xaml.cs
  42. 33
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/ColorModule.cs
  43. 44
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/Properties/AssemblyInfo.cs
  44. 31
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/Views/HomeView.xaml
  45. 128
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/Views/HomeView.xaml.cs
  46. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/Views/NavigationView.xaml
  47. 30
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/Views/NavigationView.xaml.cs
  48. 33
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/DateTimeModule.cs
  49. 44
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/Properties/AssemblyInfo.cs
  50. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/Views/HomeView.xaml
  51. 23
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/Views/HomeView.xaml.cs
  52. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/Views/NavigationView.xaml
  53. 30
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/Views/NavigationView.xaml.cs
  54. 33
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/NumericModule.cs
  55. 44
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/Properties/AssemblyInfo.cs
  56. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/Views/HomeView.xaml
  57. 23
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/Views/HomeView.xaml.cs
  58. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/Views/NavigationView.xaml
  59. 30
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/Views/NavigationView.xaml.cs
  60. 44
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Properties/AssemblyInfo.cs
  61. 45
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/PropertyGridModule.cs
  62. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Resources/LastNameUserControlEditor.xaml
  63. 42
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Resources/LastNameUserControlEditor.xaml.cs
  64. 26
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/BindingToStructs.xaml
  65. 98
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/BindingToStructs.xaml.cs
  66. 31
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/CustomEditors.xaml
  67. 260
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/CustomEditors.xaml.cs
  68. 28
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/CustomItemsSource.xaml
  69. 132
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/CustomItemsSource.xaml.cs
  70. 24
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/DefaultEditors.xaml
  71. 206
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/DefaultEditors.xaml.cs
  72. 24
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/ExpandableProperties.xaml
  73. 89
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/ExpandableProperties.xaml.cs
  74. 43
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/HomeView.xaml
  75. 22
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/HomeView.xaml.cs
  76. 30
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/NavigationView.xaml
  77. 30
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/NavigationView.xaml.cs
  78. 28
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/SpecifyingProperties.xaml
  79. 210
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/SpecifyingProperties.xaml.cs
  80. 44
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Properties/AssemblyInfo.cs
  81. 35
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/TextModule.cs
  82. 25
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/HomeView.xaml
  83. 52
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/HomeView.xaml.cs
  84. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/NavigationView.xaml
  85. 30
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/NavigationView.xaml.cs
  86. 30
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/WatermarkTextBoxView.xaml
  87. 23
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/WatermarkTextBoxView.xaml.cs
  88. 44
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/Properties/AssemblyInfo.cs
  89. 26
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/Views/HomeView.xaml
  90. 23
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/Views/HomeView.xaml.cs
  91. 20
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/Views/NavigationView.xaml
  92. 30
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/Views/NavigationView.xaml.cs
  93. 33
      ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/WizardModule.cs
  94. 32
      ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Commands/TreeViewCommandBehavior.cs
  95. 63
      ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Commands/TreeViewSelected.cs
  96. 108
      ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Controls/DemoView.cs
  97. 41
      ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Converters/CSharpColorConverter.cs
  98. 80
      ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Converters/XamlColorConverter.cs
  99. 182
      ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Core/CodeFormatting/CSharpFormat.cs
  100. 165
      ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Core/CodeFormatting/XamlFormat.cs

35
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/BusyIndicatorModule.cs

@ -1,7 +1,24 @@
using System; /************************************************************************
using Samples.Infrastructure;
using Microsoft.Practices.Unity; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions; using Samples.Infrastructure.Extensions;
using Samples.Modules.BusyIndicator.NavigationItems; using Samples.Modules.BusyIndicator.NavigationItems;
using Samples.Modules.BusyIndicator.Views; using Samples.Modules.BusyIndicator.Views;
@ -10,21 +27,21 @@ namespace Samples.Modules.BusyIndicator
{ {
public class BusyIndicatorModule : ModuleBase public class BusyIndicatorModule : ModuleBase
{ {
public BusyIndicatorModule(IUnityContainer container, IRegionManager regionManager) public BusyIndicatorModule( IUnityContainer container, IRegionManager regionManager )
: base(container, regionManager) : base( container, regionManager )
{ {
} }
protected override void RegisterViewsAndTypes() protected override void RegisterViewsAndTypes()
{ {
Container.RegisterNavigationType(typeof(BusyIndicatorView)); Container.RegisterNavigationType( typeof( BusyIndicatorView ) );
Container.RegisterNavigationType(typeof(BusyIndicatorCustomContentView)); Container.RegisterNavigationType( typeof( BusyIndicatorCustomContentView ) );
Container.RegisterNavigationType(typeof(BusyIndicatorCustomContentTemplateView)); Container.RegisterNavigationType( typeof( BusyIndicatorCustomContentTemplateView ) );
} }
protected override void InitializeModule() protected override void InitializeModule()
{ {
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(BusyIndicatorNavItem)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( BusyIndicatorNavItem ) );
} }
} }
} }

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/NavigationItems/BusyIndicatorNavItem.xaml

@ -1,4 +1,22 @@
<TreeViewItem x:Class="Samples.Modules.BusyIndicator.NavigationItems.BusyIndicatorNavItem" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.BusyIndicator.NavigationItems.BusyIndicatorNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.BusyIndicator.NavigationItems" xmlns:navItems="clr-namespace:Samples.Modules.BusyIndicator.NavigationItems"

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/NavigationItems/BusyIndicatorNavItem.xaml.cs

@ -1,4 +1,22 @@
using System; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System;
using System.Windows.Controls; using System.Windows.Controls;
namespace Samples.Modules.BusyIndicator.NavigationItems namespace Samples.Modules.BusyIndicator.NavigationItems

44
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Properties/AssemblyInfo.cs

@ -1,25 +1,41 @@
using System.Reflection; /************************************************************************
using System.Resources;
using System.Runtime.CompilerServices; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.BusyIndicator")] [assembly: AssemblyTitle( "Samples.Modules.BusyIndicator" )]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct("Samples.Modules.BusyIndicator")] [assembly: AssemblyProduct( "Samples.Modules.BusyIndicator" )]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] [assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible( false )]
//In order to begin building localizable applications, set //In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion( "1.0.0.0" )]

38
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Resources/Common.xaml

@ -1,20 +1,38 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"> xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended">
<DataTemplate x:Key="SampleContent" > <DataTemplate x:Key="SampleContent">
<Grid Margin="10" > <Grid Margin="10">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="First Name:" Margin="2" VerticalAlignment="Center" /> <TextBlock Grid.Row="0" Text="First Name:" Margin="2" VerticalAlignment="Center" />

36
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorCustomContentTemplateView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.BusyIndicator.Views.BusyIndicatorCustomContentTemplateView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.BusyIndicator.Views.BusyIndicatorCustomContentTemplateView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -16,7 +34,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="This example demonstrates how to create a custom content template by setting the BusyContentTemplate property to an instance of a custom DataTemplate. Take notice of how the default ProgressBar is being hidden by setting the PrgressBarStyle property. The default OverlayStyle is also being set to a custom style." <TextBlock Text="This example demonstrates how to create a custom content template by setting the BusyContentTemplate property to an instance of a custom DataTemplate. Take notice of how the default ProgressBar is being hidden by setting the PrgressBarStyle property. The default OverlayStyle is also being set to a custom style."
@ -28,30 +46,30 @@
<extToolkit:BusyIndicator.BusyContentTemplate> <extToolkit:BusyIndicator.BusyContentTemplate>
<DataTemplate> <DataTemplate>
<StackPanel Margin="4"> <StackPanel Margin="4">
<TextBlock Text="Downloading Email" FontWeight="Bold" HorizontalAlignment="Center"/> <TextBlock Text="Downloading Email" FontWeight="Bold" HorizontalAlignment="Center" />
<StackPanel Margin="4"> <StackPanel Margin="4">
<TextBlock Text="Downloading message 4/10..."/> <TextBlock Text="Downloading message 4/10..." />
<ProgressBar Value="40" Height="15"/> <ProgressBar Value="40" Height="15" />
</StackPanel> </StackPanel>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Button Grid.Column="0" Content="Pause" HorizontalAlignment="Right" Margin="0 0 2 0"/> <Button Grid.Column="0" Content="Pause" HorizontalAlignment="Right" Margin="0 0 2 0" />
<Button Grid.Column="1" Content="Cancel" HorizontalAlignment="Left" Margin="2 0 0 0"/> <Button Grid.Column="1" Content="Cancel" HorizontalAlignment="Left" Margin="2 0 0 0" />
</Grid> </Grid>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</extToolkit:BusyIndicator.BusyContentTemplate> </extToolkit:BusyIndicator.BusyContentTemplate>
<extToolkit:BusyIndicator.OverlayStyle> <extToolkit:BusyIndicator.OverlayStyle>
<Style TargetType="Rectangle"> <Style TargetType="Rectangle">
<Setter Property="Fill" Value="#B1EB1D1D"/> <Setter Property="Fill" Value="#B1EB1D1D" />
</Style> </Style>
</extToolkit:BusyIndicator.OverlayStyle> </extToolkit:BusyIndicator.OverlayStyle>
<extToolkit:BusyIndicator.ProgressBarStyle> <extToolkit:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar"> <Style TargetType="ProgressBar">
<Setter Property="Visibility" Value="Collapsed"/> <Setter Property="Visibility" Value="Collapsed" />
</Style> </Style>
</extToolkit:BusyIndicator.ProgressBarStyle> </extToolkit:BusyIndicator.ProgressBarStyle>

23
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorCustomContentTemplateView.xaml.cs

@ -1,13 +1,30 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.BusyIndicator.Views namespace Samples.Modules.BusyIndicator.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for BusyIndicatorCustomContentTemplateView.xaml /// Interaction logic for BusyIndicatorCustomContentTemplateView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive=false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class BusyIndicatorCustomContentTemplateView : DemoView public partial class BusyIndicatorCustomContentTemplateView : DemoView
{ {
public BusyIndicatorCustomContentTemplateView() public BusyIndicatorCustomContentTemplateView()

24
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorCustomContentView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.BusyIndicator.Views.BusyIndicatorCustomContentView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.BusyIndicator.Views.BusyIndicatorCustomContentView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -16,7 +34,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="This example demonstrates how to define your own custom content. This is done by setting the BusyContent property." <TextBlock Text="This example demonstrates how to define your own custom content. This is done by setting the BusyContent property."
@ -26,7 +44,7 @@
<TextBlock Text="Custom Content:" Style="{StaticResource Header}" /> <TextBlock Text="Custom Content:" Style="{StaticResource Header}" />
<extToolkit:BusyIndicator IsBusy="True"> <extToolkit:BusyIndicator IsBusy="True">
<extToolkit:BusyIndicator.BusyContent> <extToolkit:BusyIndicator.BusyContent>
<StackPanel Orientation="Horizontal" > <StackPanel Orientation="Horizontal">
<Image Source="/Samples.Modules.BusyIndicator;component/Images/CdBurning32.png" /> <Image Source="/Samples.Modules.BusyIndicator;component/Images/CdBurning32.png" />
<StackPanel Margin="5,0"> <StackPanel Margin="5,0">
<TextBlock Text="Burning CD..." VerticalAlignment="Center" /> <TextBlock Text="Burning CD..." VerticalAlignment="Center" />

23
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorCustomContentView.xaml.cs

@ -1,13 +1,30 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.BusyIndicator.Views namespace Samples.Modules.BusyIndicator.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for BusyIndicatorCustomContentView.xaml /// Interaction logic for BusyIndicatorCustomContentView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive=false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class BusyIndicatorCustomContentView : DemoView public partial class BusyIndicatorCustomContentView : DemoView
{ {
public BusyIndicatorCustomContentView() public BusyIndicatorCustomContentView()

32
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.BusyIndicator.Views.BusyIndicatorView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.BusyIndicator.Views.BusyIndicatorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Samples.Modules.BusyIndicator.Views" xmlns:local="clr-namespace:Samples.Modules.BusyIndicator.Views"
@ -20,14 +38,14 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="BusyIndicator makes it easy to let the user know when an application is busy. Simply wrap the relevant content in an instance of the BusyIndicator control and toggle its IsBusy property to True during any long-running process." <TextBlock Text="BusyIndicator makes it easy to let the user know when an application is busy. Simply wrap the relevant content in an instance of the BusyIndicator control and toggle its IsBusy property to True during any long-running process."
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" > <GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5"> <Grid Margin="5">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -38,20 +56,20 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="IsBusy:" VerticalAlignment="Center" Margin="2"/> <TextBlock Text="IsBusy:" VerticalAlignment="Center" Margin="2" />
<CheckBox x:Name="_isBusy" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="When true shows the BusyIndicator" /> <CheckBox x:Name="_isBusy" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="When true shows the BusyIndicator" />
<TextBlock Text="DisplayAfter:" Grid.Row="1" VerticalAlignment="Center" Margin="2"/> <TextBlock Text="DisplayAfter:" Grid.Row="1" VerticalAlignment="Center" Margin="2" />
<StackPanel Grid.Row="1" Grid.Column="1" Margin="5" HorizontalAlignment="Left" Orientation="Horizontal"> <StackPanel Grid.Row="1" Grid.Column="1" Margin="5" HorizontalAlignment="Left" Orientation="Horizontal">
<extToolkit:IntegerUpDown x:Name="_displayAfter" Width="65" VerticalAlignment="Center" Minimum="0" Increment="100" Value="0" ToolTip="Sets the TimeSpan to wait until the BusyIndicator is displayed." /> <extToolkit:IntegerUpDown x:Name="_displayAfter" Width="65" VerticalAlignment="Center" Minimum="0" Increment="100" Value="0" ToolTip="Sets the TimeSpan to wait until the BusyIndicator is displayed." />
<TextBlock Text="milliseconds" Margin="5,0" VerticalAlignment="Center"/> <TextBlock Text="milliseconds" Margin="5,0" VerticalAlignment="Center" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</GroupBox> </GroupBox>
<StackPanel Grid.Row="2" Margin="10"> <StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> <TextBlock Text="Usage:" Style="{StaticResource Header}" />
<extToolkit:BusyIndicator IsBusy="{Binding IsChecked, ElementName=_isBusy}" DisplayAfter="{Binding Value, ElementName=_displayAfter, Converter={StaticResource TimeSpanConverter}}" > <extToolkit:BusyIndicator IsBusy="{Binding IsChecked, ElementName=_isBusy}" DisplayAfter="{Binding Value, ElementName=_displayAfter, Converter={StaticResource TimeSpanConverter}}">
<ContentControl ContentTemplate="{StaticResource SampleContent}" /> <ContentControl ContentTemplate="{StaticResource SampleContent}" />
</extToolkit:BusyIndicator> </extToolkit:BusyIndicator>
</StackPanel> </StackPanel>

32
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.BusyIndicator/Views/BusyIndicatorView.xaml.cs

@ -1,14 +1,32 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
using Microsoft.Practices.Prism.Regions; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System;
using System.Windows.Data; using System.Windows.Data;
using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.BusyIndicator.Views namespace Samples.Modules.BusyIndicator.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for HomeView.xaml /// Interaction logic for HomeView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive=false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class BusyIndicatorView : DemoView public partial class BusyIndicatorView : DemoView
{ {
public BusyIndicatorView() public BusyIndicatorView()
@ -19,12 +37,12 @@ namespace Samples.Modules.BusyIndicator.Views
public class IntegerToTimespanConverter : IValueConverter public class IntegerToTimespanConverter : IValueConverter
{ {
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{ {
return TimeSpan.FromMilliseconds((int)value); return TimeSpan.FromMilliseconds( ( int )value );
} }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

41
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/ButtonModule.cs

@ -1,30 +1,49 @@
using System; /************************************************************************
using Samples.Infrastructure;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity; using Microsoft.Practices.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions; using Samples.Infrastructure.Extensions;
using Samples.Modules.Button.Views;
using Samples.Modules.Button.NavigationItems; using Samples.Modules.Button.NavigationItems;
using Samples.Modules.Button.Views;
namespace Samples.Modules.Button namespace Samples.Modules.Button
{ {
public class ButtonModule : ModuleBase public class ButtonModule : ModuleBase
{ {
public ButtonModule(IUnityContainer container, IRegionManager regionManager) public ButtonModule( IUnityContainer container, IRegionManager regionManager )
: base(container, regionManager) { } : base( container, regionManager )
{
}
protected override void InitializeModule() protected override void InitializeModule()
{ {
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(ButtonSpinnerNavItem)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( ButtonSpinnerNavItem ) );
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(DropDownButtonNavItem)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( DropDownButtonNavItem ) );
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(SplitButtonNavItem)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( SplitButtonNavItem ) );
} }
protected override void RegisterViewsAndTypes() protected override void RegisterViewsAndTypes()
{ {
Container.RegisterNavigationType(typeof(ButtonSpinnerView)); Container.RegisterNavigationType( typeof( ButtonSpinnerView ) );
Container.RegisterNavigationType(typeof(DropDownButtonView)); Container.RegisterNavigationType( typeof( DropDownButtonView ) );
Container.RegisterNavigationType(typeof(SplitButtonView)); Container.RegisterNavigationType( typeof( SplitButtonView ) );
} }
} }
} }

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/ButtonSpinnerNavItem.xaml

@ -1,4 +1,22 @@
<TreeViewItem x:Class="Samples.Modules.Button.NavigationItems.ButtonSpinnerNavItem" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.Button.NavigationItems.ButtonSpinnerNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.Button.NavigationItems" xmlns:navItems="clr-namespace:Samples.Modules.Button.NavigationItems"

19
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/ButtonSpinnerNavItem.xaml.cs

@ -1,4 +1,21 @@
using System; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; using System.Windows.Controls;
namespace Samples.Modules.Button.NavigationItems namespace Samples.Modules.Button.NavigationItems

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/DropDownButtonNavItem.xaml

@ -1,4 +1,22 @@
<TreeViewItem x:Class="Samples.Modules.Button.NavigationItems.DropDownButtonNavItem" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.Button.NavigationItems.DropDownButtonNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.Button.NavigationItems" xmlns:navItems="clr-namespace:Samples.Modules.Button.NavigationItems"

19
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/DropDownButtonNavItem.xaml.cs

@ -1,4 +1,21 @@
using System; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; using System.Windows.Controls;
namespace Samples.Modules.Button.NavigationItems namespace Samples.Modules.Button.NavigationItems

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/SplitButtonNavItem.xaml

@ -1,4 +1,22 @@
<TreeViewItem x:Class="Samples.Modules.Button.NavigationItems.SplitButtonNavItem" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.Button.NavigationItems.SplitButtonNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.Button.NavigationItems" xmlns:navItems="clr-namespace:Samples.Modules.Button.NavigationItems"

19
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/NavigationItems/SplitButtonNavItem.xaml.cs

@ -1,4 +1,21 @@
using System; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; using System.Windows.Controls;
namespace Samples.Modules.Button.NavigationItems namespace Samples.Modules.Button.NavigationItems

44
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Properties/AssemblyInfo.cs

@ -1,25 +1,41 @@
using System.Reflection; /************************************************************************
using System.Resources;
using System.Runtime.CompilerServices; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Button")] [assembly: AssemblyTitle( "Samples.Modules.Button" )]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct("Samples.Modules.Button")] [assembly: AssemblyProduct( "Samples.Modules.Button" )]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] [assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible( false )]
//In order to begin building localizable applications, set //In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion( "1.0.0.0" )]

36
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/ButtonSpinnerView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.Button.Views.ButtonSpinnerView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.Button.Views.ButtonSpinnerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -8,13 +26,13 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="The ButtonSpinner control allows you to add button spinners to any element and then respond to the Spin event to manipulate that element. The Spin event lets the developer know which direction the buttons are spinning; SpinDirection.Increase indicates an increment, SpinDirection.Decrease indicates a decrement." <TextBlock Text="The ButtonSpinner control allows you to add button spinners to any element and then respond to the Spin event to manipulate that element. The Spin event lets the developer know which direction the buttons are spinning; SpinDirection.Increase indicates an increment, SpinDirection.Decrease indicates a decrement."
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" > <GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5"> <Grid Margin="5">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -26,22 +44,24 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="AllowSpin:" VerticalAlignment="Center" /> <TextBlock Text="AllowSpin:" VerticalAlignment="Center" />
<CheckBox x:Name="_allowSpin" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="When true allows the ButtonSpinner to perform increment/decrement operations."/> <CheckBox x:Name="_allowSpin" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="When true allows the ButtonSpinner to perform increment/decrement operations." />
<TextBlock Text="ShowButtonSpinner:" VerticalAlignment="Center" Grid.Row="1" /> <TextBlock Text="ShowButtonSpinner:" VerticalAlignment="Center" Grid.Row="1" />
<CheckBox x:Name="_showButtonSpinner" Grid.Row="1" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Gets/Sets the visibility of the button spinners."/> <CheckBox x:Name="_showButtonSpinner" Grid.Row="1" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Gets/Sets the visibility of the button spinners." />
</Grid> </Grid>
</GroupBox> </GroupBox>
<StackPanel Grid.Row="2" Margin="10"> <StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> <TextBlock Text="Usage:" Style="{StaticResource Header}" />
<TextBlock Text="You can wrap any element by placing it inside the content area of the ButtonSpinner control. As an example, lets create our own simple numeric up/down control" <TextBlock Text="You can wrap any element by placing it inside the content area of the ButtonSpinner control. As an example, lets create our own simple numeric up/down control"
TextWrapping="Wrap"/> TextWrapping="Wrap" />
<extToolkit:ButtonSpinner Margin="10" Width="150" HorizontalAlignment="Left" <extToolkit:ButtonSpinner Margin="10"
Width="150"
HorizontalAlignment="Left"
AllowSpin="{Binding IsChecked, ElementName=_allowSpin}" AllowSpin="{Binding IsChecked, ElementName=_allowSpin}"
ShowButtonSpinner="{Binding IsChecked, ElementName=_showButtonSpinner}" ShowButtonSpinner="{Binding IsChecked, ElementName=_showButtonSpinner}"
Spin="ButtonSpinner_Spin" > Spin="ButtonSpinner_Spin">
<TextBox Text="0" BorderThickness="0" HorizontalContentAlignment="Right" /> <TextBox Text="0" BorderThickness="0" HorizontalContentAlignment="Right" />
</extToolkit:ButtonSpinner> </extToolkit:ButtonSpinner>
</StackPanel> </StackPanel>

36
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/ButtonSpinnerView.xaml.cs

@ -1,15 +1,33 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System;
using System.Windows.Controls;
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Microsoft.Windows.Controls; using Microsoft.Windows.Controls;
using System.Windows.Controls; using Samples.Infrastructure.Controls;
namespace Samples.Modules.Button.Views namespace Samples.Modules.Button.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for ButtonSpinnerView.xaml /// Interaction logic for ButtonSpinnerView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class ButtonSpinnerView : DemoView public partial class ButtonSpinnerView : DemoView
{ {
public ButtonSpinnerView() public ButtonSpinnerView()
@ -17,15 +35,15 @@ namespace Samples.Modules.Button.Views
InitializeComponent(); InitializeComponent();
} }
private void ButtonSpinner_Spin(object sender, Microsoft.Windows.Controls.SpinEventArgs e) private void ButtonSpinner_Spin( object sender, Microsoft.Windows.Controls.SpinEventArgs e )
{ {
ButtonSpinner spinner = (ButtonSpinner)sender; ButtonSpinner spinner = ( ButtonSpinner )sender;
TextBox txtBox = (TextBox)spinner.Content; TextBox txtBox = ( TextBox )spinner.Content;
try try
{ {
int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text); int value = String.IsNullOrEmpty( txtBox.Text ) ? 0 : Convert.ToInt32( txtBox.Text );
if (e.Direction == Microsoft.Windows.Controls.SpinDirection.Increase) if( e.Direction == Microsoft.Windows.Controls.SpinDirection.Increase )
value++; value++;
else else
value--; value--;

26
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/DropDownButtonView.xaml

@ -1,20 +1,38 @@
<infControls:DemoView x:Class="Samples.Modules.Button.Views.DropDownButtonView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.Button.Views.DropDownButtonView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="DropDownButton" > Title="DropDownButton">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="The DropDownButton control is a button that when clicked displays a drop down in which you can place any custom content within." <TextBlock Text="The DropDownButton control is a button that when clicked displays a drop down in which you can place any custom content within."
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" > <GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5"> <Grid Margin="5">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />

27
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/DropDownButtonView.xaml.cs

@ -1,13 +1,30 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Button.Views namespace Samples.Modules.Button.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for DropDownButtonView.xaml /// Interaction logic for DropDownButtonView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class DropDownButtonView : DemoView public partial class DropDownButtonView : DemoView
{ {
public DropDownButtonView() public DropDownButtonView()
@ -15,12 +32,12 @@ namespace Samples.Modules.Button.Views
InitializeComponent(); InitializeComponent();
} }
private void DropDownButton_Click(object sender, System.Windows.RoutedEventArgs e) private void DropDownButton_Click( object sender, System.Windows.RoutedEventArgs e )
{ {
} }
private void Button_Click(object sender, System.Windows.RoutedEventArgs e) private void Button_Click( object sender, System.Windows.RoutedEventArgs e )
{ {
_dropDownButton.IsOpen = false; _dropDownButton.IsOpen = false;
} }

27
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/SplitButtonView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.Button.Views.SplitButtonView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.Button.Views.SplitButtonView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -8,13 +26,13 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within." <TextBlock Text="The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within."
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" > <GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5"> <Grid Margin="5">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -26,7 +44,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="IsOpen: " VerticalAlignment="Center" /> <TextBlock Text="IsOpen: " VerticalAlignment="Center" />
<CheckBox x:Name="_isOpen" Grid.Column="1" IsChecked="False" VerticalAlignment="Center" Margin="5" ClickMode="Press" ToolTip="Get/Sets a value indicating whether or not the drop down is open."/> <CheckBox x:Name="_isOpen" Grid.Column="1" IsChecked="False" VerticalAlignment="Center" Margin="5" ClickMode="Press" ToolTip="Get/Sets a value indicating whether or not the drop down is open." />
</Grid> </Grid>
</GroupBox> </GroupBox>
@ -41,7 +59,6 @@
</StackPanel> </StackPanel>
</extToolkit:SplitButton.DropDownContent> </extToolkit:SplitButton.DropDownContent>
</extToolkit:SplitButton> </extToolkit:SplitButton>
</StackPanel> </StackPanel>
</Grid> </Grid>
</infControls:DemoView> </infControls:DemoView>

29
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Button/Views/SplitButtonView.xaml.cs

@ -1,13 +1,30 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Button.Views namespace Samples.Modules.Button.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for SplitButtonView.xaml /// Interaction logic for SplitButtonView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class SplitButtonView : DemoView public partial class SplitButtonView : DemoView
{ {
public SplitButtonView() public SplitButtonView()
@ -15,12 +32,12 @@ namespace Samples.Modules.Button.Views
InitializeComponent(); InitializeComponent();
} }
private void SplitButton_Click(object sender, System.Windows.RoutedEventArgs e) private void SplitButton_Click( object sender, System.Windows.RoutedEventArgs e )
{ {
Microsoft.Windows.Controls.MessageBox.Show("Thanks for clicking me!", "SplitButton Click"); Microsoft.Windows.Controls.MessageBox.Show( "Thanks for clicking me!", "SplitButton Click" );
} }
private void Button_Click(object sender, System.Windows.RoutedEventArgs e) private void Button_Click( object sender, System.Windows.RoutedEventArgs e )
{ {
_splitButton.IsOpen = false; _splitButton.IsOpen = false;
} }

37
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/CalculatorModule.cs

@ -1,28 +1,47 @@
using System; /************************************************************************
using Samples.Infrastructure;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity; using Microsoft.Practices.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions; using Samples.Infrastructure.Extensions;
using Samples.Modules.Calculator.Views;
using Samples.Modules.Calculator.NavigationItems; using Samples.Modules.Calculator.NavigationItems;
using Samples.Modules.Calculator.Views;
namespace Samples.Modules.Calculator namespace Samples.Modules.Calculator
{ {
public class CalculatorModule : ModuleBase public class CalculatorModule : ModuleBase
{ {
public CalculatorModule(IUnityContainer container, IRegionManager regionManager) public CalculatorModule( IUnityContainer container, IRegionManager regionManager )
: base(container, regionManager) { } : base( container, regionManager )
{
}
protected override void InitializeModule() protected override void InitializeModule()
{ {
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(CalculatorNavItem)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( CalculatorNavItem ) );
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(CalculatorUpDownNavItem)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( CalculatorUpDownNavItem ) );
} }
protected override void RegisterViewsAndTypes() protected override void RegisterViewsAndTypes()
{ {
Container.RegisterNavigationType(typeof(CalculatorView)); Container.RegisterNavigationType( typeof( CalculatorView ) );
Container.RegisterNavigationType(typeof(CalculatorUpDownView)); Container.RegisterNavigationType( typeof( CalculatorUpDownView ) );
} }
} }
} }

22
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/NavigationItems/CalculatorNavItem.xaml

@ -1,9 +1,27 @@
<TreeViewItem x:Class="Samples.Modules.Calculator.NavigationItems.CalculatorNavItem" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.Calculator.NavigationItems.CalculatorNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.Calculator.NavigationItems" xmlns:navItems="clr-namespace:Samples.Modules.Calculator.NavigationItems"
xmlns:views="clr-namespace:Samples.Modules.Calculator.Views" xmlns:views="clr-namespace:Samples.Modules.Calculator.Views"
Header="Calculator" Tag="{x:Type views:CalculatorView}" > Header="Calculator" Tag="{x:Type views:CalculatorView}">
<TreeViewItem.Resources> <TreeViewItem.Resources>
<Style TargetType="navItems:CalculatorNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> <Style TargetType="navItems:CalculatorNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />

19
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/NavigationItems/CalculatorNavItem.xaml.cs

@ -1,4 +1,21 @@
using System; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; using System.Windows.Controls;
namespace Samples.Modules.Calculator.NavigationItems namespace Samples.Modules.Calculator.NavigationItems

22
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/NavigationItems/CalculatorUpDownNavItem.xaml

@ -1,9 +1,27 @@
<TreeViewItem x:Class="Samples.Modules.Calculator.NavigationItems.CalculatorUpDownNavItem" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.Calculator.NavigationItems.CalculatorUpDownNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.Calculator.NavigationItems" xmlns:navItems="clr-namespace:Samples.Modules.Calculator.NavigationItems"
xmlns:views="clr-namespace:Samples.Modules.Calculator.Views" xmlns:views="clr-namespace:Samples.Modules.Calculator.Views"
Header="CalculatorUpDown" Tag="{x:Type views:CalculatorUpDownView}" > Header="CalculatorUpDown" Tag="{x:Type views:CalculatorUpDownView}">
<TreeViewItem.Resources> <TreeViewItem.Resources>
<Style TargetType="navItems:CalculatorUpDownNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> <Style TargetType="navItems:CalculatorUpDownNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />

19
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/NavigationItems/CalculatorUpDownNavItem.xaml.cs

@ -1,4 +1,21 @@
using System; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; using System.Windows.Controls;
namespace Samples.Modules.Calculator.NavigationItems namespace Samples.Modules.Calculator.NavigationItems

44
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/Properties/AssemblyInfo.cs

@ -1,25 +1,41 @@
using System.Reflection; /************************************************************************
using System.Resources;
using System.Runtime.CompilerServices; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Caclulator")] [assembly: AssemblyTitle( "Samples.Modules.Caclulator" )]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct("Samples.Modules.Caclulator")] [assembly: AssemblyProduct( "Samples.Modules.Caclulator" )]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] [assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible( false )]
//In order to begin building localizable applications, set //In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion( "1.0.0.0" )]

32
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/Views/CalculatorUpDownView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.Calculator.Views.CalculatorUpDownView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.Calculator.Views.CalculatorUpDownView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -8,13 +26,13 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations." <TextBlock Text="The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations."
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" > <GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5" HorizontalAlignment="Left"> <Grid Margin="5" HorizontalAlignment="Left">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -29,7 +47,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="Precision: " VerticalAlignment="Center" /> <TextBlock Text="Precision: " VerticalAlignment="Center" />
<extToolkit:IntegerUpDown x:Name="_precision" Grid.Column="1" Width="75" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Minimum="0" Value="2" ToolTip="Gets/Sets the maximum number of digits displayed to the right of the decimal point." /> <extToolkit:IntegerUpDown x:Name="_precision" Grid.Column="1" Width="75" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Minimum="0" Value="2" ToolTip="Gets/Sets the maximum number of digits displayed to the right of the decimal point." />
<TextBlock Text="FormatString:" Grid.Row="1" VerticalAlignment="Center"/> <TextBlock Text="FormatString:" Grid.Row="1" VerticalAlignment="Center" />
<ComboBox x:Name="_formatString" SelectedIndex="0" Grid.Row="1" Grid.Column="1" Width="150" Margin="5"> <ComboBox x:Name="_formatString" SelectedIndex="0" Grid.Row="1" Grid.Column="1" Width="150" Margin="5">
<ComboBoxItem Tag="C2">Currency</ComboBoxItem> <ComboBoxItem Tag="C2">Currency</ComboBoxItem>
<ComboBoxItem Tag="F2">Fixed Point</ComboBoxItem> <ComboBoxItem Tag="F2">Fixed Point</ComboBoxItem>
@ -37,8 +55,8 @@
<ComboBoxItem Tag="N">Number</ComboBoxItem> <ComboBoxItem Tag="N">Number</ComboBoxItem>
<ComboBoxItem Tag="P2">Percent</ComboBoxItem> <ComboBoxItem Tag="P2">Percent</ComboBoxItem>
</ComboBox> </ComboBox>
<TextBlock Text="Watermakr:" Grid.Row="2" VerticalAlignment="Center"/> <TextBlock Text="Watermakr:" Grid.Row="2" VerticalAlignment="Center" />
<TextBox x:Name="_watermark" Grid.Row="2" Grid.Column="1" Width="150" Margin="5" Text="Enter Value"/> <TextBox x:Name="_watermark" Grid.Row="2" Grid.Column="1" Width="150" Margin="5" Text="Enter Value" />
<TextBlock Grid.Column="2" Text="Increment" VerticalAlignment="Center" /> <TextBlock Grid.Column="2" Text="Increment" VerticalAlignment="Center" />
<TextBlock Grid.Column="2" Grid.Row="1" Text="Minimum" VerticalAlignment="Center" /> <TextBlock Grid.Column="2" Grid.Row="1" Text="Minimum" VerticalAlignment="Center" />
<TextBlock Grid.Column="2" Grid.Row="2" Text="Maximum" VerticalAlignment="Center" /> <TextBlock Grid.Column="2" Grid.Row="2" Text="Maximum" VerticalAlignment="Center" />
@ -56,7 +74,7 @@
Minimum="{Binding Value, ElementName=_minimum}" Minimum="{Binding Value, ElementName=_minimum}"
Precision="{Binding Value, ElementName=_precision}" Precision="{Binding Value, ElementName=_precision}"
FormatString="{Binding SelectedItem.Tag, ElementName=_formatString}" FormatString="{Binding SelectedItem.Tag, ElementName=_formatString}"
Watermark="{Binding Text, ElementName=_watermark}"/> Watermark="{Binding Text, ElementName=_watermark}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</infControls:DemoView> </infControls:DemoView>

23
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/Views/CalculatorUpDownView.xaml.cs

@ -1,13 +1,30 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Calculator.Views namespace Samples.Modules.Calculator.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for CalculatorUpDownView.xaml /// Interaction logic for CalculatorUpDownView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class CalculatorUpDownView : DemoView public partial class CalculatorUpDownView : DemoView
{ {
public CalculatorUpDownView() public CalculatorUpDownView()

26
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/Views/CalculatorView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.Calculator.Views.CalculatorView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.Calculator.Views.CalculatorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -8,13 +26,13 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="The Calculator is a control used for performing mathematical calculations." <TextBlock Text="The Calculator is a control used for performing mathematical calculations."
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" > <GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5"> <Grid Margin="5">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -32,7 +50,7 @@
<StackPanel Grid.Row="2" Margin="10"> <StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> <TextBlock Text="Usage:" Style="{StaticResource Header}" />
<TextBlock Text="When the Calculator has focus, you can use the keyboard to interact with the key pad. Click the Calculator to give focus." Margin="10,0"/> <TextBlock Text="When the Calculator has focus, you can use the keyboard to interact with the key pad. Click the Calculator to give focus." Margin="10,0" />
<extToolkit:Calculator Margin="10" Width="250" Precision="{Binding Value, ElementName=_precision}" /> <extToolkit:Calculator Margin="10" Width="250" Precision="{Binding Value, ElementName=_precision}" />
</StackPanel> </StackPanel>
</Grid> </Grid>

23
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Caclulator/Views/CalculatorView.xaml.cs

@ -1,13 +1,30 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Calculator.Views namespace Samples.Modules.Calculator.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for CalculatorView.xaml /// Interaction logic for CalculatorView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class CalculatorView : DemoView public partial class CalculatorView : DemoView
{ {
public CalculatorView() public CalculatorView()

33
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/ChildWindowModule.cs

@ -1,25 +1,44 @@
using System; /************************************************************************
using Microsoft.Practices.Unity;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using Samples.Infrastructure; using Samples.Infrastructure;
using Samples.Infrastructure.Extensions; using Samples.Infrastructure.Extensions;
using Samples.Modules.ChildWindow.Views; using Samples.Modules.ChildWindow.Views;
namespace Samples.Modules.ChildWindow namespace Samples.Modules.ChildWindow
{ {
public class ChildWindowModule: ModuleBase public class ChildWindowModule : ModuleBase
{ {
public ChildWindowModule(IUnityContainer container, IRegionManager regionManager) public ChildWindowModule( IUnityContainer container, IRegionManager regionManager )
: base(container, regionManager) { } : base( container, regionManager )
{
}
protected override void InitializeModule() protected override void InitializeModule()
{ {
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
} }
protected override void RegisterViewsAndTypes() protected override void RegisterViewsAndTypes()
{ {
Container.RegisterNavigationType(typeof(HomeView)); Container.RegisterNavigationType( typeof( HomeView ) );
} }
} }
} }

44
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/Properties/AssemblyInfo.cs

@ -1,25 +1,41 @@
using System.Reflection; /************************************************************************
using System.Resources;
using System.Runtime.CompilerServices; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.ChildWindow")] [assembly: AssemblyTitle( "Samples.Modules.ChildWindow" )]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct("Samples.Modules.ChildWindow")] [assembly: AssemblyProduct( "Samples.Modules.ChildWindow" )]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] [assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible( false )]
//In order to begin building localizable applications, set //In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion( "1.0.0.0" )]

46
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/Views/HomeView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.ChildWindow.Views.HomeView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.ChildWindow.Views.HomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -8,15 +26,15 @@
<infControls:DemoView.Resources> <infControls:DemoView.Resources>
<ObjectDataProvider x:Key="WindowStates" MethodName="GetValues" <ObjectDataProvider x:Key="WindowStates" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}" > ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters> <ObjectDataProvider.MethodParameters>
<x:Type TypeName="extToolkit:WindowState"/> <x:Type TypeName="extToolkit:WindowState" />
</ObjectDataProvider.MethodParameters> </ObjectDataProvider.MethodParameters>
</ObjectDataProvider> </ObjectDataProvider>
<ObjectDataProvider x:Key="WindowStartupLocations" MethodName="GetValues" <ObjectDataProvider x:Key="WindowStartupLocations" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}" > ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters> <ObjectDataProvider.MethodParameters>
<x:Type TypeName="extToolkit:WindowStartupLocation"/> <x:Type TypeName="extToolkit:WindowStartupLocation" />
</ObjectDataProvider.MethodParameters> </ObjectDataProvider.MethodParameters>
</ObjectDataProvider> </ObjectDataProvider>
</infControls:DemoView.Resources> </infControls:DemoView.Resources>
@ -25,13 +43,13 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="ChildWindow description goes here." <TextBlock Text="ChildWindow description goes here."
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" > <GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5"> <Grid Margin="5">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -78,15 +96,15 @@
<Grid Margin="10" > <Grid Margin="10" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="First Name:" Margin="2" VerticalAlignment="Center" /> <TextBlock Grid.Row="0" Text="First Name:" Margin="2" VerticalAlignment="Center" />

23
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/Views/HomeView.xaml.cs

@ -1,13 +1,30 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.ChildWindow.Views namespace Samples.Modules.ChildWindow.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for HomeView.xaml /// Interaction logic for HomeView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView public partial class HomeView : DemoView
{ {
public HomeView() public HomeView()

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/Views/NavigationView.xaml

@ -1,4 +1,22 @@
<TreeViewItem x:Class="Samples.Modules.ChildWindow.Views.NavigationView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.ChildWindow.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.ChildWindow.Views" xmlns:views="clr-namespace:Samples.Modules.ChildWindow.Views"

30
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.ChildWindow/Views/NavigationView.xaml.cs

@ -1,16 +1,22 @@
using System; /************************************************************************
using System.Collections.Generic;
using System.Linq; Extended WPF Toolkit
using System.Text;
using System.Windows; Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; 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.ChildWindow.Views namespace Samples.Modules.ChildWindow.Views
{ {

33
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/ColorModule.cs

@ -1,6 +1,23 @@
using System; /************************************************************************
using Microsoft.Practices.Unity;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using Samples.Infrastructure; using Samples.Infrastructure;
using Samples.Infrastructure.Extensions; using Samples.Infrastructure.Extensions;
using Samples.Modules.Color.Views; using Samples.Modules.Color.Views;
@ -8,19 +25,21 @@ using Samples.Modules.Color.Views;
namespace Samples.Modules.Color namespace Samples.Modules.Color
{ {
public class ColorModule: ModuleBase public class ColorModule : ModuleBase
{ {
public ColorModule(IUnityContainer container, IRegionManager regionManager) public ColorModule( IUnityContainer container, IRegionManager regionManager )
: base(container, regionManager) { } : base( container, regionManager )
{
}
protected override void InitializeModule() protected override void InitializeModule()
{ {
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
} }
protected override void RegisterViewsAndTypes() protected override void RegisterViewsAndTypes()
{ {
Container.RegisterNavigationType(typeof(HomeView)); Container.RegisterNavigationType( typeof( HomeView ) );
} }
} }
} }

44
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/Properties/AssemblyInfo.cs

@ -1,25 +1,41 @@
using System.Reflection; /************************************************************************
using System.Resources;
using System.Runtime.CompilerServices; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Color")] [assembly: AssemblyTitle( "Samples.Modules.Color" )]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct("Samples.Modules.Color")] [assembly: AssemblyProduct( "Samples.Modules.Color" )]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] [assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible( false )]
//In order to begin building localizable applications, set //In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion( "1.0.0.0" )]

31
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/Views/HomeView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.Color.Views.HomeView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.Color.Views.HomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -24,11 +42,13 @@
</DataGrid>--> </DataGrid>-->
<StackPanel> <StackPanel>
<extToolkit:CheckComboBox x:Name="_combo" HorizontalAlignment="Center" VerticalAlignment="Center" <extToolkit:CheckComboBox x:Name="_combo"
HorizontalAlignment="Center"
VerticalAlignment="Center"
DisplayMemberPath="Color" DisplayMemberPath="Color"
ValueMemberPath="Level" ValueMemberPath="Level"
SelectedValue="{Binding SelectedValue}" SelectedValue="{Binding SelectedValue}"
SelectedItems="{Binding SelectedItems}"/> SelectedItems="{Binding SelectedItems}" />
<!--<extToolkit:CheckComboBox x:Name="_combo" HorizontalAlignment="Center" VerticalAlignment="Center" <!--<extToolkit:CheckComboBox x:Name="_combo" HorizontalAlignment="Center" VerticalAlignment="Center"
SelectedValue="{Binding SelectedValues}" />--> SelectedValue="{Binding SelectedValues}" />-->
@ -38,12 +58,13 @@
DisplayMemberPath="Color" DisplayMemberPath="Color"
/>--> />-->
<extToolkit:CheckListBox x:Name="_listBox" Height="250" <extToolkit:CheckListBox x:Name="_listBox"
Height="250"
DisplayMemberPath="Color" DisplayMemberPath="Color"
ValueMemberPath="Level" ValueMemberPath="Level"
SelectedMemberPath="IsSelected" SelectedMemberPath="IsSelected"
SelectedValue="{Binding SelectedValue}" SelectedValue="{Binding SelectedValue}"
SelectedItems="{Binding SelectedItems}"/> SelectedItems="{Binding SelectedItems}" />
<!--<extToolkit:CheckListBox x:Name="_listBox" Height="250" <!--<extToolkit:CheckListBox x:Name="_listBox" Height="250"
SelectedValue="{Binding SelectedValues}" SelectedValue="{Binding SelectedValues}"

128
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/Views/HomeView.xaml.cs

@ -1,16 +1,33 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
using Microsoft.Practices.Prism.Regions; Extended WPF Toolkit
using System.ComponentModel;
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Color.Views namespace Samples.Modules.Color.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for HomeView.xaml /// Interaction logic for HomeView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView public partial class HomeView : DemoView
{ {
public HomeView() public HomeView()
@ -33,26 +50,32 @@ namespace Samples.Modules.Color.Views
List<Person> colors = new List<Person>(); List<Person> colors = new List<Person>();
colors.Add(new Person(System.Windows.Media.Colors.Red, 0)); colors.Add( new Person( System.Windows.Media.Colors.Red, 0 ) );
colors.Add(new Person(System.Windows.Media.Colors.Purple, 1) { IsSelected = true }); colors.Add( new Person( System.Windows.Media.Colors.Purple, 1 )
colors.Add(new Person(System.Windows.Media.Colors.Coral, 2)); {
colors.Add(new Person(System.Windows.Media.Colors.MidnightBlue, 3) { IsSelected = true }); IsSelected = true
colors.Add(new Person(System.Windows.Media.Colors.Green, 4)); } );
colors.Add(new Person(System.Windows.Media.Colors.Red, 5)); colors.Add( new Person( System.Windows.Media.Colors.Coral, 2 ) );
colors.Add(new Person(System.Windows.Media.Colors.Purple, 6)); colors.Add( new Person( System.Windows.Media.Colors.MidnightBlue, 3 )
colors.Add(new Person(System.Windows.Media.Colors.SaddleBrown, 7)); {
colors.Add(new Person(System.Windows.Media.Colors.MidnightBlue, 8)); IsSelected = true
colors.Add(new Person(System.Windows.Media.Colors.Green, 9)); } );
colors.Add(new Person(System.Windows.Media.Colors.Red, 10)); colors.Add( new Person( System.Windows.Media.Colors.Green, 4 ) );
colors.Add(new Person(System.Windows.Media.Colors.Purple, 11)); colors.Add( new Person( System.Windows.Media.Colors.Red, 5 ) );
colors.Add(new Person(System.Windows.Media.Colors.SaddleBrown, 12)); colors.Add( new Person( System.Windows.Media.Colors.Purple, 6 ) );
colors.Add(new Person(System.Windows.Media.Colors.MidnightBlue, 13)); colors.Add( new Person( System.Windows.Media.Colors.SaddleBrown, 7 ) );
colors.Add(new Person(System.Windows.Media.Colors.Green, 14)); colors.Add( new Person( System.Windows.Media.Colors.MidnightBlue, 8 ) );
colors.Add(new Person(System.Windows.Media.Colors.Red, 15)); colors.Add( new Person( System.Windows.Media.Colors.Green, 9 ) );
colors.Add(new Person(System.Windows.Media.Colors.Purple, 16)); colors.Add( new Person( System.Windows.Media.Colors.Red, 10 ) );
colors.Add(new Person(System.Windows.Media.Colors.SaddleBrown, 17)); colors.Add( new Person( System.Windows.Media.Colors.Purple, 11 ) );
colors.Add(new Person(System.Windows.Media.Colors.MidnightBlue, 18)); colors.Add( new Person( System.Windows.Media.Colors.SaddleBrown, 12 ) );
colors.Add(new Person(System.Windows.Media.Colors.Green, 19)); colors.Add( new Person( System.Windows.Media.Colors.MidnightBlue, 13 ) );
colors.Add( new Person( System.Windows.Media.Colors.Green, 14 ) );
colors.Add( new Person( System.Windows.Media.Colors.Red, 15 ) );
colors.Add( new Person( System.Windows.Media.Colors.Purple, 16 ) );
colors.Add( new Person( System.Windows.Media.Colors.SaddleBrown, 17 ) );
colors.Add( new Person( System.Windows.Media.Colors.MidnightBlue, 18 ) );
colors.Add( new Person( System.Windows.Media.Colors.Green, 19 ) );
//_dataGrid.ItemsSource = colors; //_dataGrid.ItemsSource = colors;
//_chk.ItemsSource = colors; //_chk.ItemsSource = colors;
@ -63,13 +86,13 @@ namespace Samples.Modules.Color.Views
//_listBox.SelectedValue = "1,3,5,7,9,"; //_listBox.SelectedValue = "1,3,5,7,9,";
} }
private void Button_Click(object sender, System.Windows.RoutedEventArgs e) private void Button_Click( object sender, System.Windows.RoutedEventArgs e )
{ {
(DataContext as Data).SelectedValue = "1,3,5,7,9,"; ( DataContext as Data ).SelectedValue = "1,3,5,7,9,";
} }
} }
public class Data: INotifyPropertyChanged public class Data : INotifyPropertyChanged
{ {
private string _selectedValues;// = "1,3,5,7,9,"; private string _selectedValues;// = "1,3,5,7,9,";
public string SelectedValue public string SelectedValue
@ -81,18 +104,21 @@ namespace Samples.Modules.Color.Views
set set
{ {
_selectedValues = value; _selectedValues = value;
OnPropertyChanged("SelectedValue"); OnPropertyChanged( "SelectedValue" );
} }
} }
private ObservableCollection<Person> _selectedItems = new ObservableCollection<Person>(); private ObservableCollection<Person> _selectedItems = new ObservableCollection<Person>();
public ObservableCollection<Person> SelectedItems public ObservableCollection<Person> SelectedItems
{ {
get { return _selectedItems; } get
{
return _selectedItems;
}
set set
{ {
_selectedItems = value; _selectedItems = value;
OnPropertyChanged("SelectedItems"); OnPropertyChanged( "SelectedItems" );
} }
} }
@ -101,10 +127,10 @@ namespace Samples.Modules.Color.Views
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName) protected void OnPropertyChanged( string propertyName )
{ {
if (PropertyChanged != null) if( PropertyChanged != null )
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); PropertyChanged( this, new PropertyChangedEventArgs( propertyName ) );
} }
} }
@ -113,48 +139,60 @@ namespace Samples.Modules.Color.Views
private bool _isSelected; private bool _isSelected;
public bool IsSelected public bool IsSelected
{ {
get { return _isSelected; } get
{
return _isSelected;
}
set set
{ {
_isSelected = value; _isSelected = value;
OnPropertyChanged("IsSelected"); OnPropertyChanged( "IsSelected" );
} }
} }
System.Windows.Media.Color _color; System.Windows.Media.Color _color;
public System.Windows.Media.Color Color public System.Windows.Media.Color Color
{ {
get { return _color; } get
{
return _color;
}
set set
{ {
_color = value; _color = value;
OnPropertyChanged("Color"); OnPropertyChanged( "Color" );
} }
} }
int _level; int _level;
public int Level public int Level
{ {
get { return _level; } get
set { _level = value; OnPropertyChanged("Level"); } {
return _level;
}
set
{
_level = value;
OnPropertyChanged( "Level" );
}
} }
public Person() public Person()
{ {
} }
public Person(System.Windows.Media.Color color, int level) public Person( System.Windows.Media.Color color, int level )
{ {
this._color = color; this._color = color;
this._level = level; this._level = level;
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName) protected void OnPropertyChanged( string propertyName )
{ {
if (PropertyChanged != null) if( PropertyChanged != null )
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); PropertyChanged( this, new PropertyChangedEventArgs( propertyName ) );
} }
} }
} }

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/Views/NavigationView.xaml

@ -1,4 +1,22 @@
<TreeViewItem x:Class="Samples.Modules.Color.Views.NavigationView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.Color.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.Color.Views" xmlns:views="clr-namespace:Samples.Modules.Color.Views"

30
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Color/Views/NavigationView.xaml.cs

@ -1,16 +1,22 @@
using System; /************************************************************************
using System.Collections.Generic;
using System.Linq; Extended WPF Toolkit
using System.Text;
using System.Windows; Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; 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.Color.Views namespace Samples.Modules.Color.Views
{ {

33
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/DateTimeModule.cs

@ -1,25 +1,44 @@
using System; /************************************************************************
using Microsoft.Practices.Unity;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using Samples.Infrastructure; using Samples.Infrastructure;
using Samples.Infrastructure.Extensions; using Samples.Infrastructure.Extensions;
using Samples.Modules.DateTime.Views; using Samples.Modules.DateTime.Views;
namespace Samples.Modules.DateTime namespace Samples.Modules.DateTime
{ {
public class DateTimeModule: ModuleBase public class DateTimeModule : ModuleBase
{ {
public DateTimeModule(IUnityContainer container, IRegionManager regionManager) public DateTimeModule( IUnityContainer container, IRegionManager regionManager )
: base(container, regionManager) { } : base( container, regionManager )
{
}
protected override void InitializeModule() protected override void InitializeModule()
{ {
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
} }
protected override void RegisterViewsAndTypes() protected override void RegisterViewsAndTypes()
{ {
Container.RegisterNavigationType(typeof(HomeView)); Container.RegisterNavigationType( typeof( HomeView ) );
} }
} }
} }

44
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/Properties/AssemblyInfo.cs

@ -1,25 +1,41 @@
using System.Reflection; /************************************************************************
using System.Resources;
using System.Runtime.CompilerServices; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.DateTime")] [assembly: AssemblyTitle( "Samples.Modules.DateTime" )]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct("Samples.Modules.DateTime")] [assembly: AssemblyProduct( "Samples.Modules.DateTime" )]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] [assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible( false )]
//In order to begin building localizable applications, set //In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion( "1.0.0.0" )]

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/Views/HomeView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.DateTime.Views.HomeView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.DateTime.Views.HomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"

23
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/Views/HomeView.xaml.cs

@ -1,13 +1,30 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.DateTime.Views namespace Samples.Modules.DateTime.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for HomeView.xaml /// Interaction logic for HomeView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView public partial class HomeView : DemoView
{ {
public HomeView() public HomeView()

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/Views/NavigationView.xaml

@ -1,4 +1,22 @@
<TreeViewItem x:Class="Samples.Modules.DateTime.Views.NavigationView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.DateTime.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.DateTime.Views" xmlns:views="clr-namespace:Samples.Modules.DateTime.Views"

30
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.DateTime/Views/NavigationView.xaml.cs

@ -1,16 +1,22 @@
using System; /************************************************************************
using System.Collections.Generic;
using System.Linq; Extended WPF Toolkit
using System.Text;
using System.Windows; Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; 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.DateTime.Views namespace Samples.Modules.DateTime.Views
{ {

33
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/NumericModule.cs

@ -1,25 +1,44 @@
using System; /************************************************************************
using Microsoft.Practices.Unity;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using Samples.Infrastructure; using Samples.Infrastructure;
using Samples.Infrastructure.Extensions; using Samples.Infrastructure.Extensions;
using Samples.Modules.Numeric.Views; using Samples.Modules.Numeric.Views;
namespace Samples.Modules.Numeric namespace Samples.Modules.Numeric
{ {
public class NumericModule: ModuleBase public class NumericModule : ModuleBase
{ {
public NumericModule(IUnityContainer container, IRegionManager regionManager) public NumericModule( IUnityContainer container, IRegionManager regionManager )
: base(container, regionManager) { } : base( container, regionManager )
{
}
protected override void InitializeModule() protected override void InitializeModule()
{ {
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
} }
protected override void RegisterViewsAndTypes() protected override void RegisterViewsAndTypes()
{ {
Container.RegisterNavigationType(typeof(HomeView)); Container.RegisterNavigationType( typeof( HomeView ) );
} }
} }
} }

44
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/Properties/AssemblyInfo.cs

@ -1,25 +1,41 @@
using System.Reflection; /************************************************************************
using System.Resources;
using System.Runtime.CompilerServices; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Numeric")] [assembly: AssemblyTitle( "Samples.Modules.Numeric" )]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct("Samples.Modules.Numeric")] [assembly: AssemblyProduct( "Samples.Modules.Numeric" )]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] [assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible( false )]
//In order to begin building localizable applications, set //In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion( "1.0.0.0" )]

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/Views/HomeView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.Numeric.Views.HomeView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.Numeric.Views.HomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"

23
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/Views/HomeView.xaml.cs

@ -1,13 +1,30 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Numeric.Views namespace Samples.Modules.Numeric.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for HomeView.xaml /// Interaction logic for HomeView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView public partial class HomeView : DemoView
{ {
public HomeView() public HomeView()

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/Views/NavigationView.xaml

@ -1,4 +1,22 @@
<TreeViewItem x:Class="Samples.Modules.Numeric.Views.NavigationView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.Numeric.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.Numeric.Views" xmlns:views="clr-namespace:Samples.Modules.Numeric.Views"

30
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Numeric/Views/NavigationView.xaml.cs

@ -1,16 +1,22 @@
using System; /************************************************************************
using System.Collections.Generic;
using System.Linq; Extended WPF Toolkit
using System.Text;
using System.Windows; Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; 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.Numeric.Views namespace Samples.Modules.Numeric.Views
{ {

44
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Properties/AssemblyInfo.cs

@ -1,25 +1,41 @@
using System.Reflection; /************************************************************************
using System.Resources;
using System.Runtime.CompilerServices; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.PropertyGrid")] [assembly: AssemblyTitle( "Samples.Modules.PropertyGrid" )]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct("Samples.Modules.PropertyGrid")] [assembly: AssemblyProduct( "Samples.Modules.PropertyGrid" )]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] [assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible( false )]
//In order to begin building localizable applications, set //In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion( "1.0.0.0" )]

45
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/PropertyGridModule.cs

@ -1,31 +1,50 @@
using System; /************************************************************************
using Microsoft.Practices.Unity;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using Samples.Infrastructure; using Samples.Infrastructure;
using Samples.Infrastructure.Extensions; using Samples.Infrastructure.Extensions;
using Samples.Modules.PropertyGrid.Views; using Samples.Modules.PropertyGrid.Views;
namespace Samples.Modules.PropertyGrid namespace Samples.Modules.PropertyGrid
{ {
public class PropertyGridModule: ModuleBase public class PropertyGridModule : ModuleBase
{ {
public PropertyGridModule(IUnityContainer container, IRegionManager regionManager) public PropertyGridModule( IUnityContainer container, IRegionManager regionManager )
: base(container, regionManager) { } : base( container, regionManager )
{
}
protected override void InitializeModule() protected override void InitializeModule()
{ {
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
} }
protected override void RegisterViewsAndTypes() protected override void RegisterViewsAndTypes()
{ {
Container.RegisterNavigationType(typeof(HomeView)); Container.RegisterNavigationType( typeof( HomeView ) );
Container.RegisterNavigationType(typeof(CustomEditors)); Container.RegisterNavigationType( typeof( CustomEditors ) );
Container.RegisterNavigationType(typeof(CustomItemsSource)); Container.RegisterNavigationType( typeof( CustomItemsSource ) );
Container.RegisterNavigationType(typeof(DefaultEditors)); Container.RegisterNavigationType( typeof( DefaultEditors ) );
Container.RegisterNavigationType(typeof(ExpandableProperties)); Container.RegisterNavigationType( typeof( ExpandableProperties ) );
Container.RegisterNavigationType(typeof(SpecifyingProperties)); Container.RegisterNavigationType( typeof( SpecifyingProperties ) );
Container.RegisterNavigationType(typeof(BindingToStructs)); Container.RegisterNavigationType( typeof( BindingToStructs ) );
} }
} }
} }

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Resources/LastNameUserControlEditor.xaml

@ -1,4 +1,22 @@
<UserControl x:Class="Samples.Modules.PropertyGrid.LastNameUserControlEditor" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<UserControl x:Class="Samples.Modules.PropertyGrid.LastNameUserControlEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="_uc"> x:Name="_uc">

42
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Resources/LastNameUserControlEditor.xaml.cs

@ -1,7 +1,25 @@
using System.Windows; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using Microsoft.Windows.Controls.PropertyGrid.Editors;
using System.Windows.Data; using System.Windows.Data;
using Microsoft.Windows.Controls.PropertyGrid.Editors;
namespace Samples.Modules.PropertyGrid namespace Samples.Modules.PropertyGrid
{ {
@ -15,24 +33,30 @@ namespace Samples.Modules.PropertyGrid
InitializeComponent(); InitializeComponent();
} }
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(string), typeof(LastNameUserControlEditor), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); public static readonly DependencyProperty ValueProperty = DependencyProperty.Register( "Value", typeof( string ), typeof( LastNameUserControlEditor ), new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault ) );
public string Value public string Value
{ {
get { return (string)GetValue(ValueProperty); } get
set { SetValue(ValueProperty, value); } {
return ( string )GetValue( ValueProperty );
}
set
{
SetValue( ValueProperty, value );
}
} }
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click( object sender, RoutedEventArgs e )
{ {
Value = string.Empty; Value = string.Empty;
} }
public FrameworkElement ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem) public FrameworkElement ResolveEditor( Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem )
{ {
Binding binding = new Binding("Value"); Binding binding = new Binding( "Value" );
binding.Source = propertyItem; binding.Source = propertyItem;
binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
BindingOperations.SetBinding(this, LastNameUserControlEditor.ValueProperty, binding); BindingOperations.SetBinding( this, LastNameUserControlEditor.ValueProperty, binding );
return this; return this;
} }
} }

26
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/BindingToStructs.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.BindingToStructs" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.BindingToStructs"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -13,7 +31,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="When the SelectedObject contains properties of type Struct youmay find that edits performed in the PropertyGrid do not function properly. This is because Structs are passed by value. Meaning that the PropertyGrid receives a copy of the Struct and not a reference. When this happens, the data binding expressions end up binding to and modifying that copy rather than the original values." <TextBlock Text="When the SelectedObject contains properties of type Struct youmay find that edits performed in the PropertyGrid do not function properly. This is because Structs are passed by value. Meaning that the PropertyGrid receives a copy of the Struct and not a reference. When this happens, the data binding expressions end up binding to and modifying that copy rather than the original values."
@ -22,12 +40,12 @@
<StackPanel Grid.Row="1" Margin="10"> <StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Binding to Structs:" Style="{StaticResource Header}" /> <TextBlock Text="Binding to Structs:" Style="{StaticResource Header}" />
<TextBlock Text="The solution to this problem is to create a custom editor and provide an IValueConverter to handle the proper conversion of the Struct values." TextWrapping="Wrap" /> <TextBlock Text="The solution to this problem is to create a custom editor and provide an IValueConverter to handle the proper conversion of the Struct values." TextWrapping="Wrap" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" > <extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10">
<extToolkit:PropertyGrid.EditorDefinitions> <extToolkit:PropertyGrid.EditorDefinitions>
<extToolkit:EditorDefinition TargetType="{x:Type local:Dimension}"> <extToolkit:EditorDefinition TargetType="{x:Type local:Dimension}">
<extToolkit:EditorDefinition.EditorTemplate> <extToolkit:EditorDefinition.EditorTemplate>
<DataTemplate> <DataTemplate>
<Grid Margin="5" > <Grid Margin="5">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />

98
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/BindingToStructs.xaml.cs

@ -1,26 +1,33 @@
using System; /************************************************************************
using System.Collections.Generic;
using System.Linq; Extended WPF Toolkit
using System.Text;
using System.Windows; Copyright (C) 2010-2012 Xceed Software Inc.
using System.Windows.Controls;
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System;
using System.ComponentModel;
using System.Windows.Data; 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;
using Samples.Infrastructure.Controls;
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using System.ComponentModel; using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views namespace Samples.Modules.PropertyGrid.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for BindingToStructs.xaml /// Interaction logic for BindingToStructs.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class BindingToStructs : DemoView public partial class BindingToStructs : DemoView
{ {
public BindingToStructs() public BindingToStructs()
@ -31,24 +38,40 @@ namespace Samples.Modules.PropertyGrid.Views
public class Person public class Person
{ {
[Category("Information")] [Category( "Information" )]
[DisplayName("First Name")] [DisplayName( "First Name" )]
[Description("This property uses a TextBox as the default editor.")] [Description( "This property uses a TextBox as the default editor." )]
public string FirstName { get; set; } public string FirstName
{
get;
set;
}
[Category("Information")] [Category( "Information" )]
[DisplayName("Last Name")] [DisplayName( "Last Name" )]
[Description("This property uses a TextBox as the default editor.")] [Description( "This property uses a TextBox as the default editor." )]
public string LastName { get; set; } public string LastName
{
get;
set;
}
public Dimension Dimensions { get; set; } public Dimension Dimensions
{
get;
set;
}
public static Person CreatePerson() public static Person CreatePerson()
{ {
var person = new Person(); var person = new Person();
person.FirstName = "John"; person.FirstName = "John";
person.LastName = "Doe"; person.LastName = "Doe";
person.Dimensions = new Dimension() { Height = 75.0, Weight = 185.76 }; person.Dimensions = new Dimension()
{
Height = 75.0,
Weight = 185.76
};
return person; return person;
} }
} }
@ -59,7 +82,7 @@ namespace Samples.Modules.PropertyGrid.Views
public double Height; public double Height;
public double Weight; public double Weight;
public Dimension(double height, double weight) public Dimension( double height, double weight )
{ {
this.Height = height; this.Height = height;
this.Weight = weight; this.Weight = weight;
@ -70,27 +93,26 @@ namespace Samples.Modules.PropertyGrid.Views
{ {
static Dimension _originalValue; // the static struct that stores original value at the start of editing static Dimension _originalValue; // the static struct that stores original value at the start of editing
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{ {
_originalValue = ((Dimension)value); _originalValue = ( ( Dimension )value );
if (parameter.ToString() == "Height") if( parameter.ToString() == "Height" )
return ((Dimension)value).Height; return ( ( Dimension )value ).Height;
if (parameter.ToString() == "Weight") if( parameter.ToString() == "Weight" )
return ((Dimension)value).Weight; return ( ( Dimension )value ).Weight;
return _originalValue; return _originalValue;
} }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{ {
if (parameter.ToString() == "Height") if( parameter.ToString() == "Height" )
_originalValue = new Dimension(double.Parse(value.ToString()), _originalValue.Weight); _originalValue = new Dimension( double.Parse( value.ToString() ), _originalValue.Weight );
if (parameter.ToString() == "Weight") if( parameter.ToString() == "Weight" )
_originalValue = new Dimension(_originalValue.Height, double.Parse(value.ToString())); _originalValue = new Dimension( _originalValue.Height, double.Parse( value.ToString() ) );
return _originalValue; return _originalValue;
} }
} }
} }

31
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/CustomEditors.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.CustomEditors" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.CustomEditors"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -8,8 +26,8 @@
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="This example demonstrates the various methods of creating and using custom editors. You can supply your own editor based on a Type, a property name, or both. To supply your own editor for a property you have to create an EditorDefinition for the PropertyGrid." <TextBlock Text="This example demonstrates the various methods of creating and using custom editors. You can supply your own editor based on a Type, a property name, or both. To supply your own editor for a property you have to create an EditorDefinition for the PropertyGrid."
@ -17,7 +35,7 @@
<StackPanel Grid.Row="1" Margin="10"> <StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Custom Editors with a DataTemplate:" Style="{StaticResource Header}" /> <TextBlock Text="Custom Editors with a DataTemplate:" Style="{StaticResource Header}" />
<TextBlock Text="You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate. Be sure to bind your custom editor to the bound property item's Value property." TextWrapping="Wrap"/> <TextBlock Text="You can override the default editors with your own custom editors with a DataTemplate. Simply define an EditorDefinition that either targets a Type, property name, or both and set the EditorDefinition.EditorTemplate to an instance of a DataTemplate. Be sure to bind your custom editor to the bound property item's Value property." TextWrapping="Wrap" />
<extToolkit:PropertyGrid x:Name="_propertyGrid1" Width="450" Margin="10"> <extToolkit:PropertyGrid x:Name="_propertyGrid1" Width="450" Margin="10">
<extToolkit:PropertyGrid.EditorDefinitions> <extToolkit:PropertyGrid.EditorDefinitions>
@ -25,7 +43,8 @@
<extToolkit:EditorDefinition TargetType="{x:Type HorizontalAlignment}"> <extToolkit:EditorDefinition TargetType="{x:Type HorizontalAlignment}">
<extToolkit:EditorDefinition.EditorTemplate> <extToolkit:EditorDefinition.EditorTemplate>
<DataTemplate> <DataTemplate>
<TextBox Background="Green" Text="{Binding Value}" /> <!-- Always bind your editor's value to the bound property's Value --> <TextBox Background="Green" Text="{Binding Value}" />
<!-- Always bind your editor's value to the bound property's Value -->
</DataTemplate> </DataTemplate>
</extToolkit:EditorDefinition.EditorTemplate> </extToolkit:EditorDefinition.EditorTemplate>
</extToolkit:EditorDefinition> </extToolkit:EditorDefinition>
@ -64,7 +83,7 @@
<StackPanel Grid.Row="2" Margin="10"> <StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Custom Editors with an Attribute:" Style="{StaticResource Header}" /> <TextBlock Text="Custom Editors with an Attribute:" Style="{StaticResource Header}" />
<TextBlock Text="You can supply editors for a property by using the System.ComponentModel.EditorAttribute. In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl." TextWrapping="Wrap" /> <TextBlock Text="You can supply editors for a property by using the System.ComponentModel.EditorAttribute. In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl." TextWrapping="Wrap" />
<extToolkit:PropertyGrid x:Name="_propertyGrid2" Width="450" Margin="10"/> <extToolkit:PropertyGrid x:Name="_propertyGrid2" Width="450" Margin="10" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</infControls:DemoView> </infControls:DemoView>

260
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/CustomEditors.xaml.cs

@ -1,19 +1,37 @@
using Samples.Infrastructure.Controls; /************************************************************************
using System.ComponentModel;
using System.Collections.Generic; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows; using System.Windows;
using System.Windows.Media;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Media;
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views namespace Samples.Modules.PropertyGrid.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for CustomEditors.xaml /// Interaction logic for CustomEditors.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class CustomEditors : DemoView public partial class CustomEditors : DemoView
{ {
public CustomEditors() public CustomEditors()
@ -25,114 +43,182 @@ namespace Samples.Modules.PropertyGrid.Views
public class Person public class Person
{ {
[Category("Information")] [Category( "Information" )]
[DisplayName("First Name")] [DisplayName( "First Name" )]
[Description("This property uses a TextBox as the default editor.")] [Description( "This property uses a TextBox as the default editor." )]
public string FirstName { get; set; } public string FirstName
{
[Category("Information")] get;
[DisplayName("Last Name")] set;
[Description("This property uses a TextBox as the default editor.")] }
public string LastName { get; set; }
[Category( "Information" )]
[Category("Information")] [DisplayName( "Last Name" )]
[DisplayName("Date of Birth")] [Description( "This property uses a TextBox as the default editor." )]
[Description("This property uses the DateTimeUpDown as the default editor.")] public string LastName
public DateTime DateOfBirth { get; set; } {
get;
[DisplayName("Grade Point Average")] set;
[Description("This property uses the DoubleUpDown as the default editor.")] }
public double GradePointAvg { get; set; }
[Category( "Information" )]
[Category("Information")] [DisplayName( "Date of Birth" )]
[Description("This property uses the IntegerUpDown as the default editor.")] [Description( "This property uses the DateTimeUpDown as the default editor." )]
public int Age { get; set; } public DateTime DateOfBirth
{
[Category("Information")] get;
[DisplayName("Is Male")] set;
[Description("This property uses a CheckBox as the default editor.")] }
public bool IsMale { get; set; }
[DisplayName( "Grade Point Average" )]
[Category("Information")] [Description( "This property uses the DoubleUpDown as the default editor." )]
[DisplayName("Favorite Color")] public double GradePointAvg
[Description("This property uses the ColorPicker as the default editor.")] {
public Color FavoriteColor { get; set; } get;
set;
[Category("Writing")] }
[DisplayName("Writing Hand")]
[Description("This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values")] [Category( "Information" )]
public HorizontalAlignment WritingHand { get; set; } [Description( "This property uses the IntegerUpDown as the default editor." )]
public int Age
[Category("Writing")] {
[DisplayName("Writing Font")] get;
[Description("This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values")] set;
public FontFamily WritingFont { get; set; } }
[Category("Writing")] [Category( "Information" )]
[DisplayName("Writing Font Size")] [DisplayName( "Is Male" )]
[Description("This property uses the DoubleUpDown as the default editor.")] [Description( "This property uses a CheckBox as the default editor." )]
public double WritingFontSize { get; set; } public bool IsMale
{
[Category("Conections")] get;
[DisplayName("Pet Names")] set;
[Description("This property uses the PrimitiveTypeCollectionEditor as the default editor.")] }
public List<String> PetNames { get; set; }
[Category( "Information" )]
[Category("Conections")] [DisplayName( "Favorite Color" )]
[Description("This property uses the CollectionEditor as the default editor.")] [Description( "This property uses the ColorPicker as the default editor." )]
public List<Person> Friends { get; set; } public Color FavoriteColor
{
[Category("Conections")] get;
[Description("This property is a complex property and has no default editor.")] set;
public Person Spouse { get; set; } }
[Category( "Writing" )]
[DisplayName( "Writing Hand" )]
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
public HorizontalAlignment WritingHand
{
get;
set;
}
[Category( "Writing" )]
[DisplayName( "Writing Font" )]
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
public FontFamily WritingFont
{
get;
set;
}
[Category( "Writing" )]
[DisplayName( "Writing Font Size" )]
[Description( "This property uses the DoubleUpDown as the default editor." )]
public double WritingFontSize
{
get;
set;
}
[Category( "Conections" )]
[DisplayName( "Pet Names" )]
[Description( "This property uses the PrimitiveTypeCollectionEditor as the default editor." )]
public List<String> PetNames
{
get;
set;
}
[Category( "Conections" )]
[Description( "This property uses the CollectionEditor as the default editor." )]
public List<Person> Friends
{
get;
set;
}
[Category( "Conections" )]
[Description( "This property is a complex property and has no default editor." )]
public Person Spouse
{
get;
set;
}
public static Person CreatePerson() public static Person CreatePerson()
{ {
var person = new Person(); var person = new Person();
person.FirstName = "John"; person.FirstName = "John";
person.LastName = "Doe"; person.LastName = "Doe";
person.DateOfBirth = new DateTime(1975, 1, 23); person.DateOfBirth = new DateTime( 1975, 1, 23 );
person.Age = DateTime.Today.Year - person.DateOfBirth.Year; person.Age = DateTime.Today.Year - person.DateOfBirth.Year;
person.GradePointAvg = 3.98; person.GradePointAvg = 3.98;
person.IsMale = true; person.IsMale = true;
person.FavoriteColor = Colors.Blue; person.FavoriteColor = Colors.Blue;
person.WritingHand = System.Windows.HorizontalAlignment.Right; person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily("Arial"); person.WritingFont = new FontFamily( "Arial" );
person.WritingFontSize = 12.5; person.WritingFontSize = 12.5;
person.PetNames = new List<string>() { "Pet 1", "Pet 2", "Pet 3" }; person.PetNames = new List<string>() { "Pet 1", "Pet 2", "Pet 3" };
person.Friends = new List<Person>() { new Person() { FirstName = "First", LastName = "Friend" }, new Person() { FirstName = "Second", LastName = "Friend" } }; person.Friends = new List<Person>() { new Person() { FirstName = "First", LastName = "Friend" }, new Person() { FirstName = "Second", LastName = "Friend" } };
person.Spouse = new Person() { FirstName = "Jane", LastName = "Doe" }; person.Spouse = new Person()
{
FirstName = "Jane",
LastName = "Doe"
};
return person; return person;
} }
} }
public class CustomAttributEditorPerson public class CustomAttributEditorPerson
{ {
[Category("Information")] [Category( "Information" )]
[DisplayName("First Name")] [DisplayName( "First Name" )]
[Description("This property uses a TextBox as the default editor.")] [Description( "This property uses a TextBox as the default editor." )]
//This custom editor is a Class that implements the ITypeEditor interface //This custom editor is a Class that implements the ITypeEditor interface
[Editor(typeof(FirstNameEditor), typeof(FirstNameEditor))] [Editor( typeof( FirstNameEditor ), typeof( FirstNameEditor ) )]
public string FirstName { get; set; } public string FirstName
{
get;
set;
}
[Category("Information")] [Category( "Information" )]
[DisplayName("Last Name")] [DisplayName( "Last Name" )]
[Description("This property uses a TextBox as the default editor.")] [Description( "This property uses a TextBox as the default editor." )]
//This custom editor is a UserControl that implements the ITypeEditor interface //This custom editor is a UserControl that implements the ITypeEditor interface
[Editor(typeof(LastNameUserControlEditor), typeof(LastNameUserControlEditor))] [Editor( typeof( LastNameUserControlEditor ), typeof( LastNameUserControlEditor ) )]
public string LastName { get; set; } public string LastName
{
get;
set;
}
[Category("Information")] [Category( "Information" )]
[DisplayName("Date of Birth")] [DisplayName( "Date of Birth" )]
[Description("This property uses the DateTimeUpDown as the default editor.")] [Description( "This property uses the DateTimeUpDown as the default editor." )]
public DateTime DateOfBirth { get; set; } public DateTime DateOfBirth
{
get;
set;
}
public static CustomAttributEditorPerson CreateCustomAttributEditorPerson() public static CustomAttributEditorPerson CreateCustomAttributEditorPerson()
{ {
var person = new CustomAttributEditorPerson(); var person = new CustomAttributEditorPerson();
person.FirstName = "John"; person.FirstName = "John";
person.LastName = "Doe"; person.LastName = "Doe";
person.DateOfBirth = new DateTime(1975, 1, 23); person.DateOfBirth = new DateTime( 1975, 1, 23 );
return person; return person;
} }
} }
@ -141,18 +227,18 @@ namespace Samples.Modules.PropertyGrid.Views
//Custom editors that are used as attributes MUST implement the ITypeEditor interface. //Custom editors that are used as attributes MUST implement the ITypeEditor interface.
public class FirstNameEditor : Microsoft.Windows.Controls.PropertyGrid.Editors.ITypeEditor public class FirstNameEditor : Microsoft.Windows.Controls.PropertyGrid.Editors.ITypeEditor
{ {
public FrameworkElement ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem) public FrameworkElement ResolveEditor( Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem )
{ {
TextBox textBox = new TextBox(); TextBox textBox = new TextBox();
textBox.Background = new SolidColorBrush(Colors.Red); textBox.Background = new SolidColorBrush( Colors.Red );
//create the binding from the bound property item to the editor //create the binding from the bound property item to the editor
var _binding = new Binding("Value"); //bind to the Value property of the PropertyItem var _binding = new Binding( "Value" ); //bind to the Value property of the PropertyItem
_binding.Source = propertyItem; _binding.Source = propertyItem;
_binding.ValidatesOnExceptions = true; _binding.ValidatesOnExceptions = true;
_binding.ValidatesOnDataErrors = true; _binding.ValidatesOnDataErrors = true;
_binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
BindingOperations.SetBinding(textBox, TextBox.TextProperty, _binding); BindingOperations.SetBinding( textBox, TextBox.TextProperty, _binding );
return textBox; return textBox;
} }
} }

28
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/CustomItemsSource.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.CustomItemsSource" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.CustomItemsSource"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -8,7 +26,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by create a class that implements IItemsSource and decorating your property with the ItemsSourceAttribute." <TextBlock Text="Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by create a class that implements IItemsSource and decorating your property with the ItemsSourceAttribute."
@ -16,8 +34,8 @@
<StackPanel Grid.Row="1" Margin="10"> <StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Providing a Custom ItemsSource:" Style="{StaticResource Header}" /> <TextBlock Text="Providing a Custom ItemsSource:" Style="{StaticResource Header}" />
<TextBlock Text="This example uses a collection of Doubles to represent the available options for the WritingFontSize property." TextWrapping="Wrap"/> <TextBlock Text="This example uses a collection of Doubles to represent the available options for the WritingFontSize property." TextWrapping="Wrap" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10"/> <extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</infControls:DemoView> </infControls:DemoView>

132
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/CustomItemsSource.xaml.cs

@ -1,4 +1,22 @@
using System; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System;
using System.ComponentModel; using System.ComponentModel;
using System.Windows; using System.Windows;
using System.Windows.Media; using System.Windows.Media;
@ -11,7 +29,7 @@ namespace Samples.Modules.PropertyGrid.Views
/// <summary> /// <summary>
/// Interaction logic for CustomItemsSource.xaml /// Interaction logic for CustomItemsSource.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class CustomItemsSource : DemoView public partial class CustomItemsSource : DemoView
{ {
public CustomItemsSource() public CustomItemsSource()
@ -22,45 +40,69 @@ namespace Samples.Modules.PropertyGrid.Views
public class Person public class Person
{ {
[Category("Information")] [Category( "Information" )]
[DisplayName("First Name")] [DisplayName( "First Name" )]
[Description("This property uses a TextBox as the default editor.")] [Description( "This property uses a TextBox as the default editor." )]
public string FirstName { get; set; } public string FirstName
{
get;
set;
}
[Category("Information")] [Category( "Information" )]
[DisplayName("Last Name")] [DisplayName( "Last Name" )]
[Description("This property uses a TextBox as the default editor.")] [Description( "This property uses a TextBox as the default editor." )]
public string LastName { get; set; } public string LastName
{
get;
set;
}
[Category("Information")] [Category( "Information" )]
[DisplayName("Date of Birth")] [DisplayName( "Date of Birth" )]
[Description("This property uses the DateTimeUpDown as the default editor.")] [Description( "This property uses the DateTimeUpDown as the default editor." )]
public DateTime DateOfBirth { get; set; } public DateTime DateOfBirth
{
get;
set;
}
[Category("Writing")] [Category( "Writing" )]
[DisplayName("Writing Hand")] [DisplayName( "Writing Hand" )]
[Description("This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values")] [Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
public HorizontalAlignment WritingHand { get; set; } public HorizontalAlignment WritingHand
{
get;
set;
}
[Category("Writing")] [Category( "Writing" )]
[DisplayName("Writing Font")] [DisplayName( "Writing Font" )]
[Description("This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values")] [Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
public FontFamily WritingFont { get; set; } public FontFamily WritingFont
{
get;
set;
}
[Category("Writing")] [Category( "Writing" )]
[DisplayName("Writing Font Size")] [DisplayName( "Writing Font Size" )]
[Description("This property uses the DoubleUpDown as the default editor.")] [Description( "This property uses the DoubleUpDown as the default editor." )]
[ItemsSource(typeof(FontSizeItemsSource))] [ItemsSource( typeof( FontSizeItemsSource ) )]
public double WritingFontSize { get; set; } public double WritingFontSize
{
get;
set;
}
public static Person CreatePerson() public static Person CreatePerson()
{ {
var person = new Person(); var person = new Person();
person.FirstName = "John"; person.FirstName = "John";
person.LastName = "Doe"; person.LastName = "Doe";
person.DateOfBirth = new DateTime(1975, 1, 23); person.DateOfBirth = new DateTime( 1975, 1, 23 );
person.WritingHand = System.Windows.HorizontalAlignment.Right; person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily("Arial"); person.WritingFont = new FontFamily( "Arial" );
person.WritingFontSize = 12.0; person.WritingFontSize = 12.0;
return person; return person;
} }
@ -72,22 +114,22 @@ namespace Samples.Modules.PropertyGrid.Views
public ItemCollection GetValues() public ItemCollection GetValues()
{ {
ItemCollection sizes = new ItemCollection(); ItemCollection sizes = new ItemCollection();
sizes.Add(5.0, "Five"); sizes.Add( 5.0, "Five" );
sizes.Add(5.5); sizes.Add( 5.5 );
sizes.Add(6.0, "Six"); sizes.Add( 6.0, "Six" );
sizes.Add(6.5); sizes.Add( 6.5 );
sizes.Add(7.0, "Seven"); sizes.Add( 7.0, "Seven" );
sizes.Add(7.5); sizes.Add( 7.5 );
sizes.Add(8.0, "Eight"); sizes.Add( 8.0, "Eight" );
sizes.Add(8.5); sizes.Add( 8.5 );
sizes.Add(9.0, "Nine"); sizes.Add( 9.0, "Nine" );
sizes.Add(9.5); sizes.Add( 9.5 );
sizes.Add(10.0); sizes.Add( 10.0 );
sizes.Add(12.0, "Twelve"); sizes.Add( 12.0, "Twelve" );
sizes.Add(14.0); sizes.Add( 14.0 );
sizes.Add(16.0); sizes.Add( 16.0 );
sizes.Add(18.0); sizes.Add( 18.0 );
sizes.Add(20.0); sizes.Add( 20.0 );
return sizes; return sizes;
} }
} }

24
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/DefaultEditors.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.DefaultEditors" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.DefaultEditors"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -7,7 +25,7 @@
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="This example demonstrates the default editors provided by the PropertyGrid." <TextBlock Text="This example demonstrates the default editors provided by the PropertyGrid."
@ -15,7 +33,7 @@
<StackPanel Grid.Row="1" Margin="10"> <StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Default Editors:" Style="{StaticResource Header}" /> <TextBlock Text="Default Editors:" Style="{StaticResource Header}" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10"/> <extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</infControls:DemoView> </infControls:DemoView>

206
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/DefaultEditors.xaml.cs

@ -1,17 +1,35 @@
using Samples.Infrastructure.Controls; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Media;
using System.ComponentModel; using System.ComponentModel;
using System.Windows; using System.Windows;
using System.Windows.Media;
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views namespace Samples.Modules.PropertyGrid.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for DefaultEditors.xaml /// Interaction logic for DefaultEditors.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class DefaultEditors : DemoView public partial class DefaultEditors : DemoView
{ {
public DefaultEditors() public DefaultEditors()
@ -22,83 +40,139 @@ namespace Samples.Modules.PropertyGrid.Views
public class Person public class Person
{ {
[Category("Information")] [Category( "Information" )]
[DisplayName("First Name")] [DisplayName( "First Name" )]
[Description("This property uses a TextBox as the default editor.")] [Description( "This property uses a TextBox as the default editor." )]
public string FirstName { get; set; } public string FirstName
{
[Category("Information")] get;
[DisplayName("Last Name")] set;
[Description("This property uses a TextBox as the default editor.")] }
public string LastName { get; set; }
[Category( "Information" )]
[Category("Information")] [DisplayName( "Last Name" )]
[DisplayName("Date of Birth")] [Description( "This property uses a TextBox as the default editor." )]
[Description("This property uses the DateTimeUpDown as the default editor.")] public string LastName
public DateTime DateOfBirth { get; set; } {
get;
[DisplayName("Grade Point Average")] set;
[Description("This property uses the DoubleUpDown as the default editor.")] }
public double GradePointAvg { get; set; }
[Category( "Information" )]
[Category("Information")] [DisplayName( "Date of Birth" )]
[Description("This property uses the IntegerUpDown as the default editor.")] [Description( "This property uses the DateTimeUpDown as the default editor." )]
public int Age { get; set; } public DateTime DateOfBirth
{
[Category("Information")] get;
[DisplayName("Is Male")] set;
[Description("This property uses a CheckBox as the default editor.")] }
public bool IsMale { get; set; }
[DisplayName( "Grade Point Average" )]
[Category("Information")] [Description( "This property uses the DoubleUpDown as the default editor." )]
[DisplayName("Favorite Color")] public double GradePointAvg
[Description("This property uses the ColorPicker as the default editor.")] {
public Color FavoriteColor { get; set; } get;
set;
[Category("Writing")] }
[DisplayName("Writing Hand")]
[Description("This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values")] [Category( "Information" )]
public HorizontalAlignment WritingHand { get; set; } [Description( "This property uses the IntegerUpDown as the default editor." )]
public int Age
[Category("Writing")] {
[DisplayName("Writing Font")] get;
[Description("This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values")] set;
public FontFamily WritingFont { get; set; } }
[Category("Writing")] [Category( "Information" )]
[DisplayName("Writing Font Size")] [DisplayName( "Is Male" )]
[Description("This property uses the DoubleUpDown as the default editor.")] [Description( "This property uses a CheckBox as the default editor." )]
public double WritingFontSize { get; set; } public bool IsMale
{
[Category("Conections")] get;
[DisplayName("Pet Names")] set;
[Description("This property uses the PrimitiveTypeCollectionEditor as the default editor.")] }
public List<String> PetNames { get; set; }
[Category( "Information" )]
[Category("Conections")] [DisplayName( "Favorite Color" )]
[Description("This property uses the CollectionEditor as the default editor.")] [Description( "This property uses the ColorPicker as the default editor." )]
public List<Person> Friends { get; set; } public Color FavoriteColor
{
[Category("Conections")] get;
[Description("This property is a complex property and has no default editor.")] set;
public Person Spouse { get; set; } }
[Category( "Writing" )]
[DisplayName( "Writing Hand" )]
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
public HorizontalAlignment WritingHand
{
get;
set;
}
[Category( "Writing" )]
[DisplayName( "Writing Font" )]
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
public FontFamily WritingFont
{
get;
set;
}
[Category( "Writing" )]
[DisplayName( "Writing Font Size" )]
[Description( "This property uses the DoubleUpDown as the default editor." )]
public double WritingFontSize
{
get;
set;
}
[Category( "Conections" )]
[DisplayName( "Pet Names" )]
[Description( "This property uses the PrimitiveTypeCollectionEditor as the default editor." )]
public List<String> PetNames
{
get;
set;
}
[Category( "Conections" )]
[Description( "This property uses the CollectionEditor as the default editor." )]
public List<Person> Friends
{
get;
set;
}
[Category( "Conections" )]
[Description( "This property is a complex property and has no default editor." )]
public Person Spouse
{
get;
set;
}
public static Person CreatePerson() public static Person CreatePerson()
{ {
var person = new Person(); var person = new Person();
person.FirstName = "John"; person.FirstName = "John";
person.LastName = "Doe"; person.LastName = "Doe";
person.DateOfBirth = new DateTime(1975, 1, 23); person.DateOfBirth = new DateTime( 1975, 1, 23 );
person.Age = DateTime.Today.Year - person.DateOfBirth.Year; person.Age = DateTime.Today.Year - person.DateOfBirth.Year;
person.GradePointAvg = 3.98; person.GradePointAvg = 3.98;
person.IsMale = true; person.IsMale = true;
person.FavoriteColor = Colors.Blue; person.FavoriteColor = Colors.Blue;
person.WritingHand = System.Windows.HorizontalAlignment.Right; person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily("Arial"); person.WritingFont = new FontFamily( "Arial" );
person.WritingFontSize = 12.5; person.WritingFontSize = 12.5;
person.PetNames = new List<string>() { "Pet 1", "Pet 2", "Pet 3" }; person.PetNames = new List<string>() { "Pet 1", "Pet 2", "Pet 3" };
person.Friends = new List<Person>() { new Person() { FirstName = "First", LastName = "Friend" }, new Person() { FirstName = "Second", LastName = "Friend" } }; person.Friends = new List<Person>() { new Person() { FirstName = "First", LastName = "Friend" }, new Person() { FirstName = "Second", LastName = "Friend" } };
person.Spouse = new Person() { FirstName = "Jane", LastName = "Doe" }; person.Spouse = new Person()
{
FirstName = "Jane",
LastName = "Doe"
};
return person; return person;
} }
} }

24
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/ExpandableProperties.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.ExpandableProperties" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.ExpandableProperties"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -8,7 +26,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="Sometimes it is neccessary to show the properties of a complex object. The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute." <TextBlock Text="Sometimes it is neccessary to show the properties of a complex object. The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute."
@ -20,4 +38,4 @@
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" /> <extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</infControls:DemoView> </infControls:DemoView>

89
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/ExpandableProperties.xaml.cs

@ -1,10 +1,25 @@
using Samples.Infrastructure.Controls; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.ComponentModel; using System.ComponentModel;
using System.Collections.Generic;
using System;
using System.Windows.Media; using System.Windows.Media;
using System.Windows;
using Microsoft.Windows.Controls.PropertyGrid.Attributes; using Microsoft.Windows.Controls.PropertyGrid.Attributes;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views namespace Samples.Modules.PropertyGrid.Views
{ {
@ -21,40 +36,64 @@ namespace Samples.Modules.PropertyGrid.Views
public class Person public class Person
{ {
[Category("Information")] [Category( "Information" )]
[DisplayName("First Name")] [DisplayName( "First Name" )]
[Description("This property uses a TextBox as the default editor.")] [Description( "This property uses a TextBox as the default editor." )]
public string FirstName { get; set; } public string FirstName
{
get;
set;
}
[Category("Information")] [Category( "Information" )]
[DisplayName("Last Name")] [DisplayName( "Last Name" )]
[Description("This property uses a TextBox as the default editor.")] [Description( "This property uses a TextBox as the default editor." )]
public string LastName { get; set; } public string LastName
{
get;
set;
}
[Category("Writing")] [Category( "Writing" )]
[DisplayName("Writing Font")] [DisplayName( "Writing Font" )]
[Description("This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values")] [Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
public FontFamily WritingFont { get; set; } public FontFamily WritingFont
{
get;
set;
}
[Category("Writing")] [Category( "Writing" )]
[DisplayName("Writing Font Size")] [DisplayName( "Writing Font Size" )]
[Description("This property uses the DoubleUpDown as the default editor.")] [Description( "This property uses the DoubleUpDown as the default editor." )]
public double WritingFontSize { get; set; } public double WritingFontSize
{
get;
set;
}
[Category("Conections")] [Category( "Conections" )]
[Description("This property is a complex property and has no default editor.")] [Description( "This property is a complex property and has no default editor." )]
[ExpandableObject] [ExpandableObject]
public Person Spouse { get; set; } public Person Spouse
{
get;
set;
}
public static Person CreatePerson() public static Person CreatePerson()
{ {
var person = new Person(); var person = new Person();
person.FirstName = "John"; person.FirstName = "John";
person.LastName = "Doe"; person.LastName = "Doe";
person.WritingFont = new FontFamily("Arial"); person.WritingFont = new FontFamily( "Arial" );
person.WritingFontSize = 12.5; person.WritingFontSize = 12.5;
person.Spouse = new Person() { FirstName = "Jane", LastName = "Doe" }; person.Spouse = new Person()
{
FirstName = "Jane",
LastName = "Doe"
};
return person; return person;
} }
} }

43
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/HomeView.xaml

@ -1,10 +1,28 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.HomeView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.HomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="PropertyGrid" > Title="PropertyGrid" >
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -14,7 +32,7 @@
<TextBlock Text="The PropertyGrid control allows you inspect and edit properties of an object. This PropertyGrid allows you do autogenerate all properties or specify the specific properties you want to display. You can use the standard editors that are provided with the PropertyGrid or you can use custom editors that target a Type, specific properties, or both. The PropertyGrid also supports complex properties, which allows you to drill down into a nested property hierarchy." <TextBlock Text="The PropertyGrid control allows you inspect and edit properties of an object. This PropertyGrid allows you do autogenerate all properties or specify the specific properties you want to display. You can use the standard editors that are provided with the PropertyGrid or you can use custom editors that target a Type, specific properties, or both. The PropertyGrid also supports complex properties, which allows you to drill down into a nested property hierarchy."
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" > <GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5"> <Grid Margin="5">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -28,26 +46,28 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="Display Sumary:" VerticalAlignment="Center" /> <TextBlock Text="Display Sumary:" VerticalAlignment="Center" />
<CheckBox x:Name="_displaySummary" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Shows/Hides the summary panel of the PropertyGrid."/> <CheckBox x:Name="_displaySummary" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Shows/Hides the summary panel of the PropertyGrid." />
<TextBlock Text="Filter:" VerticalAlignment="Center" Grid.Row="1" /> <TextBlock Text="Filter:" VerticalAlignment="Center" Grid.Row="1" />
<extToolkit:WatermarkTextBox x:Name="_filter" Grid.Row="1" Grid.Column="1" <extToolkit:WatermarkTextBox x:Name="_filter"
Grid.Row="1"
Grid.Column="1"
Watermark="Search" Watermark="Search"
VerticalAlignment="Center" Margin="5" ToolTip="Filters the properties within the PropertyGrid."/> VerticalAlignment="Center" Margin="5" ToolTip="Filters the properties within the PropertyGrid." />
<TextBlock Text="Is Categorized:" VerticalAlignment="Center" Grid.Column="2" /> <TextBlock Text="Is Categorized:" VerticalAlignment="Center" Grid.Column="2" />
<CheckBox x:Name="_isCategorized" Grid.Column="3" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Gets/Sets the layout of the PropertyGrid."/> <CheckBox x:Name="_isCategorized" Grid.Column="3" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Gets/Sets the layout of the PropertyGrid." />
<TextBlock Text="Show Advanced Options:" VerticalAlignment="Center" Grid.Row="1" Grid.Column="2" /> <TextBlock Text="Show Advanced Options:" VerticalAlignment="Center" Grid.Row="1" Grid.Column="2" />
<CheckBox x:Name="_showAdvancedOptions" Grid.Row="1" Grid.Column="3" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Shows/Hides the advanced options menu next to a property."/> <CheckBox x:Name="_showAdvancedOptions" Grid.Row="1" Grid.Column="3" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Shows/Hides the advanced options menu next to a property." />
</Grid> </Grid>
</GroupBox> </GroupBox>
<StackPanel Grid.Row="2" Margin="10"> <StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> <TextBlock Text="Usage:" Style="{StaticResource Header}" />
<TextBlock Text="To inspect an object simply set the PropertyGrid.SelectedObject property to an instance of the object you want to inspect." <TextBlock Text="To inspect an object simply set the PropertyGrid.SelectedObject property to an instance of the object you want to inspect."
TextWrapping="Wrap"/> TextWrapping="Wrap" />
<Grid Height="400" Margin="10" > <Grid Height="400" Margin="10">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -60,8 +80,7 @@
Filter="{Binding Text, ElementName=_filter, Mode=TwoWay}" Filter="{Binding Text, ElementName=_filter, Mode=TwoWay}"
IsCategorized="{Binding IsChecked, ElementName=_isCategorized, Mode=TwoWay}" IsCategorized="{Binding IsChecked, ElementName=_isCategorized, Mode=TwoWay}"
ShowAdvancedOptions="{Binding IsChecked, ElementName=_showAdvancedOptions}" ShowAdvancedOptions="{Binding IsChecked, ElementName=_showAdvancedOptions}"
SelectedObject="{Binding ElementName=_button}"/> SelectedObject="{Binding ElementName=_button}" />
</Grid> </Grid>
</StackPanel> </StackPanel>
</Grid> </Grid>

22
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/HomeView.xaml.cs

@ -1,4 +1,22 @@
using Microsoft.Practices.Prism.Regions; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls; using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views namespace Samples.Modules.PropertyGrid.Views
@ -6,7 +24,7 @@ namespace Samples.Modules.PropertyGrid.Views
/// <summary> /// <summary>
/// Interaction logic for HomeView.xaml /// Interaction logic for HomeView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView public partial class HomeView : DemoView
{ {
public HomeView() public HomeView()

30
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/NavigationView.xaml

@ -1,4 +1,22 @@
<TreeViewItem x:Class="Samples.Modules.PropertyGrid.Views.NavigationView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.PropertyGrid.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.PropertyGrid.Views" xmlns:views="clr-namespace:Samples.Modules.PropertyGrid.Views"
@ -10,13 +28,13 @@
<TreeViewItem Header="Editors"> <TreeViewItem Header="Editors">
<TreeViewItem Header="Default Editors" Tag="{x:Type views:DefaultEditors}" /> <TreeViewItem Header="Default Editors" Tag="{x:Type views:DefaultEditors}" />
<TreeViewItem Header="Custom Editors" Tag="{x:Type views:CustomEditors}"/> <TreeViewItem Header="Custom Editors" Tag="{x:Type views:CustomEditors}" />
</TreeViewItem> </TreeViewItem>
<TreeViewItem Header="Properties"> <TreeViewItem Header="Properties">
<TreeViewItem Header="Binding to Structs" Tag="{x:Type views:BindingToStructs}"/> <TreeViewItem Header="Binding to Structs" Tag="{x:Type views:BindingToStructs}" />
<TreeViewItem Header="Expandable Properties" Tag="{x:Type views:ExpandableProperties}"/> <TreeViewItem Header="Expandable Properties" Tag="{x:Type views:ExpandableProperties}" />
<TreeViewItem Header="Providing an ItemsSource" Tag="{x:Type views:CustomItemsSource}"/> <TreeViewItem Header="Providing an ItemsSource" Tag="{x:Type views:CustomItemsSource}" />
<TreeViewItem Header="Specifying Properties" Tag="{x:Type views:SpecifyingProperties}"/> <TreeViewItem Header="Specifying Properties" Tag="{x:Type views:SpecifyingProperties}" />
</TreeViewItem> </TreeViewItem>
</TreeViewItem> </TreeViewItem>

30
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/NavigationView.xaml.cs

@ -1,16 +1,22 @@
using System; /************************************************************************
using System.Collections.Generic;
using System.Linq; Extended WPF Toolkit
using System.Text;
using System.Windows; Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; 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.PropertyGrid.Views namespace Samples.Modules.PropertyGrid.Views
{ {

28
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/SpecifyingProperties.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.SpecifyingProperties" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.SpecifyingProperties"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -8,7 +26,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="By default the propertyGrid will autogenerate all the properties for a given object. You can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show." <TextBlock Text="By default the propertyGrid will autogenerate all the properties for a given object. You can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show."
@ -16,7 +34,9 @@
<StackPanel Grid.Row="1" Margin="10"> <StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Specifying Properties:" Style="{StaticResource Header}" /> <TextBlock Text="Specifying Properties:" Style="{StaticResource Header}" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" <extToolkit:PropertyGrid x:Name="_propertyGrid"
Width="450"
Margin="10"
AutoGenerateProperties="False"> AutoGenerateProperties="False">
<!-- Only the following properties will be displayed in the PropertyGrid --> <!-- Only the following properties will be displayed in the PropertyGrid -->
<extToolkit:PropertyGrid.PropertyDefinitions> <extToolkit:PropertyGrid.PropertyDefinitions>
@ -27,4 +47,4 @@
</extToolkit:PropertyGrid> </extToolkit:PropertyGrid>
</StackPanel> </StackPanel>
</Grid> </Grid>
</infControls:DemoView> </infControls:DemoView>

210
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.PropertyGrid/Views/SpecifyingProperties.xaml.cs

@ -1,17 +1,35 @@
using Samples.Infrastructure.Controls; /************************************************************************
using System.ComponentModel;
using System.Collections.Generic; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System; using System;
using System.Windows.Media; using System.Collections.Generic;
using System.ComponentModel;
using System.Windows; using System.Windows;
using System.Windows.Media;
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views namespace Samples.Modules.PropertyGrid.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for SpecifyingProperties.xaml /// Interaction logic for SpecifyingProperties.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class SpecifyingProperties : DemoView public partial class SpecifyingProperties : DemoView
{ {
public SpecifyingProperties() public SpecifyingProperties()
@ -22,83 +40,139 @@ namespace Samples.Modules.PropertyGrid.Views
public class Person public class Person
{ {
[Category("Information")] [Category( "Information" )]
[DisplayName("First Name")] [DisplayName( "First Name" )]
[Description("This property uses a TextBox as the default editor.")] [Description( "This property uses a TextBox as the default editor." )]
public string FirstName { get; set; } public string FirstName
{
[Category("Information")] get;
[DisplayName("Last Name")] set;
[Description("This property uses a TextBox as the default editor.")] }
public string LastName { get; set; }
[Category( "Information" )]
[Category("Information")] [DisplayName( "Last Name" )]
[DisplayName("Date of Birth")] [Description( "This property uses a TextBox as the default editor." )]
[Description("This property uses the DateTimeUpDown as the default editor.")] public string LastName
public DateTime DateOfBirth { get; set; } {
get;
[DisplayName("Grade Point Average")] set;
[Description("This property uses the DoubleUpDown as the default editor.")] }
public double GradePointAvg { get; set; }
[Category( "Information" )]
[Category("Information")] [DisplayName( "Date of Birth" )]
[Description("This property uses the IntegerUpDown as the default editor.")] [Description( "This property uses the DateTimeUpDown as the default editor." )]
public int Age { get; set; } public DateTime DateOfBirth
{
[Category("Information")] get;
[DisplayName("Is Male")] set;
[Description("This property uses a CheckBox as the default editor.")] }
public bool IsMale { get; set; }
[DisplayName( "Grade Point Average" )]
[Category("Information")] [Description( "This property uses the DoubleUpDown as the default editor." )]
[DisplayName("Favorite Color")] public double GradePointAvg
[Description("This property uses the ColorPicker as the default editor.")] {
public Color FavoriteColor { get; set; } get;
set;
[Category("Writing")] }
[DisplayName("Writing Hand")]
[Description("This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values")] [Category( "Information" )]
public HorizontalAlignment WritingHand { get; set; } [Description( "This property uses the IntegerUpDown as the default editor." )]
public int Age
[Category("Writing")] {
[DisplayName("Writing Font")] get;
[Description("This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values")] set;
public FontFamily WritingFont { get; set; } }
[Category("Writing")] [Category( "Information" )]
[DisplayName("Writing Font Size")] [DisplayName( "Is Male" )]
[Description("This property uses the DoubleUpDown as the default editor.")] [Description( "This property uses a CheckBox as the default editor." )]
public double WritingFontSize { get; set; } public bool IsMale
{
[Category("Conections")] get;
[DisplayName("Pet Names")] set;
[Description("This property uses the PrimitiveTypeCollectionEditor as the default editor.")] }
public List<String> PetNames { get; set; }
[Category( "Information" )]
[Category("Conections")] [DisplayName( "Favorite Color" )]
[Description("This property uses the CollectionEditor as the default editor.")] [Description( "This property uses the ColorPicker as the default editor." )]
public List<Person> Friends { get; set; } public Color FavoriteColor
{
[Category("Conections")] get;
[Description("This property is a complex property and has no default editor.")] set;
public Person Spouse { get; set; } }
[Category( "Writing" )]
[DisplayName( "Writing Hand" )]
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
public HorizontalAlignment WritingHand
{
get;
set;
}
[Category( "Writing" )]
[DisplayName( "Writing Font" )]
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )]
public FontFamily WritingFont
{
get;
set;
}
[Category( "Writing" )]
[DisplayName( "Writing Font Size" )]
[Description( "This property uses the DoubleUpDown as the default editor." )]
public double WritingFontSize
{
get;
set;
}
[Category( "Conections" )]
[DisplayName( "Pet Names" )]
[Description( "This property uses the PrimitiveTypeCollectionEditor as the default editor." )]
public List<String> PetNames
{
get;
set;
}
[Category( "Conections" )]
[Description( "This property uses the CollectionEditor as the default editor." )]
public List<Person> Friends
{
get;
set;
}
[Category( "Conections" )]
[Description( "This property is a complex property and has no default editor." )]
public Person Spouse
{
get;
set;
}
public static Person CreatePerson() public static Person CreatePerson()
{ {
var person = new Person(); var person = new Person();
person.FirstName = "John"; person.FirstName = "John";
person.LastName = "Doe"; person.LastName = "Doe";
person.DateOfBirth = new DateTime(1975, 1, 23); person.DateOfBirth = new DateTime( 1975, 1, 23 );
person.Age = DateTime.Today.Year - person.DateOfBirth.Year; person.Age = DateTime.Today.Year - person.DateOfBirth.Year;
person.GradePointAvg = 3.98; person.GradePointAvg = 3.98;
person.IsMale = true; person.IsMale = true;
person.FavoriteColor = Colors.Blue; person.FavoriteColor = Colors.Blue;
person.WritingHand = System.Windows.HorizontalAlignment.Right; person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily("Arial"); person.WritingFont = new FontFamily( "Arial" );
person.WritingFontSize = 12.5; person.WritingFontSize = 12.5;
person.PetNames = new List<string>() { "Pet 1", "Pet 2", "Pet 3" }; person.PetNames = new List<string>() { "Pet 1", "Pet 2", "Pet 3" };
person.Friends = new List<Person>() { new Person() { FirstName = "First", LastName = "Friend" }, new Person() { FirstName = "Second", LastName = "Friend" } }; person.Friends = new List<Person>() { new Person() { FirstName = "First", LastName = "Friend" }, new Person() { FirstName = "Second", LastName = "Friend" } };
person.Spouse = new Person() { FirstName = "Jane", LastName = "Doe" }; person.Spouse = new Person()
{
FirstName = "Jane",
LastName = "Doe"
};
return person; return person;
} }
} }

44
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Properties/AssemblyInfo.cs

@ -1,25 +1,41 @@
using System.Reflection; /************************************************************************
using System.Resources;
using System.Runtime.CompilerServices; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Text")] [assembly: AssemblyTitle( "Samples.Modules.Text" )]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct("Samples.Modules.Text")] [assembly: AssemblyProduct( "Samples.Modules.Text" )]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] [assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible( false )]
//In order to begin building localizable applications, set //In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion( "1.0.0.0" )]

35
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/TextModule.cs

@ -1,26 +1,45 @@
using System; /************************************************************************
using Microsoft.Practices.Unity;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using Samples.Infrastructure; using Samples.Infrastructure;
using Samples.Infrastructure.Extensions; using Samples.Infrastructure.Extensions;
using Samples.Modules.Text.Views; using Samples.Modules.Text.Views;
namespace Samples.Modules.Text namespace Samples.Modules.Text
{ {
public class TextModule: ModuleBase public class TextModule : ModuleBase
{ {
public TextModule(IUnityContainer container, IRegionManager regionManager) public TextModule( IUnityContainer container, IRegionManager regionManager )
: base(container, regionManager) { } : base( container, regionManager )
{
}
protected override void InitializeModule() protected override void InitializeModule()
{ {
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
} }
protected override void RegisterViewsAndTypes() protected override void RegisterViewsAndTypes()
{ {
Container.RegisterNavigationType(typeof(HomeView)); Container.RegisterNavigationType( typeof( HomeView ) );
Container.RegisterNavigationType(typeof(WatermarkTextBoxView)); Container.RegisterNavigationType( typeof( WatermarkTextBoxView ) );
} }
} }
} }

25
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/HomeView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.Text.Views.HomeView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.Text.Views.HomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -8,6 +26,9 @@
<extToolkit:TokenizedTextBox x:Name="_textBox" <extToolkit:TokenizedTextBox x:Name="_textBox"
DisplayMemberPath="FullName" DisplayMemberPath="FullName"
SearchMemberPath="FirstName" SearchMemberPath="FirstName"
ValueMemberPath="Id" HorizontalAlignment="Center" VerticalAlignment="Center" Width="250" /> ValueMemberPath="Id"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="250" />
</Grid> </Grid>
</infControls:DemoView> </infControls:DemoView>

52
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/HomeView.xaml.cs

@ -1,14 +1,32 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
using Microsoft.Practices.Prism.Regions; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Text.Views namespace Samples.Modules.Text.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for HomeView.xaml /// Interaction logic for HomeView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView public partial class HomeView : DemoView
{ {
public HomeView() public HomeView()
@ -25,16 +43,32 @@ namespace Samples.Modules.Text.Views
public class Email public class Email
{ {
public int Id { get; set; } public int Id
public string FirstName { get; set; } {
public string LastName { get; set; } get;
public string EmailAddress { get; set; } set;
}
public string FirstName
{
get;
set;
}
public string LastName
{
get;
set;
}
public string EmailAddress
{
get;
set;
}
public string FullName public string FullName
{ {
get get
{ {
return String.Format("{0}, {1}", LastName, FirstName); return String.Format( "{0}, {1}", LastName, FirstName );
} }
} }
} }

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/NavigationView.xaml

@ -1,4 +1,22 @@
<TreeViewItem x:Class="Samples.Modules.Text.Views.NavigationView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.Text.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.Text.Views" xmlns:views="clr-namespace:Samples.Modules.Text.Views"

30
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/NavigationView.xaml.cs

@ -1,16 +1,22 @@
using System; /************************************************************************
using System.Collections.Generic;
using System.Linq; Extended WPF Toolkit
using System.Text;
using System.Windows; Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; 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.Text.Views namespace Samples.Modules.Text.Views
{ {

30
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/WatermarkTextBoxView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.Text.Views.WatermarkTextBoxView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.Text.Views.WatermarkTextBoxView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -8,12 +26,12 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*"/> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, usually a String, to represent null or missing text." /> <TextBlock Text="The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, usually a String, to represent null or missing text." />
<GroupBox Header="Features" Grid.Row="1" > <GroupBox Header="Features" Grid.Row="1">
<Grid Margin="5"> <Grid Margin="5">
<CheckBox x:Name="_selectAll" Content="SelectAllOnGotFocus" VerticalAlignment="Center" Margin="5" ToolTip="Selects all text in the WatermarkTextBox when it receives focus." /> <CheckBox x:Name="_selectAll" Content="SelectAllOnGotFocus" VerticalAlignment="Center" Margin="5" ToolTip="Selects all text in the WatermarkTextBox when it receives focus." />
</Grid> </Grid>
@ -21,10 +39,10 @@
<StackPanel Grid.Row="2" Margin="10"> <StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Default:" Style="{StaticResource Header}" /> <TextBlock Text="Default:" Style="{StaticResource Header}" />
<extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" MinWidth="200" Watermark="Enter Text" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}"/> <extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" MinWidth="200" Watermark="Enter Text" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}" />
<TextBlock Text="Image Watermark:" Style="{StaticResource Header}" /> <TextBlock Text="Image Watermark:" Style="{StaticResource Header}" />
<extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}" > <extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}">
<extToolkit:WatermarkTextBox.Watermark> <extToolkit:WatermarkTextBox.Watermark>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Image Source="/Samples.Modules.Text;component/Images/PencilTool16.png" Stretch="None" /> <Image Source="/Samples.Modules.Text;component/Images/PencilTool16.png" Stretch="None" />
@ -37,7 +55,7 @@
<extToolkit:WatermarkTextBox Grid.Row="2" Grid.Column="1" Margin="5" Watermark="Enter Text" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}"> <extToolkit:WatermarkTextBox Grid.Row="2" Grid.Column="1" Margin="5" Watermark="Enter Text" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}">
<extToolkit:WatermarkTextBox.WatermarkTemplate> <extToolkit:WatermarkTextBox.WatermarkTemplate>
<DataTemplate> <DataTemplate>
<Border BorderBrush="Green" BorderThickness="1" Padding="5" > <Border BorderBrush="Green" BorderThickness="1" Padding="5">
<ContentControl Content="{Binding}" Foreground="DarkRed" FontWeight="Bold" Focusable="False" /> <ContentControl Content="{Binding}" Foreground="DarkRed" FontWeight="Bold" Focusable="False" />
</Border> </Border>
</DataTemplate> </DataTemplate>

23
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Text/Views/WatermarkTextBoxView.xaml.cs

@ -1,13 +1,30 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Text.Views namespace Samples.Modules.Text.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for WatermarkTextBoxView.xaml /// Interaction logic for WatermarkTextBoxView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive=false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class WatermarkTextBoxView : DemoView public partial class WatermarkTextBoxView : DemoView
{ {
public WatermarkTextBoxView() public WatermarkTextBoxView()

44
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/Properties/AssemblyInfo.cs

@ -1,25 +1,41 @@
using System.Reflection; /************************************************************************
using System.Resources;
using System.Runtime.CompilerServices; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Wizard")] [assembly: AssemblyTitle( "Samples.Modules.Wizard" )]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany( "" )]
[assembly: AssemblyProduct("Samples.Modules.Wizard")] [assembly: AssemblyProduct( "Samples.Modules.Wizard" )]
[assembly: AssemblyCopyright("Copyright © 2011")] [assembly: AssemblyCopyright( "Copyright © 2011" )]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible( false )]
//In order to begin building localizable applications, set //In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion( "1.0.0.0" )]

26
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/Views/HomeView.xaml

@ -1,4 +1,22 @@
<infControls:DemoView x:Class="Samples.Modules.Wizard.Views.HomeView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.Wizard.Views.HomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -11,14 +29,14 @@
Description="This Wizard will walk you though how to do something." /> Description="This Wizard will walk you though how to do something." />
<extToolkit:WizardPage x:Name="Page1" PageType="Interior" <extToolkit:WizardPage x:Name="Page1" PageType="Interior"
Title="Page 1" Title="Page 1"
Description="This is the first page in the process."/> Description="This is the first page in the process." />
<extToolkit:WizardPage x:Name="Page2" PageType="Interior" <extToolkit:WizardPage x:Name="Page2" PageType="Interior"
Title="Page 2" Title="Page 2"
Description="This is the second page in the process"/> Description="This is the second page in the process" />
<extToolkit:WizardPage x:Name="LastPage" PageType="Interior" <extToolkit:WizardPage x:Name="LastPage" PageType="Interior"
Title="Last Page" Title="Last Page"
Description="This is the last page in the process" Description="This is the last page in the process"
CanFinish="True"/> CanFinish="True" />
</extToolkit:Wizard> </extToolkit:Wizard>
</Grid> </Grid>
</infControls:DemoView> </infControls:DemoView>

23
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/Views/HomeView.xaml.cs

@ -1,13 +1,30 @@
using System; /************************************************************************
using Samples.Infrastructure.Controls;
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Wizard.Views namespace Samples.Modules.Wizard.Views
{ {
/// <summary> /// <summary>
/// Interaction logic for HomeView.xaml /// Interaction logic for HomeView.xaml
/// </summary> /// </summary>
[RegionMemberLifetime(KeepAlive = false)] [RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView public partial class HomeView : DemoView
{ {
public HomeView() public HomeView()

20
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/Views/NavigationView.xaml

@ -1,4 +1,22 @@
<TreeViewItem x:Class="Samples.Modules.Wizard.Views.NavigationView" <!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<TreeViewItem x:Class="Samples.Modules.Wizard.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.Wizard.Views" xmlns:views="clr-namespace:Samples.Modules.Wizard.Views"

30
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/Views/NavigationView.xaml.cs

@ -1,16 +1,22 @@
using System; /************************************************************************
using System.Collections.Generic;
using System.Linq; Extended WPF Toolkit
using System.Text;
using System.Windows; Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows.Controls; 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.Wizard.Views namespace Samples.Modules.Wizard.Views
{ {

33
ExtendedWPFToolkitSolution/Src/Samples/Modules/Samples.Modules.Wizard/WizardModule.cs

@ -1,25 +1,44 @@
using System; /************************************************************************
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity; using Microsoft.Practices.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions;
using Samples.Modules.Wizard.Views; using Samples.Modules.Wizard.Views;
namespace Samples.Modules.Wizard namespace Samples.Modules.Wizard
{ {
public class WizardModule : ModuleBase public class WizardModule : ModuleBase
{ {
public WizardModule(IUnityContainer container, IRegionManager regionManager) public WizardModule( IUnityContainer container, IRegionManager regionManager )
: base(container, regionManager) { } : base( container, regionManager )
{
}
protected override void InitializeModule() protected override void InitializeModule()
{ {
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
} }
protected override void RegisterViewsAndTypes() protected override void RegisterViewsAndTypes()
{ {
Container.RegisterNavigationType(typeof(HomeView)); Container.RegisterNavigationType( typeof( HomeView ) );
} }
} }
} }

32
ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Commands/TreeViewCommandBehavior.cs

@ -1,24 +1,42 @@
using System; /************************************************************************
using Microsoft.Practices.Prism.Commands;
using System.Windows.Controls; Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using Microsoft.Practices.Prism.Commands;
namespace Samples.Infrastructure.Commands namespace Samples.Infrastructure.Commands
{ {
public class TreeViewCommandBehavior : CommandBehaviorBase<TreeView> public class TreeViewCommandBehavior : CommandBehaviorBase<TreeView>
{ {
public TreeViewCommandBehavior(TreeView treeView) public TreeViewCommandBehavior( TreeView treeView )
: base(treeView) : base( treeView )
{ {
treeView.SelectedItemChanged += SelectedItemChanged; treeView.SelectedItemChanged += SelectedItemChanged;
} }
void SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) void SelectedItemChanged( object sender, RoutedPropertyChangedEventArgs<object> e )
{ {
//This treeview command is specfic to the navigation region, //This treeview command is specfic to the navigation region,
//so I always want to pass the tag of the selected treeviewitem //so I always want to pass the tag of the selected treeviewitem
//because it will conatin the Type of view to navigate to. //because it will conatin the Type of view to navigate to.
var type = (e.NewValue as FrameworkElement).Tag as Type; var type = ( e.NewValue as FrameworkElement ).Tag as Type;
CommandParameter = type != null ? type.FullName : null; CommandParameter = type != null ? type.FullName : null;
ExecuteCommand(); ExecuteCommand();
} }

63
ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Commands/TreeViewSelected.cs

@ -1,4 +1,21 @@
using System; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
@ -7,55 +24,55 @@ namespace Samples.Infrastructure.Commands
{ {
public class TreeViewSelected public class TreeViewSelected
{ {
private static readonly DependencyProperty SelectedCommandBehaviorProperty = DependencyProperty.RegisterAttached("SelectedCommandBehavior", typeof(TreeViewCommandBehavior), typeof(TreeViewSelected), null); 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 readonly DependencyProperty CommandProperty = DependencyProperty.RegisterAttached( "Command", typeof( ICommand ), typeof( TreeViewSelected ), new PropertyMetadata( OnSetCommandCallback ) );
public static void SetCommand(TreeView menuItem, ICommand command) public static void SetCommand( TreeView menuItem, ICommand command )
{ {
menuItem.SetValue(CommandProperty, command); menuItem.SetValue( CommandProperty, command );
} }
public static ICommand GetCommand(TreeView menuItem) public static ICommand GetCommand( TreeView menuItem )
{ {
return menuItem.GetValue(CommandProperty) as ICommand; return menuItem.GetValue( CommandProperty ) as ICommand;
} }
public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.RegisterAttached("CommandParameter", typeof(object), typeof(TreeViewSelected), new PropertyMetadata(OnSetCommandParameterCallback)); public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.RegisterAttached( "CommandParameter", typeof( object ), typeof( TreeViewSelected ), new PropertyMetadata( OnSetCommandParameterCallback ) );
public static void SetCommandParameter(TreeView menuItem, object parameter) public static void SetCommandParameter( TreeView menuItem, object parameter )
{ {
menuItem.SetValue(CommandParameterProperty, parameter); menuItem.SetValue( CommandParameterProperty, parameter );
} }
public static object GetCommandParameter(TreeView menuItem) public static object GetCommandParameter( TreeView menuItem )
{ {
return menuItem.GetValue(CommandParameterProperty); return menuItem.GetValue( CommandParameterProperty );
} }
private static void OnSetCommandCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) private static void OnSetCommandCallback( DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e )
{ {
TreeView menuItem = dependencyObject as TreeView; TreeView menuItem = dependencyObject as TreeView;
if (menuItem != null) if( menuItem != null )
{ {
TreeViewCommandBehavior behavior = GetOrCreateBehavior(menuItem); TreeViewCommandBehavior behavior = GetOrCreateBehavior( menuItem );
behavior.Command = e.NewValue as ICommand; behavior.Command = e.NewValue as ICommand;
} }
} }
private static void OnSetCommandParameterCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) private static void OnSetCommandParameterCallback( DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e )
{ {
TreeView menuItem = dependencyObject as TreeView; TreeView menuItem = dependencyObject as TreeView;
if (menuItem != null) if( menuItem != null )
{ {
TreeViewCommandBehavior behavior = GetOrCreateBehavior(menuItem); TreeViewCommandBehavior behavior = GetOrCreateBehavior( menuItem );
behavior.CommandParameter = e.NewValue; behavior.CommandParameter = e.NewValue;
} }
} }
private static TreeViewCommandBehavior GetOrCreateBehavior(TreeView menuItem) private static TreeViewCommandBehavior GetOrCreateBehavior( TreeView menuItem )
{ {
TreeViewCommandBehavior behavior = menuItem.GetValue(SelectedCommandBehaviorProperty) as TreeViewCommandBehavior; TreeViewCommandBehavior behavior = menuItem.GetValue( SelectedCommandBehaviorProperty ) as TreeViewCommandBehavior;
if (behavior == null) if( behavior == null )
{ {
behavior = new TreeViewCommandBehavior(menuItem); behavior = new TreeViewCommandBehavior( menuItem );
menuItem.SetValue(SelectedCommandBehaviorProperty, behavior); menuItem.SetValue( SelectedCommandBehaviorProperty, behavior );
} }
return behavior; return behavior;

108
ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Controls/DemoView.cs

@ -1,7 +1,25 @@
using System; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System;
using System.IO;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.IO;
namespace Samples.Infrastructure.Controls namespace Samples.Infrastructure.Controls
{ {
@ -16,25 +34,43 @@ namespace Samples.Infrastructure.Controls
#region Properties #region Properties
public static readonly DependencyProperty CSharpTextProperty = DependencyProperty.Register("CSharpText", typeof(string), typeof(DemoView), new UIPropertyMetadata(null)); public static readonly DependencyProperty CSharpTextProperty = DependencyProperty.Register( "CSharpText", typeof( string ), typeof( DemoView ), new UIPropertyMetadata( null ) );
public string CSharpText public string CSharpText
{ {
get { return (string)GetValue(CSharpTextProperty); } get
set { SetValue(CSharpTextProperty, value); } {
return ( string )GetValue( CSharpTextProperty );
}
set
{
SetValue( CSharpTextProperty, value );
}
} }
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(DemoView), new UIPropertyMetadata(null)); public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( "Title", typeof( string ), typeof( DemoView ), new UIPropertyMetadata( null ) );
public string Title public string Title
{ {
get { return (string)GetValue(TitleProperty); } get
set { SetValue(TitleProperty, value); } {
return ( string )GetValue( TitleProperty );
}
set
{
SetValue( TitleProperty, value );
}
} }
public static readonly DependencyProperty XamlTextProperty = DependencyProperty.Register("XamlText", typeof(string), typeof(DemoView), new UIPropertyMetadata(null)); public static readonly DependencyProperty XamlTextProperty = DependencyProperty.Register( "XamlText", typeof( string ), typeof( DemoView ), new UIPropertyMetadata( null ) );
public string XamlText public string XamlText
{ {
get { return (string)GetValue(XamlTextProperty); } get
set { SetValue(XamlTextProperty, value); } {
return ( string )GetValue( XamlTextProperty );
}
set
{
SetValue( XamlTextProperty, value );
}
} }
#endregion //Properties #endregion //Properties
@ -43,73 +79,73 @@ namespace Samples.Infrastructure.Controls
static DemoView() static DemoView()
{ {
DefaultStyleKeyProperty.OverrideMetadata(typeof(DemoView), new FrameworkPropertyMetadata(typeof(DemoView))); DefaultStyleKeyProperty.OverrideMetadata( typeof( DemoView ), new FrameworkPropertyMetadata( typeof( DemoView ) ) );
} }
public DemoView() public DemoView()
{ {
_applicationPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); _applicationPath = Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location );
} }
#endregion //Constructors #endregion //Constructors
#region Base Class Overrides #region Base Class Overrides
protected override void OnContentChanged(object oldContent, object newContent) protected override void OnContentChanged( object oldContent, object newContent )
{ {
base.OnContentChanged(oldContent, newContent); base.OnContentChanged( oldContent, newContent );
//the parent of the content will be the View //the parent of the content will be the View
ResolveContentCode((newContent as FrameworkElement).Parent); ResolveContentCode( ( newContent as FrameworkElement ).Parent );
} }
#endregion //Base Class Overrides #endregion //Base Class Overrides
#region Methods #region Methods
private void ResolveContentCode(object newContent) private void ResolveContentCode( object newContent )
{ {
//get the type of the content loaded in the ContentRegion //get the type of the content loaded in the ContentRegion
var type = newContent.GetType(); var type = newContent.GetType();
//grab only the name of the content which will correspond to the name of the file to load //grab only the name of the content which will correspond to the name of the file to load
var viewName = type.FullName.Substring(type.FullName.LastIndexOf(".") + 1); var viewName = type.FullName.Substring( type.FullName.LastIndexOf( "." ) + 1 );
//get the module name //get the module name
var moduleName = type.Module.Name.Replace(".dll", String.Empty); var moduleName = type.Module.Name.Replace( ".dll", String.Empty );
SetText(viewName, moduleName); SetText( viewName, moduleName );
} }
private void SetText(string viewName, string moduleName) private void SetText( string viewName, string moduleName )
{ {
SetCSharpText(viewName, moduleName); SetCSharpText( viewName, moduleName );
SetXamlText(viewName, moduleName); SetXamlText( viewName, moduleName );
} }
private void SetCSharpText(string viewName, string moduleName) private void SetCSharpText( string viewName, string moduleName )
{ {
//now we need to append the file extension //now we need to append the file extension
string fileName = String.Format("{0}.xaml", viewName); string fileName = String.Format( "{0}.xaml", viewName );
string filePath = GetFilePath(moduleName, fileName); string filePath = GetFilePath( moduleName, fileName );
XamlText = ReadFileText(filePath); XamlText = ReadFileText( filePath );
} }
private void SetXamlText(string viewName, string moduleName) private void SetXamlText( string viewName, string moduleName )
{ {
//now we need to append the file extension //now we need to append the file extension
string fileName = String.Format("{0}.xaml.cs", viewName); string fileName = String.Format( "{0}.xaml.cs", viewName );
string filePath = GetFilePath(moduleName, fileName); string filePath = GetFilePath( moduleName, fileName );
CSharpText = ReadFileText(filePath); CSharpText = ReadFileText( filePath );
} }
private string GetFilePath(string moduleName, string fileName) private string GetFilePath( string moduleName, string fileName )
{ {
return Path.Combine(_applicationPath, _samplesFolderName, moduleName, fileName); return Path.Combine( _applicationPath, _samplesFolderName, moduleName, fileName );
} }
private static string ReadFileText(string filePath) private static string ReadFileText( string filePath )
{ {
string text = String.Empty; string text = String.Empty;
if (File.Exists(filePath)) if( File.Exists( filePath ) )
text = File.ReadAllText(filePath); text = File.ReadAllText( filePath );
return text; return text;
} }

41
ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Converters/CSharpColorConverter.cs

@ -1,29 +1,44 @@
using System; /************************************************************************
using System.Collections.Generic;
using System.Linq; Extended WPF Toolkit
using System.Text;
using System.Windows.Data; Copyright (C) 2010-2012 Xceed Software Inc.
using Samples.Infrastructure.Core.CodeFormatting;
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Media; using System.Windows.Media;
using Samples.Infrastructure.Core.CodeFormatting;
namespace Samples.Infrastructure.Converters namespace Samples.Infrastructure.Converters
{ {
public class CSharpColorConverter : IValueConverter public class CSharpColorConverter : IValueConverter
{ {
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{ {
if (value == null) if( value == null )
return value; return value;
String val = (String)value; String val = ( String )value;
CSharpFormat cSharpFormat = new CSharpFormat(); CSharpFormat cSharpFormat = new CSharpFormat();
FlowDocument doc = new FlowDocument(); FlowDocument doc = new FlowDocument();
Paragraph p = new Paragraph(); Paragraph p = new Paragraph();
p = cSharpFormat.FormatCode(val); p = cSharpFormat.FormatCode( val );
doc.Blocks.Add(p); doc.Blocks.Add( p );
RichTextBox rtb = new RichTextBox(); RichTextBox rtb = new RichTextBox();
rtb.IsReadOnly = true; rtb.IsReadOnly = true;
@ -31,11 +46,11 @@ namespace Samples.Infrastructure.Converters
rtb.Document.PageWidth = 2500.0; rtb.Document.PageWidth = 2500.0;
rtb.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; rtb.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; rtb.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.FontFamily = new FontFamily("Courier New"); rtb.FontFamily = new FontFamily( "Courier New" );
return rtb; return rtb;
} }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

80
ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Converters/XamlColorConverter.cs

@ -1,24 +1,42 @@
using System; /************************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Reciprocal
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
**********************************************************************/
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Controls; using System.Windows.Media;
using Samples.Infrastructure.Core.CodeFormatting; using Samples.Infrastructure.Core.CodeFormatting;
namespace Samples.Infrastructure.Converters namespace Samples.Infrastructure.Converters
{ {
public class XamlColorConverter : IValueConverter public class XamlColorConverter : IValueConverter
{ {
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{ {
if (value == null) if( value == null )
return value; return value;
string xaml = value as string; string xaml = value as string;
FlowDocument doc = new FlowDocument(); FlowDocument doc = new FlowDocument();
ColorizeXAML(xaml, doc); ColorizeXAML( xaml, doc );
RichTextBox rtb = new RichTextBox(); RichTextBox rtb = new RichTextBox();
rtb.IsReadOnly = true; rtb.IsReadOnly = true;
@ -26,11 +44,11 @@ namespace Samples.Infrastructure.Converters
rtb.Document.PageWidth = 2500.0; rtb.Document.PageWidth = 2500.0;
rtb.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; rtb.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; rtb.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.FontFamily = new FontFamily("Courier New"); rtb.FontFamily = new FontFamily( "Courier New" );
return rtb; return rtb;
} }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@ -39,43 +57,43 @@ namespace Samples.Infrastructure.Converters
#region ColorizeXAML #region ColorizeXAML
public void ColorizeXAML(string xamlText, FlowDocument targetDoc) public void ColorizeXAML( string xamlText, FlowDocument targetDoc )
{ {
XmlTokenizer tokenizer = new XmlTokenizer(); XmlTokenizer tokenizer = new XmlTokenizer();
XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement; XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement;
List<XmlToken> tokens = tokenizer.Tokenize(xamlText, ref mode); List<XmlToken> tokens = tokenizer.Tokenize( xamlText, ref mode );
List<string> tokenTexts = new List<string>(tokens.Count); List<string> tokenTexts = new List<string>( tokens.Count );
List<Color> colors = new List<Color>(tokens.Count); List<Color> colors = new List<Color>( tokens.Count );
int position = 0; int position = 0;
foreach (XmlToken token in tokens) foreach( XmlToken token in tokens )
{ {
string tokenText = xamlText.Substring(position, token.Length); string tokenText = xamlText.Substring( position, token.Length );
tokenTexts.Add(tokenText); tokenTexts.Add( tokenText );
Color color = ColorForToken(token, tokenText); Color color = ColorForToken( token, tokenText );
colors.Add(color); colors.Add( color );
position += token.Length; position += token.Length;
} }
Paragraph p = new Paragraph(); Paragraph p = new Paragraph();
// Loop through tokens // Loop through tokens
for (int i = 0; i < tokenTexts.Count; i++) for( int i = 0; i < tokenTexts.Count; i++ )
{ {
Run r = new Run(tokenTexts[i]); Run r = new Run( tokenTexts[ i ] );
r.Foreground = new SolidColorBrush(colors[i]); r.Foreground = new SolidColorBrush( colors[ i ] );
p.Inlines.Add(r); p.Inlines.Add( r );
} }
targetDoc.Blocks.Add(p); targetDoc.Blocks.Add( p );
} }
#endregion //ColorizeXAML #endregion //ColorizeXAML
static Color ColorForToken(XmlToken token, string tokenText) static Color ColorForToken( XmlToken token, string tokenText )
{ {
Color color = Color.FromRgb(0, 0, 0); Color color = Color.FromRgb( 0, 0, 0 );
switch (token.Kind) switch( token.Kind )
{ {
case XmlTokenKind.Open: case XmlTokenKind.Open:
case XmlTokenKind.OpenClose: case XmlTokenKind.OpenClose:
@ -89,11 +107,11 @@ namespace Samples.Infrastructure.Converters
case XmlTokenKind.OpenProcessingInstruction: case XmlTokenKind.OpenProcessingInstruction:
case XmlTokenKind.CloseProcessingInstruction: case XmlTokenKind.CloseProcessingInstruction:
case XmlTokenKind.AttributeValue: case XmlTokenKind.AttributeValue:
color = Color.FromRgb(0, 0, 255); color = Color.FromRgb( 0, 0, 255 );
// color = "blue"; // color = "blue";
break; break;
case XmlTokenKind.ElementName: case XmlTokenKind.ElementName:
color = Color.FromRgb(163, 21, 21); color = Color.FromRgb( 163, 21, 21 );
// color = "brown"; // color = "brown";
break; break;
case XmlTokenKind.TextContent: case XmlTokenKind.TextContent:
@ -101,16 +119,16 @@ namespace Samples.Infrastructure.Converters
break; break;
case XmlTokenKind.AttributeName: case XmlTokenKind.AttributeName:
case XmlTokenKind.Entity: case XmlTokenKind.Entity:
color = Color.FromRgb(255, 0, 0); color = Color.FromRgb( 255, 0, 0 );
// color = "red"; // color = "red";
break; break;
case XmlTokenKind.CommentText: case XmlTokenKind.CommentText:
color = Color.FromRgb(0, 128, 0); color = Color.FromRgb( 0, 128, 0 );
// color = "green"; // color = "green";
break; break;
} }
if (token.Kind == XmlTokenKind.ElementWhitespace if( token.Kind == XmlTokenKind.ElementWhitespace
|| (token.Kind == XmlTokenKind.TextContent && tokenText.Trim() == "")) || ( token.Kind == XmlTokenKind.TextContent && tokenText.Trim() == "" ) )
{ {
// color = null; // color = null;
} }

182
ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Core/CodeFormatting/CSharpFormat.cs

@ -22,8 +22,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Media; using System.Windows.Media;
@ -74,7 +74,10 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// </summary> /// </summary>
protected override string CommentRegEx protected override string CommentRegEx
{ {
get { return @"/\*.*?\*/|//.*?(?=\r|\n)"; } get
{
return @"/\*.*?\*/|//.*?(?=\r|\n)";
}
} }
/// <summary> /// <summary>
@ -82,7 +85,10 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// </summary> /// </summary>
protected override string StringRegEx protected override string StringRegEx
{ {
get { return @"@?""""|@?"".*?(?!\\).""|''|'.*?(?!\\).'"; } get
{
return @"@?""""|@?"".*?(?!\\).""|''|'.*?(?!\\).'";
}
} }
} }
@ -112,7 +118,10 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// </remarks> /// </remarks>
protected virtual string Preprocessors protected virtual string Preprocessors
{ {
get { return ""; } get
{
return "";
}
} }
/// <summary> /// <summary>
@ -144,7 +153,10 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// </remarks> /// </remarks>
public virtual bool CaseSensitive public virtual bool CaseSensitive
{ {
get { return true; } get
{
return true;
}
} }
/// <summary/> /// <summary/>
@ -152,35 +164,35 @@ namespace Samples.Infrastructure.Core.CodeFormatting
{ {
//generate the keyword and preprocessor regexes from the keyword lists //generate the keyword and preprocessor regexes from the keyword lists
Regex r; Regex r;
r = new Regex(@"\w+|-\w+|#\w+|@@\w+|#(?:\\(?:s|w)(?:\*|\+)?\w+)+|@\\w\*+"); r = new Regex( @"\w+|-\w+|#\w+|@@\w+|#(?:\\(?:s|w)(?:\*|\+)?\w+)+|@\\w\*+" );
string regKeyword = r.Replace(Keywords, @"(?<=^|\W)$0(?=\W)"); string regKeyword = r.Replace( Keywords, @"(?<=^|\W)$0(?=\W)" );
string regPreproc = r.Replace(Preprocessors, @"(?<=^|\s)$0(?=\s|$)"); string regPreproc = r.Replace( Preprocessors, @"(?<=^|\s)$0(?=\s|$)" );
r = new Regex(@" +"); r = new Regex( @" +" );
regKeyword = r.Replace(regKeyword, @"|"); regKeyword = r.Replace( regKeyword, @"|" );
regPreproc = r.Replace(regPreproc, @"|"); regPreproc = r.Replace( regPreproc, @"|" );
if (regPreproc.Length == 0) if( regPreproc.Length == 0 )
{ {
regPreproc = "(?!.*)_{37}(?<!.*)"; //use something quite impossible... regPreproc = "(?!.*)_{37}(?<!.*)"; //use something quite impossible...
} }
//build a master regex with capturing groups //build a master regex with capturing groups
StringBuilder regAll = new StringBuilder(); StringBuilder regAll = new StringBuilder();
regAll.Append("("); regAll.Append( "(" );
regAll.Append(CommentRegEx); regAll.Append( CommentRegEx );
regAll.Append(")|("); regAll.Append( ")|(" );
regAll.Append(StringRegEx); regAll.Append( StringRegEx );
if (regPreproc.Length > 0) if( regPreproc.Length > 0 )
{ {
regAll.Append(")|("); regAll.Append( ")|(" );
regAll.Append(regPreproc); regAll.Append( regPreproc );
} }
regAll.Append(")|("); regAll.Append( ")|(" );
regAll.Append(regKeyword); regAll.Append( regKeyword );
regAll.Append(")"); regAll.Append( ")" );
RegexOptions caseInsensitive = CaseSensitive ? 0 : RegexOptions.IgnoreCase; RegexOptions caseInsensitive = CaseSensitive ? 0 : RegexOptions.IgnoreCase;
CodeRegex = new Regex(regAll.ToString(), RegexOptions.Singleline | caseInsensitive); CodeRegex = new Regex( regAll.ToString(), RegexOptions.Singleline | caseInsensitive );
CodeParagraphGlobal = new List<Run>(); CodeParagraphGlobal = new List<Run>();
} }
@ -192,44 +204,44 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// <param name="match">The <see cref="Match"/> resulting from a /// <param name="match">The <see cref="Match"/> resulting from a
/// single regular expression match.</param> /// single regular expression match.</param>
/// <returns>A string containing the HTML code fragment.</returns> /// <returns>A string containing the HTML code fragment.</returns>
protected override string MatchEval(Match match) //protected override protected override string MatchEval( Match match ) //protected override
{ {
if (match.Groups[1].Success) //comment if( match.Groups[ 1 ].Success ) //comment
{ {
StringReader reader = new StringReader(match.ToString()); StringReader reader = new StringReader( match.ToString() );
string line; string line;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
while ((line = reader.ReadLine()) != null) while( ( line = reader.ReadLine() ) != null )
{ {
Run r = new Run(line); Run r = new Run( line );
r.Foreground = new SolidColorBrush(Color.FromRgb(0, 128, 0)); r.Foreground = new SolidColorBrush( Color.FromRgb( 0, 128, 0 ) );
CodeParagraphGlobal.Add(r); CodeParagraphGlobal.Add( r );
} }
return "::::::"; return "::::::";
} }
else if (match.Groups[2].Success) //string literal else if( match.Groups[ 2 ].Success ) //string literal
{ {
Run r = new Run(match.ToString()); Run r = new Run( match.ToString() );
r.Foreground = new SolidColorBrush(Color.FromRgb(0, 96, 128)); r.Foreground = new SolidColorBrush( Color.FromRgb( 0, 96, 128 ) );
CodeParagraphGlobal.Add(r); CodeParagraphGlobal.Add( r );
return "::::::"; return "::::::";
} }
else if (match.Groups[3].Success) //preprocessor keyword else if( match.Groups[ 3 ].Success ) //preprocessor keyword
{ {
Run r = new Run(match.ToString()); Run r = new Run( match.ToString() );
r.Foreground = new SolidColorBrush(Color.FromRgb(204, 102, 51)); r.Foreground = new SolidColorBrush( Color.FromRgb( 204, 102, 51 ) );
CodeParagraphGlobal.Add(r); CodeParagraphGlobal.Add( r );
return "::::::"; return "::::::";
} }
else if (match.Groups[4].Success) //keyword else if( match.Groups[ 4 ].Success ) //keyword
{ {
Run r = new Run(match.ToString()); Run r = new Run( match.ToString() );
r.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255)); r.Foreground = new SolidColorBrush( Color.FromRgb( 0, 0, 255 ) );
CodeParagraphGlobal.Add(r); CodeParagraphGlobal.Add( r );
return "::::::"; return "::::::";
} }
else else
@ -277,8 +289,14 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// derived class.</value> /// derived class.</value>
public byte TabSpaces public byte TabSpaces
{ {
get { return _tabSpaces; } get
set { _tabSpaces = value; } {
return _tabSpaces;
}
set
{
_tabSpaces = value;
}
} }
private bool _lineNumbers; private bool _lineNumbers;
@ -290,8 +308,14 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// The default is <b>false</b>.</value> /// The default is <b>false</b>.</value>
public bool LineNumbers public bool LineNumbers
{ {
get { return _lineNumbers; } get
set { _lineNumbers = value; } {
return _lineNumbers;
}
set
{
_lineNumbers = value;
}
} }
private bool _alternate; private bool _alternate;
@ -303,8 +327,14 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// The default is <b>false</b>.</value> /// The default is <b>false</b>.</value>
public bool Alternate public bool Alternate
{ {
get { return _alternate; } get
set { _alternate = value; } {
return _alternate;
}
set
{
_alternate = value;
}
} }
private bool _embedStyleSheet; private bool _embedStyleSheet;
@ -316,17 +346,23 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// in the HTML output. The default is <b>false</b>.</value> /// in the HTML output. The default is <b>false</b>.</value>
public bool EmbedStyleSheet public bool EmbedStyleSheet
{ {
get { return _embedStyleSheet; } get
set { _embedStyleSheet = value; } {
return _embedStyleSheet;
}
set
{
_embedStyleSheet = value;
}
} }
/// <summary> /// <summary>
/// Transforms a source code string to HTML 4.01. /// Transforms a source code string to HTML 4.01.
/// </summary> /// </summary>
/// <returns>A string containing the HTML formatted code.</returns> /// <returns>A string containing the HTML formatted code.</returns>
public Paragraph FormatCode(string source) public Paragraph FormatCode( string source )
{ {
return FormatCode(source, _lineNumbers, _alternate, _embedStyleSheet, false); return FormatCode( source, _lineNumbers, _alternate, _embedStyleSheet, false );
} }
private Regex codeRegex; private Regex codeRegex;
@ -336,8 +372,14 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// </summary> /// </summary>
protected Regex CodeRegex protected Regex CodeRegex
{ {
get { return codeRegex; } get
set { codeRegex = value; } {
return codeRegex;
}
set
{
codeRegex = value;
}
} }
private List<Run> codeParagraphGlobal; private List<Run> codeParagraphGlobal;
@ -346,8 +388,14 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// </summary> /// </summary>
protected List<Run> CodeParagraphGlobal protected List<Run> CodeParagraphGlobal
{ {
get { return codeParagraphGlobal; } get
set { codeParagraphGlobal = value; } {
return codeParagraphGlobal;
}
set
{
codeParagraphGlobal = value;
}
} }
/// <summary> /// <summary>
@ -357,30 +405,30 @@ namespace Samples.Infrastructure.Core.CodeFormatting
/// <param name="match">The <see cref="Match"/> resulting from a /// <param name="match">The <see cref="Match"/> resulting from a
/// single regular expression match.</param> /// single regular expression match.</param>
/// <returns>A string containing the HTML code fragment.</returns> /// <returns>A string containing the HTML code fragment.</returns>
protected abstract string MatchEval(Match match); //protected abstract protected abstract string MatchEval( Match match ); //protected abstract
//does the formatting job //does the formatting job
private Paragraph FormatCode(string source, bool lineNumbers, private Paragraph FormatCode( string source, bool lineNumbers,
bool alternate, bool embedStyleSheet, bool subCode) bool alternate, bool embedStyleSheet, bool subCode )
{ {
Paragraph codeParagraph = new Paragraph(); Paragraph codeParagraph = new Paragraph();
//replace special characters //replace special characters
StringBuilder sb = new StringBuilder(source); StringBuilder sb = new StringBuilder( source );
//color the code //color the code
source = codeRegex.Replace(sb.ToString(), new MatchEvaluator(this.MatchEval)); source = codeRegex.Replace( sb.ToString(), new MatchEvaluator( this.MatchEval ) );
//codeRegex.Replace( //codeRegex.Replace(
string[] characters = { "::::::" }; string[] characters = { "::::::" };
string[] split = source.Split(characters, new StringSplitOptions()); string[] split = source.Split( characters, new StringSplitOptions() );
int currentChunk = 0; int currentChunk = 0;
foreach (string code in split) foreach( string code in split )
{ {
currentChunk++; currentChunk++;
Run r = new Run(code); Run r = new Run( code );
codeParagraph.Inlines.Add(r); codeParagraph.Inlines.Add( r );
if ((currentChunk - 1) < codeParagraphGlobal.Count) if( ( currentChunk - 1 ) < codeParagraphGlobal.Count )
{ {
codeParagraph.Inlines.Add(codeParagraphGlobal[currentChunk - 1]); codeParagraph.Inlines.Add( codeParagraphGlobal[ currentChunk - 1 ] );
} }
} }

165
ExtendedWPFToolkitSolution/Src/Samples/Samples.Infrastructure/Core/CodeFormatting/XamlFormat.cs

@ -1,7 +1,6 @@
//Author: Nick Kramer [MSFT] //Author: Nick Kramer [MSFT]
//Source: http://blogs.msdn.com/b/nickkramer/archive/2006/09/22/766934.aspx //Source: http://blogs.msdn.com/b/nickkramer/archive/2006/09/22/766934.aspx
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@ -13,13 +12,13 @@ namespace Samples.Infrastructure.Core.CodeFormatting
private string input; private string input;
private int position = 0; private int position = 0;
private XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement; private XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement;
public static List<XmlToken> Tokenize(string input) public static List<XmlToken> Tokenize( string input )
{ {
XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement; XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement;
XmlTokenizer tokenizer = new XmlTokenizer(); XmlTokenizer tokenizer = new XmlTokenizer();
return tokenizer.Tokenize(input, ref mode); return tokenizer.Tokenize( input, ref mode );
} }
public List<XmlToken> Tokenize(string input, ref XmlTokenizerMode _mode) public List<XmlToken> Tokenize( string input, ref XmlTokenizerMode _mode )
{ {
this.input = input; this.input = input;
this.mode = _mode; this.mode = _mode;
@ -36,20 +35,20 @@ namespace Samples.Infrastructure.Core.CodeFormatting
{ {
int previousPosition = position; int previousPosition = position;
token = NextToken(); token = NextToken();
string tokenText = input.Substring(previousPosition, token.Length); string tokenText = input.Substring( previousPosition, token.Length );
list.Add(token); list.Add( token );
} }
while (token.Kind != XmlTokenKind.EOF); while( token.Kind != XmlTokenKind.EOF );
List<string> strings = TokensToStrings(list, input); List<string> strings = TokensToStrings( list, input );
return list; return list;
} }
private List<string> TokensToStrings(List<XmlToken> list, string input) private List<string> TokensToStrings( List<XmlToken> list, string input )
{ {
List<string> output = new List<string>(); List<string> output = new List<string>();
int position = 0; int position = 0;
foreach (XmlToken token in list) foreach( XmlToken token in list )
{ {
output.Add(input.Substring(position, token.Length)); output.Add( input.Substring( position, token.Length ) );
position += token.Length; position += token.Length;
} }
return output; return output;
@ -59,24 +58,24 @@ namespace Samples.Infrastructure.Core.CodeFormatting
{ {
get get
{ {
return input.Substring(position); return input.Substring( position );
} }
} }
private XmlToken NextToken() private XmlToken NextToken()
{ {
if (position >= input.Length) if( position >= input.Length )
return new XmlToken(XmlTokenKind.EOF, 0); return new XmlToken( XmlTokenKind.EOF, 0 );
XmlToken token; XmlToken token;
switch (mode) switch( mode )
{ {
case XmlTokenizerMode.AfterAttributeEquals: case XmlTokenizerMode.AfterAttributeEquals:
token = TokenizeAttributeValue(); token = TokenizeAttributeValue();
break; break;
case XmlTokenizerMode.AfterAttributeName: case XmlTokenizerMode.AfterAttributeName:
token = TokenizeSimple("=", XmlTokenKind.Equals, XmlTokenizerMode.AfterAttributeEquals); token = TokenizeSimple( "=", XmlTokenKind.Equals, XmlTokenizerMode.AfterAttributeEquals );
break; break;
case XmlTokenizerMode.AfterOpen: case XmlTokenizerMode.AfterOpen:
token = TokenizeName(XmlTokenKind.ElementName, XmlTokenizerMode.InsideElement); token = TokenizeName( XmlTokenKind.ElementName, XmlTokenizerMode.InsideElement );
break; break;
case XmlTokenizerMode.InsideCData: case XmlTokenizerMode.InsideCData:
token = TokenizeInsideCData(); token = TokenizeInsideCData();
@ -94,35 +93,35 @@ namespace Samples.Infrastructure.Core.CodeFormatting
token = TokenizeOutsideElement(); token = TokenizeOutsideElement();
break; break;
default: default:
token = new XmlToken(XmlTokenKind.EOF, 0); token = new XmlToken( XmlTokenKind.EOF, 0 );
Debug.Fail("missing case"); Debug.Fail( "missing case" );
break; break;
} }
return token; return token;
} }
private bool IsNameCharacter(char character) private bool IsNameCharacter( char character )
{ {
// XML rule: Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender // XML rule: Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
bool result = char.IsLetterOrDigit(character) || character == '.' | character == '-' | character == '_' | character == ':'; bool result = char.IsLetterOrDigit( character ) || character == '.' | character == '-' | character == '_' | character == ':';
return result; return result;
} }
private XmlToken TokenizeAttributeValue() private XmlToken TokenizeAttributeValue()
{ {
Debug.Assert(mode == XmlTokenizerMode.AfterAttributeEquals); Debug.Assert( mode == XmlTokenizerMode.AfterAttributeEquals );
int closePosition = input.IndexOf(input[position], position + 1); int closePosition = input.IndexOf( input[ position ], position + 1 );
XmlToken token = new XmlToken(XmlTokenKind.AttributeValue, closePosition + 1 - position); XmlToken token = new XmlToken( XmlTokenKind.AttributeValue, closePosition + 1 - position );
position = closePosition + 1; position = closePosition + 1;
mode = XmlTokenizerMode.InsideElement; mode = XmlTokenizerMode.InsideElement;
return token; return token;
} }
private XmlToken TokenizeName(XmlTokenKind kind, XmlTokenizerMode nextMode) private XmlToken TokenizeName( XmlTokenKind kind, XmlTokenizerMode nextMode )
{ {
Debug.Assert(mode == XmlTokenizerMode.AfterOpen || mode == XmlTokenizerMode.InsideElement); Debug.Assert( mode == XmlTokenizerMode.AfterOpen || mode == XmlTokenizerMode.InsideElement );
int i; int i;
for (i = position; i < input.Length; i++) for( i = position; i < input.Length; i++ )
if (!IsNameCharacter(input[i])) if( !IsNameCharacter( input[ i ] ) )
break; break;
XmlToken token = new XmlToken(kind, i - position); XmlToken token = new XmlToken( kind, i - position );
mode = nextMode; mode = nextMode;
position = i; position = i;
return token; return token;
@ -130,52 +129,52 @@ namespace Samples.Infrastructure.Core.CodeFormatting
private XmlToken TokenizeElementWhitespace() private XmlToken TokenizeElementWhitespace()
{ {
int i; int i;
for (i = position; i < input.Length; i++) for( i = position; i < input.Length; i++ )
if (!char.IsWhiteSpace(input[i])) if( !char.IsWhiteSpace( input[ i ] ) )
break; break;
XmlToken token = new XmlToken(XmlTokenKind.ElementWhitespace, i - position); XmlToken token = new XmlToken( XmlTokenKind.ElementWhitespace, i - position );
position = i; position = i;
return token; return token;
} }
private bool StartsWith(string text) private bool StartsWith( string text )
{ {
if (position + text.Length > input.Length) if( position + text.Length > input.Length )
return false; return false;
else else
return input.Substring(position, text.Length) == text; return input.Substring( position, text.Length ) == text;
} }
private XmlToken TokenizeInsideElement() private XmlToken TokenizeInsideElement()
{ {
if (char.IsWhiteSpace(input[position])) if( char.IsWhiteSpace( input[ position ] ) )
return TokenizeElementWhitespace(); return TokenizeElementWhitespace();
else else
if (StartsWith("/>")) if( StartsWith( "/>" ) )
return TokenizeSimple("/>", XmlTokenKind.SelfClose, XmlTokenizerMode.OutsideElement); return TokenizeSimple( "/>", XmlTokenKind.SelfClose, XmlTokenizerMode.OutsideElement );
else else
if (StartsWith(">")) if( StartsWith( ">" ) )
return TokenizeSimple(">", XmlTokenKind.Close, XmlTokenizerMode.OutsideElement); return TokenizeSimple( ">", XmlTokenKind.Close, XmlTokenizerMode.OutsideElement );
else else
return TokenizeName(XmlTokenKind.AttributeName, XmlTokenizerMode.AfterAttributeName); return TokenizeName( XmlTokenKind.AttributeName, XmlTokenizerMode.AfterAttributeName );
} }
private XmlToken TokenizeText() private XmlToken TokenizeText()
{ {
Debug.Assert(input[position] != '<'); Debug.Assert( input[ position ] != '<' );
Debug.Assert(input[position] != '&'); Debug.Assert( input[ position ] != '&' );
Debug.Assert(mode == XmlTokenizerMode.OutsideElement); Debug.Assert( mode == XmlTokenizerMode.OutsideElement );
int i; int i;
for (i = position; i < input.Length; i++) for( i = position; i < input.Length; i++ )
if (input[i] == '<' || input[i] == '&') if( input[ i ] == '<' || input[ i ] == '&' )
break; break;
XmlToken token = new XmlToken(XmlTokenKind.TextContent, i - position); XmlToken token = new XmlToken( XmlTokenKind.TextContent, i - position );
position = i; position = i;
return token; return token;
} }
private XmlToken TokenizeOutsideElement() private XmlToken TokenizeOutsideElement()
{ {
Debug.Assert(mode == XmlTokenizerMode.OutsideElement); Debug.Assert( mode == XmlTokenizerMode.OutsideElement );
if (position >= input.Length) if( position >= input.Length )
return new XmlToken(XmlTokenKind.EOF, 0); return new XmlToken( XmlTokenKind.EOF, 0 );
switch (input[position]) switch( input[ position ] )
{ {
case '<': case '<':
return TokenizeOpen(); return TokenizeOpen();
@ -185,85 +184,85 @@ namespace Samples.Infrastructure.Core.CodeFormatting
return TokenizeText(); return TokenizeText();
} }
} }
private XmlToken TokenizeSimple(string text, XmlTokenKind kind, XmlTokenizerMode nextMode) private XmlToken TokenizeSimple( string text, XmlTokenKind kind, XmlTokenizerMode nextMode )
{ {
XmlToken token = new XmlToken(kind, text.Length); XmlToken token = new XmlToken( kind, text.Length );
position += text.Length; position += text.Length;
mode = nextMode; mode = nextMode;
return token; return token;
} }
private XmlToken TokenizeOpen() private XmlToken TokenizeOpen()
{ {
Debug.Assert(input[position] == '<'); Debug.Assert( input[ position ] == '<' );
if (StartsWith("<!--")) if( StartsWith( "<!--" ) )
return TokenizeSimple("<!--", XmlTokenKind.CommentBegin, XmlTokenizerMode.InsideComment); return TokenizeSimple( "<!--", XmlTokenKind.CommentBegin, XmlTokenizerMode.InsideComment );
else else
if (StartsWith("<![CDATA[")) if( StartsWith( "<![CDATA[" ) )
return TokenizeSimple("<![CDATA[", XmlTokenKind.CDataBegin, XmlTokenizerMode.InsideCData); return TokenizeSimple( "<![CDATA[", XmlTokenKind.CDataBegin, XmlTokenizerMode.InsideCData );
else else
if (StartsWith("<?")) if( StartsWith( "<?" ) )
return TokenizeSimple("<?", XmlTokenKind.OpenProcessingInstruction, XmlTokenizerMode.InsideProcessingInstruction); return TokenizeSimple( "<?", XmlTokenKind.OpenProcessingInstruction, XmlTokenizerMode.InsideProcessingInstruction );
else else
if (StartsWith("</")) if( StartsWith( "</" ) )
return TokenizeSimple("</", XmlTokenKind.OpenClose, XmlTokenizerMode.AfterOpen); return TokenizeSimple( "</", XmlTokenKind.OpenClose, XmlTokenizerMode.AfterOpen );
else else
return TokenizeSimple("<", XmlTokenKind.Open, XmlTokenizerMode.AfterOpen); return TokenizeSimple( "<", XmlTokenKind.Open, XmlTokenizerMode.AfterOpen );
} }
private XmlToken TokenizeEntity() private XmlToken TokenizeEntity()
{ {
Debug.Assert(mode == XmlTokenizerMode.OutsideElement); Debug.Assert( mode == XmlTokenizerMode.OutsideElement );
Debug.Assert(input[position] == '&'); Debug.Assert( input[ position ] == '&' );
XmlToken token = new XmlToken(XmlTokenKind.Entity, input.IndexOf(';', position) - position); XmlToken token = new XmlToken( XmlTokenKind.Entity, input.IndexOf( ';', position ) - position );
position += token.Length; position += token.Length;
return token; return token;
} }
private XmlToken TokenizeInsideProcessingInstruction() private XmlToken TokenizeInsideProcessingInstruction()
{ {
Debug.Assert(mode == XmlTokenizerMode.InsideProcessingInstruction); Debug.Assert( mode == XmlTokenizerMode.InsideProcessingInstruction );
int tokenend = input.IndexOf("?>", position); int tokenend = input.IndexOf( "?>", position );
if (position == tokenend) if( position == tokenend )
{ {
position += "?>".Length; position += "?>".Length;
mode = XmlTokenizerMode.OutsideElement; mode = XmlTokenizerMode.OutsideElement;
return new XmlToken(XmlTokenKind.CloseProcessingInstruction, "?>".Length); return new XmlToken( XmlTokenKind.CloseProcessingInstruction, "?>".Length );
} }
else else
{ {
XmlToken token = new XmlToken(XmlTokenKind.TextContent, tokenend - position); XmlToken token = new XmlToken( XmlTokenKind.TextContent, tokenend - position );
position = tokenend; position = tokenend;
return token; return token;
} }
} }
private XmlToken TokenizeInsideCData() private XmlToken TokenizeInsideCData()
{ {
Debug.Assert(mode == XmlTokenizerMode.InsideCData); Debug.Assert( mode == XmlTokenizerMode.InsideCData );
int tokenend = input.IndexOf("]]>", position); int tokenend = input.IndexOf( "]]>", position );
if (position == tokenend) if( position == tokenend )
{ {
position += "]]>".Length; position += "]]>".Length;
mode = XmlTokenizerMode.OutsideElement; mode = XmlTokenizerMode.OutsideElement;
return new XmlToken(XmlTokenKind.CDataEnd, "]]>".Length); return new XmlToken( XmlTokenKind.CDataEnd, "]]>".Length );
} }
else else
{ {
XmlToken token = new XmlToken(XmlTokenKind.TextContent, tokenend - position); XmlToken token = new XmlToken( XmlTokenKind.TextContent, tokenend - position );
position = tokenend; position = tokenend;
return token; return token;
} }
} }
private XmlToken TokenizeInsideComment() private XmlToken TokenizeInsideComment()
{ {
Debug.Assert(mode == XmlTokenizerMode.InsideComment); Debug.Assert( mode == XmlTokenizerMode.InsideComment );
int tokenend = input.IndexOf("-->", position); int tokenend = input.IndexOf( "-->", position );
if (position == tokenend) if( position == tokenend )
{ {
position += "-->".Length; position += "-->".Length;
mode = XmlTokenizerMode.OutsideElement; mode = XmlTokenizerMode.OutsideElement;
return new XmlToken(XmlTokenKind.CommentEnd, "-->".Length); return new XmlToken( XmlTokenKind.CommentEnd, "-->".Length );
} }
else else
{ {
XmlToken token = new XmlToken(XmlTokenKind.CommentText, tokenend - position); XmlToken token = new XmlToken( XmlTokenKind.CommentText, tokenend - position );
position = tokenend; position = tokenend;
return token; return token;
} }
@ -288,10 +287,10 @@ namespace Samples.Infrastructure.Core.CodeFormatting
{ {
public XmlTokenKind Kind; public XmlTokenKind Kind;
public short Length; public short Length;
public XmlToken(XmlTokenKind kind, int length) public XmlToken( XmlTokenKind kind, int length )
{ {
Kind = kind; Kind = kind;
Length = (short)length; Length = ( short )length;
} }
} }

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save