Browse Source

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

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

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

@ -1,30 +1,47 @@
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.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions;
using Samples.Modules.BusyIndicator.NavigationItems;
using Samples.Modules.BusyIndicator.Views;
namespace Samples.Modules.BusyIndicator
{
public class BusyIndicatorModule : ModuleBase
public class BusyIndicatorModule : ModuleBase
{
public BusyIndicatorModule( IUnityContainer container, IRegionManager regionManager )
: base( container, regionManager )
{
}
protected override void RegisterViewsAndTypes()
{
Container.RegisterNavigationType( typeof( BusyIndicatorView ) );
Container.RegisterNavigationType( typeof( BusyIndicatorCustomContentView ) );
Container.RegisterNavigationType( typeof( BusyIndicatorCustomContentTemplateView ) );
}
protected override void InitializeModule()
{
public BusyIndicatorModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager)
{
}
protected override void RegisterViewsAndTypes()
{
Container.RegisterNavigationType(typeof(BusyIndicatorView));
Container.RegisterNavigationType(typeof(BusyIndicatorCustomContentView));
Container.RegisterNavigationType(typeof(BusyIndicatorCustomContentTemplateView));
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(BusyIndicatorNavItem));
}
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( BusyIndicatorNavItem ) );
}
}
}

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

@ -1,14 +1,32 @@
<TreeViewItem x:Class="Samples.Modules.BusyIndicator.NavigationItems.BusyIndicatorNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.BusyIndicator.NavigationItems"
xmlns:views="clr-namespace:Samples.Modules.BusyIndicator.Views"
Header="BusyIndicator" Tag="{x:Type views:BusyIndicatorView}">
<TreeViewItem.Resources>
<Style TargetType="navItems:BusyIndicatorNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem.Resources>
<Style TargetType="navItems:BusyIndicatorNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem Header="Custom Content" Tag="{x:Type views:BusyIndicatorCustomContentView}" />
<TreeViewItem Header="Custom Content Template" Tag="{x:Type views:BusyIndicatorCustomContentTemplateView}" />
<TreeViewItem Header="Custom Content" Tag="{x:Type views:BusyIndicatorCustomContentView}" />
<TreeViewItem Header="Custom Content Template" Tag="{x:Type views:BusyIndicatorCustomContentTemplateView}" />
</TreeViewItem>

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

@ -1,16 +1,34 @@
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;
namespace Samples.Modules.BusyIndicator.NavigationItems
{
/// <summary>
/// Interaction logic for BusyIndicatorNavItem.xaml
/// </summary>
public partial class BusyIndicatorNavItem : TreeViewItem
/// <summary>
/// Interaction logic for BusyIndicatorNavItem.xaml
/// </summary>
public partial class BusyIndicatorNavItem : TreeViewItem
{
public BusyIndicatorNavItem()
{
public BusyIndicatorNavItem()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

52
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.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.BusyIndicator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Samples.Modules.BusyIndicator")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTitle( "Samples.Modules.BusyIndicator" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "Samples.Modules.BusyIndicator" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: ComVisible( false )]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -33,11 +49,11 @@ using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

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

@ -1,42 +1,60 @@
<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:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended">
<DataTemplate x:Key="SampleContent" >
<Grid Margin="10" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="First Name:" Margin="2" VerticalAlignment="Center" />
<extToolkit:WatermarkTextBox Grid.Row="0" Grid.Column="1" Margin="2" VerticalAlignment="Center" Watermark="Enter First Name" />
<TextBlock Grid.Row="1" Text="Last Name:" Margin="2" VerticalAlignment="Center" />
<extToolkit:WatermarkTextBox Grid.Row="1" Grid.Column="1" Margin="2" VerticalAlignment="Center" Watermark="Enter Last Name" />
<TextBlock Grid.Row="2" Text="Date of Birth:" Margin="2" VerticalAlignment="Center" />
<extToolkit:DateTimeUpDown Grid.Row="2" Grid.Column="1" Format="ShortDate" Margin="2" VerticalAlignment="Center" Watermark="Enter Date of Birth" />
<TextBlock Grid.Row="3" Text="Salary:" Margin="2" VerticalAlignment="Center" />
<extToolkit:IntegerUpDown Grid.Row="3" Grid.Column="1" FormatString="C2" Margin="2" VerticalAlignment="Center" Watermark="Enter Salary" />
<TextBlock Grid.Row="4" Text="Favorite Color:" Margin="2" VerticalAlignment="Center" />
<extToolkit:ColorPicker Grid.Row="4" Grid.Column="1" Margin="2" VerticalAlignment="Center" />
<StackPanel Grid.Row="5" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
<Button Width="65" Margin="2">OK</Button>
<Button Width="65" Margin="2">Cancel</Button>
</StackPanel>
</Grid>
</DataTemplate>
<DataTemplate x:Key="SampleContent">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="First Name:" Margin="2" VerticalAlignment="Center" />
<extToolkit:WatermarkTextBox Grid.Row="0" Grid.Column="1" Margin="2" VerticalAlignment="Center" Watermark="Enter First Name" />
<TextBlock Grid.Row="1" Text="Last Name:" Margin="2" VerticalAlignment="Center" />
<extToolkit:WatermarkTextBox Grid.Row="1" Grid.Column="1" Margin="2" VerticalAlignment="Center" Watermark="Enter Last Name" />
<TextBlock Grid.Row="2" Text="Date of Birth:" Margin="2" VerticalAlignment="Center" />
<extToolkit:DateTimeUpDown Grid.Row="2" Grid.Column="1" Format="ShortDate" Margin="2" VerticalAlignment="Center" Watermark="Enter Date of Birth" />
<TextBlock Grid.Row="3" Text="Salary:" Margin="2" VerticalAlignment="Center" />
<extToolkit:IntegerUpDown Grid.Row="3" Grid.Column="1" FormatString="C2" Margin="2" VerticalAlignment="Center" Watermark="Enter Salary" />
<TextBlock Grid.Row="4" Text="Favorite Color:" Margin="2" VerticalAlignment="Center" />
<extToolkit:ColorPicker Grid.Row="4" Grid.Column="1" Margin="2" VerticalAlignment="Center" />
<StackPanel Grid.Row="5" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
<Button Width="65" Margin="2">OK</Button>
<Button Width="65" Margin="2">Cancel</Button>
</StackPanel>
</Grid>
</DataTemplate>
</ResourceDictionary>

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

@ -1,63 +1,81 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="BusyIndicator">
<infControls:DemoView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Samples.Modules.Busyindicator;component/Resources/Common.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</infControls:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</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."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<TextBlock Grid.Row="2" Text="Custom Content Template:" Style="{StaticResource Header}" />
<extToolkit:BusyIndicator IsBusy="True">
<extToolkit:BusyIndicator.BusyContentTemplate>
<DataTemplate>
<StackPanel Margin="4">
<TextBlock Text="Downloading Email" FontWeight="Bold" HorizontalAlignment="Center"/>
<StackPanel Margin="4">
<TextBlock Text="Downloading message 4/10..."/>
<ProgressBar Value="40" Height="15"/>
</StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<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"/>
</Grid>
</StackPanel>
</DataTemplate>
</extToolkit:BusyIndicator.BusyContentTemplate>
<extToolkit:BusyIndicator.OverlayStyle>
<Style TargetType="Rectangle">
<Setter Property="Fill" Value="#B1EB1D1D"/>
</Style>
</extToolkit:BusyIndicator.OverlayStyle>
<extToolkit:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar">
<Setter Property="Visibility" Value="Collapsed"/>
</Style>
</extToolkit:BusyIndicator.ProgressBarStyle>
<ContentControl ContentTemplate="{StaticResource SampleContent}" />
</extToolkit:BusyIndicator>
</StackPanel>
</Grid>
<infControls:DemoView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Samples.Modules.Busyindicator;component/Resources/Common.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</infControls:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</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."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<TextBlock Grid.Row="2" Text="Custom Content Template:" Style="{StaticResource Header}" />
<extToolkit:BusyIndicator IsBusy="True">
<extToolkit:BusyIndicator.BusyContentTemplate>
<DataTemplate>
<StackPanel Margin="4">
<TextBlock Text="Downloading Email" FontWeight="Bold" HorizontalAlignment="Center" />
<StackPanel Margin="4">
<TextBlock Text="Downloading message 4/10..." />
<ProgressBar Value="40" Height="15" />
</StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<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" />
</Grid>
</StackPanel>
</DataTemplate>
</extToolkit:BusyIndicator.BusyContentTemplate>
<extToolkit:BusyIndicator.OverlayStyle>
<Style TargetType="Rectangle">
<Setter Property="Fill" Value="#B1EB1D1D" />
</Style>
</extToolkit:BusyIndicator.OverlayStyle>
<extToolkit:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</extToolkit:BusyIndicator.ProgressBarStyle>
<ContentControl ContentTemplate="{StaticResource SampleContent}" />
</extToolkit:BusyIndicator>
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,18 +1,35 @@
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 Samples.Infrastructure.Controls;
namespace Samples.Modules.BusyIndicator.Views
{
/// <summary>
/// Interaction logic for BusyIndicatorCustomContentTemplateView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive=false)]
public partial class BusyIndicatorCustomContentTemplateView : DemoView
/// <summary>
/// Interaction logic for BusyIndicatorCustomContentTemplateView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class BusyIndicatorCustomContentTemplateView : DemoView
{
public BusyIndicatorCustomContentTemplateView()
{
public BusyIndicatorCustomContentTemplateView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,41 +1,59 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="BusyIndicator">
<infControls:DemoView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Samples.Modules.Busyindicator;component/Resources/Common.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</infControls:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="This example demonstrates how to define your own custom content. This is done by setting the BusyContent property."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Custom Content:" Style="{StaticResource Header}" />
<extToolkit:BusyIndicator IsBusy="True">
<extToolkit:BusyIndicator.BusyContent>
<StackPanel Orientation="Horizontal" >
<Image Source="/Samples.Modules.BusyIndicator;component/Images/CdBurning32.png" />
<StackPanel Margin="5,0">
<TextBlock Text="Burning CD..." VerticalAlignment="Center" />
<TextBlock Text="Madonna - Like a Virgin" VerticalAlignment="Center" Margin="8,0" />
</StackPanel>
</StackPanel>
</extToolkit:BusyIndicator.BusyContent>
<ContentControl ContentTemplate="{StaticResource SampleContent}" />
</extToolkit:BusyIndicator>
</StackPanel>
</Grid>
<infControls:DemoView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Samples.Modules.Busyindicator;component/Resources/Common.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</infControls:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="This example demonstrates how to define your own custom content. This is done by setting the BusyContent property."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Custom Content:" Style="{StaticResource Header}" />
<extToolkit:BusyIndicator IsBusy="True">
<extToolkit:BusyIndicator.BusyContent>
<StackPanel Orientation="Horizontal">
<Image Source="/Samples.Modules.BusyIndicator;component/Images/CdBurning32.png" />
<StackPanel Margin="5,0">
<TextBlock Text="Burning CD..." VerticalAlignment="Center" />
<TextBlock Text="Madonna - Like a Virgin" VerticalAlignment="Center" Margin="8,0" />
</StackPanel>
</StackPanel>
</extToolkit:BusyIndicator.BusyContent>
<ContentControl ContentTemplate="{StaticResource SampleContent}" />
</extToolkit:BusyIndicator>
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,18 +1,35 @@
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 Samples.Infrastructure.Controls;
namespace Samples.Modules.BusyIndicator.Views
{
/// <summary>
/// Interaction logic for BusyIndicatorCustomContentView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive=false)]
public partial class BusyIndicatorCustomContentView : DemoView
/// <summary>
/// Interaction logic for BusyIndicatorCustomContentView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class BusyIndicatorCustomContentView : DemoView
{
public BusyIndicatorCustomContentView()
{
public BusyIndicatorCustomContentView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

120
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Samples.Modules.BusyIndicator.Views"
@ -6,54 +24,54 @@
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="BusyIndicator">
<infControls:DemoView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Samples.Modules.Busyindicator;component/Resources/Common.xaml" />
</ResourceDictionary.MergedDictionaries>
<local:IntegerToTimespanConverter x:Key="TimeSpanConverter" />
</ResourceDictionary>
</infControls:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</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."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" >
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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" />
<TextBlock Text="DisplayAfter:" Grid.Row="1" VerticalAlignment="Center" Margin="2"/>
<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." />
<TextBlock Text="milliseconds" Margin="5,0" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Usage:" Style="{StaticResource Header}" />
<extToolkit:BusyIndicator IsBusy="{Binding IsChecked, ElementName=_isBusy}" DisplayAfter="{Binding Value, ElementName=_displayAfter, Converter={StaticResource TimeSpanConverter}}" >
<ContentControl ContentTemplate="{StaticResource SampleContent}" />
</extToolkit:BusyIndicator>
</StackPanel>
</Grid>
<infControls:DemoView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Samples.Modules.Busyindicator;component/Resources/Common.xaml" />
</ResourceDictionary.MergedDictionaries>
<local:IntegerToTimespanConverter x:Key="TimeSpanConverter" />
</ResourceDictionary>
</infControls:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</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."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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" />
<TextBlock Text="DisplayAfter:" Grid.Row="1" VerticalAlignment="Center" Margin="2" />
<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." />
<TextBlock Text="milliseconds" Margin="5,0" VerticalAlignment="Center" />
</StackPanel>
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Usage:" Style="{StaticResource Header}" />
<extToolkit:BusyIndicator IsBusy="{Binding IsChecked, ElementName=_isBusy}" DisplayAfter="{Binding Value, ElementName=_displayAfter, Converter={StaticResource TimeSpanConverter}}">
<ContentControl ContentTemplate="{StaticResource SampleContent}" />
</extToolkit:BusyIndicator>
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,32 +1,50 @@
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 Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.BusyIndicator.Views
{
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive=false)]
public partial class BusyIndicatorView : DemoView
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class BusyIndicatorView : DemoView
{
public BusyIndicatorView()
{
InitializeComponent();
}
}
public class IntegerToTimespanConverter : IValueConverter
{
public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{
public BusyIndicatorView()
{
InitializeComponent();
}
return TimeSpan.FromMilliseconds( ( int )value );
}
public class IntegerToTimespanConverter : IValueConverter
public object ConvertBack( 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);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
throw new NotImplementedException();
}
}
}

59
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.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions;
using Samples.Modules.Button.Views;
using Samples.Modules.Button.NavigationItems;
using Samples.Modules.Button.Views;
namespace Samples.Modules.Button
{
public class ButtonModule : ModuleBase
public class ButtonModule : ModuleBase
{
public ButtonModule( IUnityContainer container, IRegionManager regionManager )
: base( container, regionManager )
{
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( ButtonSpinnerNavItem ) );
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( DropDownButtonNavItem ) );
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( SplitButtonNavItem ) );
}
protected override void RegisterViewsAndTypes()
{
public ButtonModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager) { }
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(ButtonSpinnerNavItem));
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(DropDownButtonNavItem));
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(SplitButtonNavItem));
}
protected override void RegisterViewsAndTypes()
{
Container.RegisterNavigationType(typeof(ButtonSpinnerView));
Container.RegisterNavigationType(typeof(DropDownButtonView));
Container.RegisterNavigationType(typeof(SplitButtonView));
}
Container.RegisterNavigationType( typeof( ButtonSpinnerView ) );
Container.RegisterNavigationType( typeof( DropDownButtonView ) );
Container.RegisterNavigationType( typeof( SplitButtonView ) );
}
}
}

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

@ -1,12 +1,30 @@
<TreeViewItem x:Class="Samples.Modules.Button.NavigationItems.ButtonSpinnerNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.Button.NavigationItems"
xmlns:views="clr-namespace:Samples.Modules.Button.Views"
Header="ButtonSpinner" Tag="{x:Type views:ButtonSpinnerView}" >
<TreeViewItem.Resources>
<Style TargetType="navItems:ButtonSpinnerNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem.Resources>
<Style TargetType="navItems:ButtonSpinnerNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
</TreeViewItem>

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

@ -1,16 +1,33 @@
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;
namespace Samples.Modules.Button.NavigationItems
{
/// <summary>
/// Interaction logic for ButtonSpinnerNavItem.xaml
/// </summary>
public partial class ButtonSpinnerNavItem : TreeViewItem
/// <summary>
/// Interaction logic for ButtonSpinnerNavItem.xaml
/// </summary>
public partial class ButtonSpinnerNavItem : TreeViewItem
{
public ButtonSpinnerNavItem()
{
public ButtonSpinnerNavItem()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,12 +1,30 @@
<TreeViewItem x:Class="Samples.Modules.Button.NavigationItems.DropDownButtonNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.Button.NavigationItems"
xmlns:views="clr-namespace:Samples.Modules.Button.Views"
Header="DropDownButton" Tag="{x:Type views:DropDownButtonView}">
<TreeViewItem.Resources>
<Style TargetType="navItems:DropDownButtonNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem.Resources>
<Style TargetType="navItems:DropDownButtonNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
</TreeViewItem>

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

@ -1,16 +1,33 @@
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;
namespace Samples.Modules.Button.NavigationItems
{
/// <summary>
/// Interaction logic for DropDownButtonNavItem.xaml
/// </summary>
public partial class DropDownButtonNavItem : TreeViewItem
/// <summary>
/// Interaction logic for DropDownButtonNavItem.xaml
/// </summary>
public partial class DropDownButtonNavItem : TreeViewItem
{
public DropDownButtonNavItem()
{
public DropDownButtonNavItem()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,12 +1,30 @@
<TreeViewItem x:Class="Samples.Modules.Button.NavigationItems.SplitButtonNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.Button.NavigationItems"
xmlns:views="clr-namespace:Samples.Modules.Button.Views"
Header="SplitButton" Tag="{x:Type views:SplitButtonView}">
<TreeViewItem.Resources>
<Style TargetType="navItems:SplitButtonNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem.Resources>
<Style TargetType="navItems:SplitButtonNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
</TreeViewItem>

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

@ -1,16 +1,33 @@
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;
namespace Samples.Modules.Button.NavigationItems
{
/// <summary>
/// Interaction logic for SplitButtonNavItem.xaml
/// </summary>
public partial class SplitButtonNavItem : TreeViewItem
/// <summary>
/// Interaction logic for SplitButtonNavItem.xaml
/// </summary>
public partial class SplitButtonNavItem : TreeViewItem
{
public SplitButtonNavItem()
{
public SplitButtonNavItem()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

52
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.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Button")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Samples.Modules.Button")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTitle( "Samples.Modules.Button" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "Samples.Modules.Button" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: ComVisible( false )]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -33,11 +49,11 @@ using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

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

@ -1,49 +1,69 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="ButtonSpinner">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</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."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" >
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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."/>
<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."/>
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<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"
TextWrapping="Wrap"/>
<extToolkit:ButtonSpinner Margin="10" Width="150" HorizontalAlignment="Left"
AllowSpin="{Binding IsChecked, ElementName=_allowSpin}"
ShowButtonSpinner="{Binding IsChecked, ElementName=_showButtonSpinner}"
Spin="ButtonSpinner_Spin" >
<TextBox Text="0" BorderThickness="0" HorizontalContentAlignment="Right" />
</extToolkit:ButtonSpinner>
</StackPanel>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</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."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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." />
<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." />
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<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"
TextWrapping="Wrap" />
<extToolkit:ButtonSpinner Margin="10"
Width="150"
HorizontalAlignment="Left"
AllowSpin="{Binding IsChecked, ElementName=_allowSpin}"
ShowButtonSpinner="{Binding IsChecked, ElementName=_showButtonSpinner}"
Spin="ButtonSpinner_Spin">
<TextBox Text="0" BorderThickness="0" HorizontalContentAlignment="Right" />
</extToolkit:ButtonSpinner>
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,40 +1,58 @@
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.Windows.Controls;
using System.Windows.Controls;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Button.Views
{
/// <summary>
/// Interaction logic for ButtonSpinnerView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class ButtonSpinnerView : DemoView
/// <summary>
/// Interaction logic for ButtonSpinnerView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class ButtonSpinnerView : DemoView
{
public ButtonSpinnerView()
{
public ButtonSpinnerView()
{
InitializeComponent();
}
private void ButtonSpinner_Spin(object sender, Microsoft.Windows.Controls.SpinEventArgs e)
{
ButtonSpinner spinner = (ButtonSpinner)sender;
TextBox txtBox = (TextBox)spinner.Content;
try
{
int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text);
if (e.Direction == Microsoft.Windows.Controls.SpinDirection.Increase)
value++;
else
value--;
txtBox.Text = value.ToString();
}
catch
{
txtBox.Text = "0";
}
}
InitializeComponent();
}
private void ButtonSpinner_Spin( object sender, Microsoft.Windows.Controls.SpinEventArgs e )
{
ButtonSpinner spinner = ( ButtonSpinner )sender;
TextBox txtBox = ( TextBox )spinner.Content;
try
{
int value = String.IsNullOrEmpty( txtBox.Text ) ? 0 : Convert.ToInt32( txtBox.Text );
if( e.Direction == Microsoft.Windows.Controls.SpinDirection.Increase )
value++;
else
value--;
txtBox.Text = value.ToString();
}
catch
{
txtBox.Text = "0";
}
}
}
}

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

@ -1,46 +1,64 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="DropDownButton" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</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."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" >
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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." />
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Usage:" Style="{StaticResource Header}" />
<extToolkit:DropDownButton x:Name="_dropDownButton" Margin="10" Width="150" HorizontalAlignment="Left" Content="Click Me" IsOpen="{Binding IsChecked, ElementName=_isOpen, Mode=TwoWay}"
Click="DropDownButton_Click">
<extToolkit:DropDownButton.DropDownContent>
<StackPanel>
<extToolkit:ColorCanvas />
<Button Click="Button_Click" Margin="10">OK</Button>
</StackPanel>
</extToolkit:DropDownButton.DropDownContent>
</extToolkit:DropDownButton>
</StackPanel>
</Grid>
Title="DropDownButton">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</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."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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." />
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Usage:" Style="{StaticResource Header}" />
<extToolkit:DropDownButton x:Name="_dropDownButton" Margin="10" Width="150" HorizontalAlignment="Left" Content="Click Me" IsOpen="{Binding IsChecked, ElementName=_isOpen, Mode=TwoWay}"
Click="DropDownButton_Click">
<extToolkit:DropDownButton.DropDownContent>
<StackPanel>
<extToolkit:ColorCanvas />
<Button Click="Button_Click" Margin="10">OK</Button>
</StackPanel>
</extToolkit:DropDownButton.DropDownContent>
</extToolkit:DropDownButton>
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,28 +1,45 @@
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 Samples.Infrastructure.Controls;
namespace Samples.Modules.Button.Views
{
/// <summary>
/// Interaction logic for DropDownButtonView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class DropDownButtonView : DemoView
/// <summary>
/// Interaction logic for DropDownButtonView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class DropDownButtonView : DemoView
{
public DropDownButtonView()
{
InitializeComponent();
}
private void DropDownButton_Click( object sender, System.Windows.RoutedEventArgs e )
{
}
private void Button_Click( object sender, System.Windows.RoutedEventArgs e )
{
public DropDownButtonView()
{
InitializeComponent();
}
private void DropDownButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
}
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
_dropDownButton.IsOpen = false;
}
_dropDownButton.IsOpen = false;
}
}
}

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

@ -1,47 +1,64 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="SplitButton">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</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."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" >
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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."/>
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Usage:" Style="{StaticResource Header}" />
<extToolkit:SplitButton x:Name="_splitButton" Margin="10" Width="150" HorizontalAlignment="Left" Content="Click Me" IsOpen="{Binding IsChecked, ElementName=_isOpen, Mode=TwoWay}"
Click="SplitButton_Click">
<extToolkit:SplitButton.DropDownContent>
<StackPanel>
<extToolkit:ColorCanvas />
<Button Click="Button_Click" Margin="10">OK</Button>
</StackPanel>
</extToolkit:SplitButton.DropDownContent>
</extToolkit:SplitButton>
</StackPanel>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</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."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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." />
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Usage:" Style="{StaticResource Header}" />
<extToolkit:SplitButton x:Name="_splitButton" Margin="10" Width="150" HorizontalAlignment="Left" Content="Click Me" IsOpen="{Binding IsChecked, ElementName=_isOpen, Mode=TwoWay}"
Click="SplitButton_Click">
<extToolkit:SplitButton.DropDownContent>
<StackPanel>
<extToolkit:ColorCanvas />
<Button Click="Button_Click" Margin="10">OK</Button>
</StackPanel>
</extToolkit:SplitButton.DropDownContent>
</extToolkit:SplitButton>
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,28 +1,45 @@
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 Samples.Infrastructure.Controls;
namespace Samples.Modules.Button.Views
{
/// <summary>
/// Interaction logic for SplitButtonView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class SplitButtonView : DemoView
/// <summary>
/// Interaction logic for SplitButtonView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class SplitButtonView : DemoView
{
public SplitButtonView()
{
InitializeComponent();
}
private void SplitButton_Click( object sender, System.Windows.RoutedEventArgs e )
{
Microsoft.Windows.Controls.MessageBox.Show( "Thanks for clicking me!", "SplitButton Click" );
}
private void Button_Click( object sender, System.Windows.RoutedEventArgs e )
{
public SplitButtonView()
{
InitializeComponent();
}
private void SplitButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
Microsoft.Windows.Controls.MessageBox.Show("Thanks for clicking me!", "SplitButton Click");
}
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
_splitButton.IsOpen = false;
}
_splitButton.IsOpen = false;
}
}
}

55
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.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions;
using Samples.Modules.Calculator.Views;
using Samples.Modules.Calculator.NavigationItems;
using Samples.Modules.Calculator.Views;
namespace Samples.Modules.Calculator
{
public class CalculatorModule : ModuleBase
public class CalculatorModule : ModuleBase
{
public CalculatorModule( IUnityContainer container, IRegionManager regionManager )
: base( container, regionManager )
{
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( CalculatorNavItem ) );
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( CalculatorUpDownNavItem ) );
}
protected override void RegisterViewsAndTypes()
{
public CalculatorModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager) { }
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(CalculatorNavItem));
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(CalculatorUpDownNavItem));
}
protected override void RegisterViewsAndTypes()
{
Container.RegisterNavigationType(typeof(CalculatorView));
Container.RegisterNavigationType(typeof(CalculatorUpDownView));
}
Container.RegisterNavigationType( typeof( CalculatorView ) );
Container.RegisterNavigationType( typeof( CalculatorUpDownView ) );
}
}
}

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

@ -1,12 +1,30 @@
<TreeViewItem x:Class="Samples.Modules.Calculator.NavigationItems.CalculatorNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.Calculator.NavigationItems"
xmlns:views="clr-namespace:Samples.Modules.Calculator.Views"
Header="Calculator" Tag="{x:Type views:CalculatorView}" >
Header="Calculator" Tag="{x:Type views:CalculatorView}">
<TreeViewItem.Resources>
<Style TargetType="navItems:CalculatorNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem.Resources>
<Style TargetType="navItems:CalculatorNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
</TreeViewItem>

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

@ -1,16 +1,33 @@
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;
namespace Samples.Modules.Calculator.NavigationItems
{
/// <summary>
/// Interaction logic for CalculatorNavItem.xaml
/// </summary>
public partial class CalculatorNavItem : TreeViewItem
/// <summary>
/// Interaction logic for CalculatorNavItem.xaml
/// </summary>
public partial class CalculatorNavItem : TreeViewItem
{
public CalculatorNavItem()
{
public CalculatorNavItem()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,12 +1,30 @@
<TreeViewItem x:Class="Samples.Modules.Calculator.NavigationItems.CalculatorUpDownNavItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navItems="clr-namespace:Samples.Modules.Calculator.NavigationItems"
xmlns:views="clr-namespace:Samples.Modules.Calculator.Views"
Header="CalculatorUpDown" Tag="{x:Type views:CalculatorUpDownView}" >
Header="CalculatorUpDown" Tag="{x:Type views:CalculatorUpDownView}">
<TreeViewItem.Resources>
<Style TargetType="navItems:CalculatorUpDownNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem.Resources>
<Style TargetType="navItems:CalculatorUpDownNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
</TreeViewItem>

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

@ -1,16 +1,33 @@
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;
namespace Samples.Modules.Calculator.NavigationItems
{
/// <summary>
/// Interaction logic for CalculatorUpDownNavItem.xaml
/// </summary>
public partial class CalculatorUpDownNavItem : TreeViewItem
/// <summary>
/// Interaction logic for CalculatorUpDownNavItem.xaml
/// </summary>
public partial class CalculatorUpDownNavItem : TreeViewItem
{
public CalculatorUpDownNavItem()
{
public CalculatorUpDownNavItem()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

52
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.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Caclulator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Samples.Modules.Caclulator")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTitle( "Samples.Modules.Caclulator" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "Samples.Modules.Caclulator" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: ComVisible( false )]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -33,11 +49,11 @@ using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

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

@ -1,62 +1,80 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="CalculatorUpDown">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</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."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" >
<Grid Margin="5" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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." />
<TextBlock Text="FormatString:" Grid.Row="1" VerticalAlignment="Center"/>
<ComboBox x:Name="_formatString" SelectedIndex="0" Grid.Row="1" Grid.Column="1" Width="150" Margin="5">
<ComboBoxItem Tag="C2">Currency</ComboBoxItem>
<ComboBoxItem Tag="F2">Fixed Point</ComboBoxItem>
<ComboBoxItem Tag="G">General</ComboBoxItem>
<ComboBoxItem Tag="N">Number</ComboBoxItem>
<ComboBoxItem Tag="P2">Percent</ComboBoxItem>
</ComboBox>
<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"/>
<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="2" Text="Maximum" VerticalAlignment="Center" />
<extToolkit:IntegerUpDown Grid.Column="3" Name="_increment" Minimum="0" Value="1" VerticalAlignment="Center" Margin="5" Width="150" />
<extToolkit:IntegerUpDown Grid.Column="3" Grid.Row="1" Name="_minimum" Value="-100" VerticalAlignment="Center" Margin="5" Width="150" />
<extToolkit:IntegerUpDown Grid.Column="3" Grid.Row="2" Name="_maximum" Value="5000" VerticalAlignment="Center" Margin="5" Width="150" />
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10" HorizontalAlignment="Left">
<TextBlock Text="Usage:" Style="{StaticResource Header}" />
<extToolkit:CalculatorUpDown Margin="10" Width="250"
Increment="{Binding Value, ElementName=_increment}"
Maximum="{Binding Value, ElementName=_maximum}"
Minimum="{Binding Value, ElementName=_minimum}"
Precision="{Binding Value, ElementName=_precision}"
FormatString="{Binding SelectedItem.Tag, ElementName=_formatString}"
Watermark="{Binding Text, ElementName=_watermark}"/>
</StackPanel>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</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."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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." />
<TextBlock Text="FormatString:" Grid.Row="1" VerticalAlignment="Center" />
<ComboBox x:Name="_formatString" SelectedIndex="0" Grid.Row="1" Grid.Column="1" Width="150" Margin="5">
<ComboBoxItem Tag="C2">Currency</ComboBoxItem>
<ComboBoxItem Tag="F2">Fixed Point</ComboBoxItem>
<ComboBoxItem Tag="G">General</ComboBoxItem>
<ComboBoxItem Tag="N">Number</ComboBoxItem>
<ComboBoxItem Tag="P2">Percent</ComboBoxItem>
</ComboBox>
<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" />
<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="2" Text="Maximum" VerticalAlignment="Center" />
<extToolkit:IntegerUpDown Grid.Column="3" Name="_increment" Minimum="0" Value="1" VerticalAlignment="Center" Margin="5" Width="150" />
<extToolkit:IntegerUpDown Grid.Column="3" Grid.Row="1" Name="_minimum" Value="-100" VerticalAlignment="Center" Margin="5" Width="150" />
<extToolkit:IntegerUpDown Grid.Column="3" Grid.Row="2" Name="_maximum" Value="5000" VerticalAlignment="Center" Margin="5" Width="150" />
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10" HorizontalAlignment="Left">
<TextBlock Text="Usage:" Style="{StaticResource Header}" />
<extToolkit:CalculatorUpDown Margin="10" Width="250"
Increment="{Binding Value, ElementName=_increment}"
Maximum="{Binding Value, ElementName=_maximum}"
Minimum="{Binding Value, ElementName=_minimum}"
Precision="{Binding Value, ElementName=_precision}"
FormatString="{Binding SelectedItem.Tag, ElementName=_formatString}"
Watermark="{Binding Text, ElementName=_watermark}" />
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,18 +1,35 @@
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 Samples.Infrastructure.Controls;
namespace Samples.Modules.Calculator.Views
{
/// <summary>
/// Interaction logic for CalculatorUpDownView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class CalculatorUpDownView : DemoView
/// <summary>
/// Interaction logic for CalculatorUpDownView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class CalculatorUpDownView : DemoView
{
public CalculatorUpDownView()
{
public CalculatorUpDownView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,39 +1,57 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="Calculator">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="The Calculator is a control used for performing mathematical calculations."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" >
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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." />
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<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"/>
<extToolkit:Calculator Margin="10" Width="250" Precision="{Binding Value, ElementName=_precision}" />
</StackPanel>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="The Calculator is a control used for performing mathematical calculations."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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." />
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<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" />
<extToolkit:Calculator Margin="10" Width="250" Precision="{Binding Value, ElementName=_precision}" />
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,18 +1,35 @@
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 Samples.Infrastructure.Controls;
namespace Samples.Modules.Calculator.Views
{
/// <summary>
/// Interaction logic for CalculatorView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class CalculatorView : DemoView
/// <summary>
/// Interaction logic for CalculatorView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class CalculatorView : DemoView
{
public CalculatorView()
{
public CalculatorView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

49
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.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions;
using Samples.Modules.ChildWindow.Views;
namespace Samples.Modules.ChildWindow
{
public class ChildWindowModule: ModuleBase
public class ChildWindowModule : ModuleBase
{
public ChildWindowModule( IUnityContainer container, IRegionManager regionManager )
: base( container, regionManager )
{
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
}
protected override void RegisterViewsAndTypes()
{
public ChildWindowModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager) { }
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView));
}
protected override void RegisterViewsAndTypes()
{
Container.RegisterNavigationType(typeof(HomeView));
}
Container.RegisterNavigationType( typeof( HomeView ) );
}
}
}

52
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.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.ChildWindow")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Samples.Modules.ChildWindow")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTitle( "Samples.Modules.ChildWindow" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "Samples.Modules.ChildWindow" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: ComVisible( false )]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -33,11 +49,11 @@ using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

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

@ -1,115 +1,133 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="ChildWindow">
<infControls:DemoView.Resources>
<ObjectDataProvider x:Key="WindowStates" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}" >
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="extToolkit:WindowState"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="WindowStartupLocations" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}" >
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="extToolkit:WindowStartupLocation"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</infControls:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="ChildWindow description goes here."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5" >
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Caption:" Margin="2" VerticalAlignment="Center" />
<TextBox Name="_txtCaption" Grid.Column="1" Margin="5" Text="ChildWindow" VerticalAlignment="Center" />
<TextBlock Grid.Row="1" Name="textBlock2" Text="Left:" Margin="2" VerticalAlignment="Center" />
<extToolkit:DoubleUpDown x:Name="_txtLeft" Grid.Column="1" Grid.Row="1" Value="0" VerticalAlignment="Center" Margin="5" />
<TextBlock Grid.Row="2" Name="textBlock3" Text="Top:" Margin="2" VerticalAlignment="Center" />
<extToolkit:DoubleUpDown x:Name="_txtTop" Grid.Column="1" Grid.Row="2" Value="0" VerticalAlignment="Center" Margin="5" />
<TextBlock Text="IsModal:" VerticalAlignment="Center" Margin="2" Grid.Column="2" />
<CheckBox x:Name="_chkIsModal" Grid.Column="3" VerticalAlignment="Center" Margin="5" IsChecked="True" />
<TextBlock Grid.Row="1" Text="WindowState:" VerticalAlignment="Center" Margin="2" Grid.Column="2" />
<ComboBox Grid.Column="3" Grid.Row="1" Name="_cboWindowState" ItemsSource="{Binding Source={StaticResource WindowStates}}" SelectedIndex="1" VerticalAlignment="Center" Margin="5" />
<TextBlock Grid.Row="2" Text="WindowStartupLocation:" VerticalAlignment="Center" Margin="2" Grid.Column="2" />
<ComboBox Grid.Column="3" Grid.Row="2" Name="_cboWindowStartupLocations" ItemsSource="{Binding Source={StaticResource WindowStartupLocations}}" SelectedIndex="0" VerticalAlignment="Center" Margin="5" />
<infControls:DemoView.Resources>
<ObjectDataProvider x:Key="WindowStates" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="extToolkit:WindowState" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="WindowStartupLocations" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="extToolkit:WindowStartupLocation" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</infControls:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="ChildWindow description goes here."
TextWrapping="Wrap" />
<GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Caption:" Margin="2" VerticalAlignment="Center" />
<TextBox Name="_txtCaption" Grid.Column="1" Margin="5" Text="ChildWindow" VerticalAlignment="Center" />
<TextBlock Grid.Row="1" Name="textBlock2" Text="Left:" Margin="2" VerticalAlignment="Center" />
<extToolkit:DoubleUpDown x:Name="_txtLeft" Grid.Column="1" Grid.Row="1" Value="0" VerticalAlignment="Center" Margin="5" />
<TextBlock Grid.Row="2" Name="textBlock3" Text="Top:" Margin="2" VerticalAlignment="Center" />
<extToolkit:DoubleUpDown x:Name="_txtTop" Grid.Column="1" Grid.Row="2" Value="0" VerticalAlignment="Center" Margin="5" />
<TextBlock Text="IsModal:" VerticalAlignment="Center" Margin="2" Grid.Column="2" />
<CheckBox x:Name="_chkIsModal" Grid.Column="3" VerticalAlignment="Center" Margin="5" IsChecked="True" />
<TextBlock Grid.Row="1" Text="WindowState:" VerticalAlignment="Center" Margin="2" Grid.Column="2" />
<ComboBox Grid.Column="3" Grid.Row="1" Name="_cboWindowState" ItemsSource="{Binding Source={StaticResource WindowStates}}" SelectedIndex="1" VerticalAlignment="Center" Margin="5" />
<TextBlock Grid.Row="2" Text="WindowStartupLocation:" VerticalAlignment="Center" Margin="2" Grid.Column="2" />
<ComboBox Grid.Column="3" Grid.Row="2" Name="_cboWindowStartupLocations" ItemsSource="{Binding Source={StaticResource WindowStartupLocations}}" SelectedIndex="0" VerticalAlignment="Center" Margin="5" />
</Grid>
</GroupBox>
<Grid Grid.Row="2" Margin="10">
<extToolkit:ChildWindow Width="350"
Caption="{Binding Text, ElementName=_txtCaption}"
IsModal="{Binding IsChecked, ElementName=_chkIsModal}"
Left="{Binding Value, ElementName=_txtLeft, Mode=TwoWay}"
Top="{Binding Value, ElementName=_txtTop, Mode=TwoWay}"
WindowStartupLocation="{Binding SelectedItem, ElementName=_cboWindowStartupLocations}"
WindowState="{Binding SelectedItem, ElementName=_cboWindowState}">
<Grid Margin="10" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="First Name:" Margin="2" VerticalAlignment="Center" />
<extToolkit:WatermarkTextBox Grid.Row="0" Grid.Column="1" Margin="2" VerticalAlignment="Center" Watermark="Enter First Name" />
<TextBlock Grid.Row="1" Text="Last Name:" Margin="2" VerticalAlignment="Center" />
<extToolkit:WatermarkTextBox Grid.Row="1" Grid.Column="1" Margin="2" VerticalAlignment="Center" Watermark="Enter Last Name" />
<TextBlock Grid.Row="2" Text="Date of Birth:" Margin="2" VerticalAlignment="Center" />
<extToolkit:DateTimeUpDown Grid.Row="2" Grid.Column="1" Format="ShortDate" Margin="2" VerticalAlignment="Center" Watermark="Enter Date of Birth" />
<TextBlock Grid.Row="3" Text="Salary:" Margin="2" VerticalAlignment="Center" />
<extToolkit:IntegerUpDown Grid.Row="3" Grid.Column="1" FormatString="C2" Margin="2" VerticalAlignment="Center" Watermark="Enter Salary" />
<TextBlock Grid.Row="4" Text="Favorite Color:" Margin="2" VerticalAlignment="Center" />
<extToolkit:ColorPicker Grid.Row="4" Grid.Column="1" Margin="2" VerticalAlignment="Center" />
<StackPanel Grid.Row="5" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
<Button Width="65" Margin="2">OK</Button>
<Button Width="65" Margin="2">Cancel</Button>
</StackPanel>
</Grid>
</GroupBox>
<Grid Grid.Row="2" Margin="10">
<extToolkit:ChildWindow Width="350"
Caption="{Binding Text, ElementName=_txtCaption}"
IsModal="{Binding IsChecked, ElementName=_chkIsModal}"
Left="{Binding Value, ElementName=_txtLeft, Mode=TwoWay}"
Top="{Binding Value, ElementName=_txtTop, Mode=TwoWay}"
WindowStartupLocation="{Binding SelectedItem, ElementName=_cboWindowStartupLocations}"
WindowState="{Binding SelectedItem, ElementName=_cboWindowState}">
<Grid Margin="10" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="First Name:" Margin="2" VerticalAlignment="Center" />
<extToolkit:WatermarkTextBox Grid.Row="0" Grid.Column="1" Margin="2" VerticalAlignment="Center" Watermark="Enter First Name" />
<TextBlock Grid.Row="1" Text="Last Name:" Margin="2" VerticalAlignment="Center" />
<extToolkit:WatermarkTextBox Grid.Row="1" Grid.Column="1" Margin="2" VerticalAlignment="Center" Watermark="Enter Last Name" />
<TextBlock Grid.Row="2" Text="Date of Birth:" Margin="2" VerticalAlignment="Center" />
<extToolkit:DateTimeUpDown Grid.Row="2" Grid.Column="1" Format="ShortDate" Margin="2" VerticalAlignment="Center" Watermark="Enter Date of Birth" />
<TextBlock Grid.Row="3" Text="Salary:" Margin="2" VerticalAlignment="Center" />
<extToolkit:IntegerUpDown Grid.Row="3" Grid.Column="1" FormatString="C2" Margin="2" VerticalAlignment="Center" Watermark="Enter Salary" />
<TextBlock Grid.Row="4" Text="Favorite Color:" Margin="2" VerticalAlignment="Center" />
<extToolkit:ColorPicker Grid.Row="4" Grid.Column="1" Margin="2" VerticalAlignment="Center" />
<StackPanel Grid.Row="5" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
<Button Width="65" Margin="2">OK</Button>
<Button Width="65" Margin="2">Cancel</Button>
</StackPanel>
</Grid>
</extToolkit:ChildWindow>
</Grid>
</Grid>
</extToolkit:ChildWindow>
</Grid>
</Grid>
</infControls:DemoView>

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

@ -1,18 +1,35 @@
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 Samples.Infrastructure.Controls;
namespace Samples.Modules.ChildWindow.Views
{
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class HomeView : DemoView
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView
{
public HomeView()
{
public HomeView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,11 +1,29 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.ChildWindow.Views"
Header="ChildWindow" Tag="{x:Type views:HomeView}">
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
</TreeViewItem>

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

@ -1,27 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.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
{
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
{
public NavigationView()
{
public NavigationView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

49
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.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions;
using Samples.Modules.Color.Views;
@ -8,19 +25,21 @@ using Samples.Modules.Color.Views;
namespace Samples.Modules.Color
{
public class ColorModule: ModuleBase
public class ColorModule : ModuleBase
{
public ColorModule( IUnityContainer container, IRegionManager regionManager )
: base( container, regionManager )
{
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
}
protected override void RegisterViewsAndTypes()
{
public ColorModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager) { }
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView));
}
protected override void RegisterViewsAndTypes()
{
Container.RegisterNavigationType(typeof(HomeView));
}
Container.RegisterNavigationType( typeof( HomeView ) );
}
}
}

52
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.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Color")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Samples.Modules.Color")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTitle( "Samples.Modules.Color" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "Samples.Modules.Color" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: ComVisible( false )]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -33,11 +49,11 @@ using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

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

@ -1,12 +1,30 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
xmlns:System="clr-namespace:System;assembly=mscorlib"
Title="Color Controls">
<Grid Margin="25">
<!--<DataGrid x:Name="_dataGrid"
<Grid Margin="25">
<!--<DataGrid x:Name="_dataGrid"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
@ -23,37 +41,40 @@
</DataGrid.Columns>
</DataGrid>-->
<StackPanel>
<extToolkit:CheckComboBox x:Name="_combo" HorizontalAlignment="Center" VerticalAlignment="Center"
DisplayMemberPath="Color"
ValueMemberPath="Level"
SelectedValue="{Binding SelectedValue}"
SelectedItems="{Binding SelectedItems}"/>
<StackPanel>
<extToolkit:CheckComboBox x:Name="_combo"
HorizontalAlignment="Center"
VerticalAlignment="Center"
DisplayMemberPath="Color"
ValueMemberPath="Level"
SelectedValue="{Binding SelectedValue}"
SelectedItems="{Binding SelectedItems}" />
<!--<extToolkit:CheckComboBox x:Name="_combo" HorizontalAlignment="Center" VerticalAlignment="Center"
<!--<extToolkit:CheckComboBox x:Name="_combo" HorizontalAlignment="Center" VerticalAlignment="Center"
SelectedValue="{Binding SelectedValues}" />-->
<!--<ComboBox x:Name="_combo2" HorizontalAlignment="Center" VerticalAlignment="Center"
<!--<ComboBox x:Name="_combo2" HorizontalAlignment="Center" VerticalAlignment="Center"
IsEditable="True"
DisplayMemberPath="Color"
/>-->
<extToolkit:CheckListBox x:Name="_listBox" Height="250"
DisplayMemberPath="Color"
ValueMemberPath="Level"
SelectedMemberPath="IsSelected"
SelectedValue="{Binding SelectedValue}"
SelectedItems="{Binding SelectedItems}"/>
<extToolkit:CheckListBox x:Name="_listBox"
Height="250"
DisplayMemberPath="Color"
ValueMemberPath="Level"
SelectedMemberPath="IsSelected"
SelectedValue="{Binding SelectedValue}"
SelectedItems="{Binding SelectedItems}" />
<!--<extToolkit:CheckListBox x:Name="_listBox" Height="250"
<!--<extToolkit:CheckListBox x:Name="_listBox" Height="250"
SelectedValue="{Binding SelectedValues}"
/>-->
<TextBlock Text="{Binding SelectedValue}" />
<ListBox ItemsSource="{Binding SelectedItems}" Height="50" />
<Button Click="Button_Click">Set</Button>
</StackPanel>
</Grid>
<TextBlock Text="{Binding SelectedValue}" />
<ListBox ItemsSource="{Binding SelectedItems}" Height="50" />
<Button Click="Button_Click">Set</Button>
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,160 +1,198 @@
using System;
using Samples.Infrastructure.Controls;
using Microsoft.Practices.Prism.Regions;
using System.ComponentModel;
/************************************************************************
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.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Color.Views
{
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class HomeView : DemoView
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView
{
public HomeView()
{
InitializeComponent();
DataContext = new Data();
//List<string> colors = new List<string>();
//colors.Add("1");
//colors.Add("2");
//colors.Add("3");
//colors.Add("4");
//colors.Add("5");
//colors.Add("6");
//colors.Add("7");
//colors.Add("8");
//colors.Add("9");
//colors.Add("10");
List<Person> colors = new List<Person>();
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.Coral, 2 ) );
colors.Add( new Person( System.Windows.Media.Colors.MidnightBlue, 3 )
{
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.Purple, 6 ) );
colors.Add( new Person( System.Windows.Media.Colors.SaddleBrown, 7 ) );
colors.Add( new Person( System.Windows.Media.Colors.MidnightBlue, 8 ) );
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.Purple, 11 ) );
colors.Add( new Person( System.Windows.Media.Colors.SaddleBrown, 12 ) );
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;
//_chk.ItemsSource = colors;
_combo.ItemsSource = colors;
//_combo.SelectedValue = "1,3,5,7,9,";
_listBox.ItemsSource = colors;
//_listBox.SelectedValue = "1,3,5,7,9,";
}
private void Button_Click( object sender, System.Windows.RoutedEventArgs e )
{
( DataContext as Data ).SelectedValue = "1,3,5,7,9,";
}
}
public class Data : INotifyPropertyChanged
{
private string _selectedValues;// = "1,3,5,7,9,";
public string SelectedValue
{
get
{
return _selectedValues;
}
set
{
_selectedValues = value;
OnPropertyChanged( "SelectedValue" );
}
}
private ObservableCollection<Person> _selectedItems = new ObservableCollection<Person>();
public ObservableCollection<Person> SelectedItems
{
get
{
return _selectedItems;
}
set
{
_selectedItems = value;
OnPropertyChanged( "SelectedItems" );
}
}
public Data()
{
public HomeView()
{
InitializeComponent();
DataContext = new Data();
//List<string> colors = new List<string>();
//colors.Add("1");
//colors.Add("2");
//colors.Add("3");
//colors.Add("4");
//colors.Add("5");
//colors.Add("6");
//colors.Add("7");
//colors.Add("8");
//colors.Add("9");
//colors.Add("10");
List<Person> colors = new List<Person>();
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.Coral, 2));
colors.Add(new Person(System.Windows.Media.Colors.MidnightBlue, 3) { 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.Purple, 6));
colors.Add(new Person(System.Windows.Media.Colors.SaddleBrown, 7));
colors.Add(new Person(System.Windows.Media.Colors.MidnightBlue, 8));
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.Purple, 11));
colors.Add(new Person(System.Windows.Media.Colors.SaddleBrown, 12));
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;
//_chk.ItemsSource = colors;
_combo.ItemsSource = colors;
//_combo.SelectedValue = "1,3,5,7,9,";
_listBox.ItemsSource = colors;
//_listBox.SelectedValue = "1,3,5,7,9,";
}
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
(DataContext as Data).SelectedValue = "1,3,5,7,9,";
}
}
public class Data: INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged( string propertyName )
{
private string _selectedValues;// = "1,3,5,7,9,";
public string SelectedValue
{
get
{
return _selectedValues;
}
set
{
_selectedValues = value;
OnPropertyChanged("SelectedValue");
}
}
private ObservableCollection<Person> _selectedItems = new ObservableCollection<Person>();
public ObservableCollection<Person> SelectedItems
{
get { return _selectedItems; }
set
{
_selectedItems = value;
OnPropertyChanged("SelectedItems");
}
}
public Data()
{
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
if( PropertyChanged != null )
PropertyChanged( this, new PropertyChangedEventArgs( propertyName ) );
}
}
public class Person : INotifyPropertyChanged
public class Person : INotifyPropertyChanged
{
private bool _isSelected;
public bool IsSelected
{
private bool _isSelected;
public bool IsSelected
{
get { return _isSelected; }
set
{
_isSelected = value;
OnPropertyChanged("IsSelected");
}
}
System.Windows.Media.Color _color;
public System.Windows.Media.Color Color
{
get { return _color; }
set
{
_color = value;
OnPropertyChanged("Color");
}
}
int _level;
public int Level
{
get { return _level; }
set { _level = value; OnPropertyChanged("Level"); }
}
public Person()
{
}
public Person(System.Windows.Media.Color color, int level)
{
this._color = color;
this._level = level;
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
get
{
return _isSelected;
}
set
{
_isSelected = value;
OnPropertyChanged( "IsSelected" );
}
}
System.Windows.Media.Color _color;
public System.Windows.Media.Color Color
{
get
{
return _color;
}
set
{
_color = value;
OnPropertyChanged( "Color" );
}
}
int _level;
public int Level
{
get
{
return _level;
}
set
{
_level = value;
OnPropertyChanged( "Level" );
}
}
public Person()
{
}
public Person( System.Windows.Media.Color color, int level )
{
this._color = color;
this._level = level;
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged( string propertyName )
{
if( PropertyChanged != null )
PropertyChanged( this, new PropertyChangedEventArgs( propertyName ) );
}
}
}

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

@ -1,11 +1,29 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.Color.Views"
Header="Color" Tag="{x:Type views:HomeView}">
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
</TreeViewItem>

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

@ -1,27 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.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
{
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
{
public NavigationView()
{
public NavigationView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

49
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.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions;
using Samples.Modules.DateTime.Views;
namespace Samples.Modules.DateTime
{
public class DateTimeModule: ModuleBase
public class DateTimeModule : ModuleBase
{
public DateTimeModule( IUnityContainer container, IRegionManager regionManager )
: base( container, regionManager )
{
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
}
protected override void RegisterViewsAndTypes()
{
public DateTimeModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager) { }
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView));
}
protected override void RegisterViewsAndTypes()
{
Container.RegisterNavigationType(typeof(HomeView));
}
Container.RegisterNavigationType( typeof( HomeView ) );
}
}
}

52
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.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.DateTime")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Samples.Modules.DateTime")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTitle( "Samples.Modules.DateTime" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "Samples.Modules.DateTime" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: ComVisible( false )]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -33,11 +49,11 @@ using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

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

@ -1,10 +1,28 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
Title="DateTime Controls">
<Grid>
<extToolkit:DateTimePicker IsReadOnly="False" />
</Grid>
<Grid>
<extToolkit:DateTimePicker IsReadOnly="False" />
</Grid>
</infControls:DemoView>

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

@ -1,18 +1,35 @@
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 Samples.Infrastructure.Controls;
namespace Samples.Modules.DateTime.Views
{
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class HomeView : DemoView
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView
{
public HomeView()
{
public HomeView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,11 +1,29 @@
<TreeViewItem x:Class="Samples.Modules.DateTime.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.DateTime.Views"
Header="DateTime" Tag="{x:Type views:HomeView}">
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
</TreeViewItem>

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

@ -1,27 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.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
{
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
{
public NavigationView()
{
public NavigationView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

49
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.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions;
using Samples.Modules.Numeric.Views;
namespace Samples.Modules.Numeric
{
public class NumericModule: ModuleBase
public class NumericModule : ModuleBase
{
public NumericModule( IUnityContainer container, IRegionManager regionManager )
: base( container, regionManager )
{
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
}
protected override void RegisterViewsAndTypes()
{
public NumericModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager) { }
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView));
}
protected override void RegisterViewsAndTypes()
{
Container.RegisterNavigationType(typeof(HomeView));
}
Container.RegisterNavigationType( typeof( HomeView ) );
}
}
}

52
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.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Numeric")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Samples.Modules.Numeric")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTitle( "Samples.Modules.Numeric" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "Samples.Modules.Numeric" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: ComVisible( false )]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -33,11 +49,11 @@ using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

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

@ -1,9 +1,27 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
Title="Numeric Controls">
<Grid>
<TextBlock Text="Numeric View" />
</Grid>
<Grid>
<TextBlock Text="Numeric View" />
</Grid>
</infControls:DemoView>

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

@ -1,18 +1,35 @@
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 Samples.Infrastructure.Controls;
namespace Samples.Modules.Numeric.Views
{
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class HomeView : DemoView
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView
{
public HomeView()
{
public HomeView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,11 +1,29 @@
<TreeViewItem x:Class="Samples.Modules.Numeric.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.Numeric.Views"
Header="Numeric" Tag="{x:Type views:HomeView}">
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
</TreeViewItem>

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

@ -1,27 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.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
{
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
{
public NavigationView()
{
public NavigationView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

52
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.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.PropertyGrid")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Samples.Modules.PropertyGrid")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTitle( "Samples.Modules.PropertyGrid" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "Samples.Modules.PropertyGrid" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: ComVisible( false )]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -33,11 +49,11 @@ using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

61
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.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions;
using Samples.Modules.PropertyGrid.Views;
namespace Samples.Modules.PropertyGrid
{
public class PropertyGridModule: ModuleBase
public class PropertyGridModule : ModuleBase
{
public PropertyGridModule( IUnityContainer container, IRegionManager regionManager )
: base( container, regionManager )
{
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
}
protected override void RegisterViewsAndTypes()
{
public PropertyGridModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager) { }
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView));
}
protected override void RegisterViewsAndTypes()
{
Container.RegisterNavigationType(typeof(HomeView));
Container.RegisterNavigationType(typeof(CustomEditors));
Container.RegisterNavigationType(typeof(CustomItemsSource));
Container.RegisterNavigationType(typeof(DefaultEditors));
Container.RegisterNavigationType(typeof(ExpandableProperties));
Container.RegisterNavigationType(typeof(SpecifyingProperties));
Container.RegisterNavigationType(typeof(BindingToStructs));
}
Container.RegisterNavigationType( typeof( HomeView ) );
Container.RegisterNavigationType( typeof( CustomEditors ) );
Container.RegisterNavigationType( typeof( CustomItemsSource ) );
Container.RegisterNavigationType( typeof( DefaultEditors ) );
Container.RegisterNavigationType( typeof( ExpandableProperties ) );
Container.RegisterNavigationType( typeof( SpecifyingProperties ) );
Container.RegisterNavigationType( typeof( BindingToStructs ) );
}
}
}

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

@ -1,9 +1,27 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="_uc">
<StackPanel>
<TextBox Text="{Binding Value, ElementName=_uc}" Background="YellowGreen" />
<Button Click="Button_Click">Clear</Button>
</StackPanel>
<StackPanel>
<TextBox Text="{Binding Value, ElementName=_uc}" Background="YellowGreen" />
<Button Click="Button_Click">Clear</Button>
</StackPanel>
</UserControl>

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

@ -1,39 +1,63 @@
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 Microsoft.Windows.Controls.PropertyGrid.Editors;
using System.Windows.Data;
using Microsoft.Windows.Controls.PropertyGrid.Editors;
namespace Samples.Modules.PropertyGrid
{
/// <summary>
/// Interaction logic for LastNameUserControlEditor.xaml
/// </summary>
public partial class LastNameUserControlEditor : UserControl, ITypeEditor
/// <summary>
/// Interaction logic for LastNameUserControlEditor.xaml
/// </summary>
public partial class LastNameUserControlEditor : UserControl, ITypeEditor
{
public LastNameUserControlEditor()
{
InitializeComponent();
}
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register( "Value", typeof( string ), typeof( LastNameUserControlEditor ), new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault ) );
public string Value
{
get
{
return ( string )GetValue( ValueProperty );
}
set
{
SetValue( ValueProperty, value );
}
}
private void Button_Click( object sender, RoutedEventArgs e )
{
Value = string.Empty;
}
public FrameworkElement ResolveEditor( Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem )
{
public LastNameUserControlEditor()
{
InitializeComponent();
}
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(string), typeof(LastNameUserControlEditor), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public string Value
{
get { return (string)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Value = string.Empty;
}
public FrameworkElement ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem)
{
Binding binding = new Binding("Value");
binding.Source = propertyItem;
binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
BindingOperations.SetBinding(this, LastNameUserControlEditor.ValueProperty, binding);
return this;
}
Binding binding = new Binding( "Value" );
binding.Source = propertyItem;
binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
BindingOperations.SetBinding( this, LastNameUserControlEditor.ValueProperty, binding );
return this;
}
}
}

104
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
@ -6,46 +24,46 @@
xmlns:local="clr-namespace:Samples.Modules.PropertyGrid.Views"
Title="Binding to Structs">
<infControls:DemoView.Resources>
<local:DimensionsConverter x:Key="DimensionsConverter" />
</infControls:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</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."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<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" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" >
<extToolkit:PropertyGrid.EditorDefinitions>
<extToolkit:EditorDefinition TargetType="{x:Type local:Dimension}">
<extToolkit:EditorDefinition.EditorTemplate>
<DataTemplate>
<Grid Margin="5" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Height: " />
<TextBox Grid.Column="1" Text="{Binding Path=Value, Converter={StaticResource DimensionsConverter},ConverterParameter=Height}" />
<TextBlock Grid.Row="1" Text="Weight: " />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=Value, Converter={StaticResource DimensionsConverter},ConverterParameter=Weight}" />
</Grid>
</DataTemplate>
</extToolkit:EditorDefinition.EditorTemplate>
</extToolkit:EditorDefinition>
</extToolkit:PropertyGrid.EditorDefinitions>
</extToolkit:PropertyGrid>
</StackPanel>
</Grid>
<infControls:DemoView.Resources>
<local:DimensionsConverter x:Key="DimensionsConverter" />
</infControls:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</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."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<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" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10">
<extToolkit:PropertyGrid.EditorDefinitions>
<extToolkit:EditorDefinition TargetType="{x:Type local:Dimension}">
<extToolkit:EditorDefinition.EditorTemplate>
<DataTemplate>
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Height: " />
<TextBox Grid.Column="1" Text="{Binding Path=Value, Converter={StaticResource DimensionsConverter},ConverterParameter=Height}" />
<TextBlock Grid.Row="1" Text="Weight: " />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=Value, Converter={StaticResource DimensionsConverter},ConverterParameter=Weight}" />
</Grid>
</DataTemplate>
</extToolkit:EditorDefinition.EditorTemplate>
</extToolkit:EditorDefinition>
</extToolkit:PropertyGrid.EditorDefinitions>
</extToolkit:PropertyGrid>
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,96 +1,118 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
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.ComponentModel;
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 System.ComponentModel;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views
{
/// <summary>
/// Interaction logic for BindingToStructs.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class BindingToStructs : DemoView
/// <summary>
/// Interaction logic for BindingToStructs.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class BindingToStructs : DemoView
{
public BindingToStructs()
{
public BindingToStructs()
{
InitializeComponent();
_propertyGrid.SelectedObject = Person.CreatePerson();
}
public class Person
{
[Category("Information")]
[DisplayName("First Name")]
[Description("This property uses a TextBox as the default editor.")]
public string FirstName { get; set; }
[Category("Information")]
[DisplayName("Last Name")]
[Description("This property uses a TextBox as the default editor.")]
public string LastName { get; set; }
public Dimension Dimensions { get; set; }
public static Person CreatePerson()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.Dimensions = new Dimension() { Height = 75.0, Weight = 185.76 };
return person;
}
}
InitializeComponent();
_propertyGrid.SelectedObject = Person.CreatePerson();
}
public struct Dimension
public class Person
{
public double Height;
public double Weight;
[Category( "Information" )]
[DisplayName( "First Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string FirstName
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Last Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string LastName
{
get;
set;
}
public Dimension(double height, double weight)
public Dimension Dimensions
{
get;
set;
}
public static Person CreatePerson()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.Dimensions = new Dimension()
{
this.Height = height;
this.Weight = weight;
}
Height = 75.0,
Weight = 185.76
};
return person;
}
}
}
public struct Dimension
{
public double Height;
public double Weight;
public class DimensionsConverter : IValueConverter
public Dimension( double height, double weight )
{
static Dimension _originalValue; // the static struct that stores original value at the start of editing
this.Height = height;
this.Weight = weight;
}
}
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
_originalValue = ((Dimension)value);
public class DimensionsConverter : IValueConverter
{
static Dimension _originalValue; // the static struct that stores original value at the start of editing
if (parameter.ToString() == "Height")
return ((Dimension)value).Height;
if (parameter.ToString() == "Weight")
return ((Dimension)value).Weight;
public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{
_originalValue = ( ( Dimension )value );
return _originalValue;
}
if( parameter.ToString() == "Height" )
return ( ( Dimension )value ).Height;
if( parameter.ToString() == "Weight" )
return ( ( Dimension )value ).Weight;
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (parameter.ToString() == "Height")
_originalValue = new Dimension(double.Parse(value.ToString()), _originalValue.Weight);
if (parameter.ToString() == "Weight")
_originalValue = new Dimension(_originalValue.Height, double.Parse(value.ToString()));
return _originalValue;
}
return _originalValue;
public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{
if( parameter.ToString() == "Height" )
_originalValue = new Dimension( double.Parse( value.ToString() ), _originalValue.Weight );
if( parameter.ToString() == "Weight" )
_originalValue = new Dimension( _originalValue.Height, double.Parse( value.ToString() ) );
}
return _originalValue;
}
}
}

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

@ -1,70 +1,89 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.CustomEditors"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=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.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.CustomEditors"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="Custom Editors">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</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."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<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" />
<extToolkit:PropertyGrid x:Name="_propertyGrid1" Width="450" Margin="10">
<extToolkit:PropertyGrid.EditorDefinitions>
<!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor. -->
<extToolkit:EditorDefinition TargetType="{x:Type HorizontalAlignment}">
<extToolkit:EditorDefinition.EditorTemplate>
<DataTemplate>
<TextBox Background="Green" Text="{Binding Value}" />
<!-- Always bind your editor's value to the bound property's Value -->
</DataTemplate>
</extToolkit:EditorDefinition.EditorTemplate>
</extToolkit:EditorDefinition>
<!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor. -->
<extToolkit:EditorDefinition>
<extToolkit:EditorDefinition.PropertiesDefinitions>
<extToolkit:PropertyDefinition Name="Age" />
<extToolkit:PropertyDefinition Name="WritingFont" />
<extToolkit:PropertyDefinition Name="Spouse" />
</extToolkit:EditorDefinition.PropertiesDefinitions>
<extToolkit:EditorDefinition.EditorTemplate>
<DataTemplate>
<TextBlock Background="Yellow" Text="{Binding Value}" />
</DataTemplate>
</extToolkit:EditorDefinition.EditorTemplate>
</extToolkit:EditorDefinition>
<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."
TextWrapping="Wrap" />
<!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor. -->
<extToolkit:EditorDefinition TargetType="{x:Type sys:Boolean}">
<extToolkit:EditorDefinition.PropertiesDefinitions>
<extToolkit:PropertyDefinition Name="DateOfBirth" />
<extToolkit:PropertyDefinition Name="LastName" />
</extToolkit:EditorDefinition.PropertiesDefinitions>
<extToolkit:EditorDefinition.EditorTemplate>
<DataTemplate>
<TextBox Background="Red" Text="{Binding Value}" />
</DataTemplate>
</extToolkit:EditorDefinition.EditorTemplate>
</extToolkit:EditorDefinition>
<StackPanel Grid.Row="1" Margin="10">
<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"/>
<extToolkit:PropertyGrid x:Name="_propertyGrid1" Width="450" Margin="10">
<extToolkit:PropertyGrid.EditorDefinitions>
<!-- This EditorDefinition will provide a TextBox to any property that is of type HorizontalAlignment, replacing the default ComboBox editor. -->
<extToolkit:EditorDefinition TargetType="{x:Type HorizontalAlignment}">
<extToolkit:EditorDefinition.EditorTemplate>
<DataTemplate>
<TextBox Background="Green" Text="{Binding Value}" /> <!-- Always bind your editor's value to the bound property's Value -->
</DataTemplate>
</extToolkit:EditorDefinition.EditorTemplate>
</extToolkit:EditorDefinition>
<!-- This EditorDefinition will provide a TextBlock to any property that has any of the defined property names, replacing the default editor. -->
<extToolkit:EditorDefinition>
<extToolkit:EditorDefinition.PropertiesDefinitions>
<extToolkit:PropertyDefinition Name="Age" />
<extToolkit:PropertyDefinition Name="WritingFont" />
<extToolkit:PropertyDefinition Name="Spouse" />
</extToolkit:EditorDefinition.PropertiesDefinitions>
<extToolkit:EditorDefinition.EditorTemplate>
<DataTemplate>
<TextBlock Background="Yellow" Text="{Binding Value}" />
</DataTemplate>
</extToolkit:EditorDefinition.EditorTemplate>
</extToolkit:EditorDefinition>
<!-- This EditorDefinition will provide a TextBox to any property that is of type Boolean and that has any of the defined property names, replacing the default editor. -->
<extToolkit:EditorDefinition TargetType="{x:Type sys:Boolean}">
<extToolkit:EditorDefinition.PropertiesDefinitions>
<extToolkit:PropertyDefinition Name="DateOfBirth" />
<extToolkit:PropertyDefinition Name="LastName" />
</extToolkit:EditorDefinition.PropertiesDefinitions>
<extToolkit:EditorDefinition.EditorTemplate>
<DataTemplate>
<TextBox Background="Red" Text="{Binding Value}" />
</DataTemplate>
</extToolkit:EditorDefinition.EditorTemplate>
</extToolkit:EditorDefinition>
</extToolkit:PropertyGrid.EditorDefinitions>
</extToolkit:PropertyGrid>
</StackPanel>
</extToolkit:PropertyGrid.EditorDefinitions>
</extToolkit:PropertyGrid>
</StackPanel>
<StackPanel Grid.Row="2" Margin="10">
<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" />
<extToolkit:PropertyGrid x:Name="_propertyGrid2" Width="450" Margin="10"/>
</StackPanel>
</Grid>
<StackPanel Grid.Row="2" Margin="10">
<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" />
<extToolkit:PropertyGrid x:Name="_propertyGrid2" Width="450" Margin="10" />
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,159 +1,245 @@
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.Collections.Generic;
using System.ComponentModel;
using System.Windows;
using System.Windows.Media;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views
{
/// <summary>
/// Interaction logic for CustomEditors.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class CustomEditors : DemoView
/// <summary>
/// Interaction logic for CustomEditors.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class CustomEditors : DemoView
{
public CustomEditors()
{
public CustomEditors()
{
InitializeComponent();
_propertyGrid1.SelectedObject = Person.CreatePerson();
_propertyGrid2.SelectedObject = CustomAttributEditorPerson.CreateCustomAttributEditorPerson();
}
InitializeComponent();
_propertyGrid1.SelectedObject = Person.CreatePerson();
_propertyGrid2.SelectedObject = CustomAttributEditorPerson.CreateCustomAttributEditorPerson();
}
public class Person
{
[Category("Information")]
[DisplayName("First Name")]
[Description("This property uses a TextBox as the default editor.")]
public string FirstName { get; set; }
[Category("Information")]
[DisplayName("Last Name")]
[Description("This property uses a TextBox as the default editor.")]
public string LastName { get; set; }
[Category("Information")]
[DisplayName("Date of Birth")]
[Description("This property uses the DateTimeUpDown as the default editor.")]
public DateTime DateOfBirth { get; set; }
[DisplayName("Grade Point Average")]
[Description("This property uses the DoubleUpDown as the default editor.")]
public double GradePointAvg { get; set; }
[Category("Information")]
[Description("This property uses the IntegerUpDown as the default editor.")]
public int Age { get; set; }
[Category("Information")]
[DisplayName("Is Male")]
[Description("This property uses a CheckBox as the default editor.")]
public bool IsMale { get; set; }
[Category("Information")]
[DisplayName("Favorite Color")]
[Description("This property uses the ColorPicker as the default editor.")]
public Color FavoriteColor { 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()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.DateOfBirth = new DateTime(1975, 1, 23);
person.Age = DateTime.Today.Year - person.DateOfBirth.Year;
person.GradePointAvg = 3.98;
person.IsMale = true;
person.FavoriteColor = Colors.Blue;
person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily("Arial");
person.WritingFontSize = 12.5;
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.Spouse = new Person() { FirstName = "Jane", LastName = "Doe" };
return person;
}
}
public class CustomAttributEditorPerson
public class Person
{
[Category( "Information" )]
[DisplayName( "First Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string FirstName
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Last Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string LastName
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Date of Birth" )]
[Description( "This property uses the DateTimeUpDown as the default editor." )]
public DateTime DateOfBirth
{
get;
set;
}
[DisplayName( "Grade Point Average" )]
[Description( "This property uses the DoubleUpDown as the default editor." )]
public double GradePointAvg
{
get;
set;
}
[Category( "Information" )]
[Description( "This property uses the IntegerUpDown as the default editor." )]
public int Age
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Is Male" )]
[Description( "This property uses a CheckBox as the default editor." )]
public bool IsMale
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Favorite Color" )]
[Description( "This property uses the ColorPicker as the default editor." )]
public Color FavoriteColor
{
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()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.DateOfBirth = new DateTime( 1975, 1, 23 );
person.Age = DateTime.Today.Year - person.DateOfBirth.Year;
person.GradePointAvg = 3.98;
person.IsMale = true;
person.FavoriteColor = Colors.Blue;
person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily( "Arial" );
person.WritingFontSize = 12.5;
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.Spouse = new Person()
{
[Category("Information")]
[DisplayName("First Name")]
[Description("This property uses a TextBox as the default editor.")]
//This custom editor is a Class that implements the ITypeEditor interface
[Editor(typeof(FirstNameEditor), typeof(FirstNameEditor))]
public string FirstName { get; set; }
[Category("Information")]
[DisplayName("Last Name")]
[Description("This property uses a TextBox as the default editor.")]
//This custom editor is a UserControl that implements the ITypeEditor interface
[Editor(typeof(LastNameUserControlEditor), typeof(LastNameUserControlEditor))]
public string LastName { get; set; }
[Category("Information")]
[DisplayName("Date of Birth")]
[Description("This property uses the DateTimeUpDown as the default editor.")]
public DateTime DateOfBirth { get; set; }
public static CustomAttributEditorPerson CreateCustomAttributEditorPerson()
{
var person = new CustomAttributEditorPerson();
person.FirstName = "John";
person.LastName = "Doe";
person.DateOfBirth = new DateTime(1975, 1, 23);
return person;
}
}
FirstName = "Jane",
LastName = "Doe"
};
return person;
}
}
//Custom editors that are used as attributes MUST implement the ITypeEditor interface.
public class FirstNameEditor : Microsoft.Windows.Controls.PropertyGrid.Editors.ITypeEditor
public class CustomAttributEditorPerson
{
public FrameworkElement ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem)
{
TextBox textBox = new TextBox();
textBox.Background = new SolidColorBrush(Colors.Red);
//create the binding from the bound property item to the editor
var _binding = new Binding("Value"); //bind to the Value property of the PropertyItem
_binding.Source = propertyItem;
_binding.ValidatesOnExceptions = true;
_binding.ValidatesOnDataErrors = true;
_binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
BindingOperations.SetBinding(textBox, TextBox.TextProperty, _binding);
return textBox;
}
[Category( "Information" )]
[DisplayName( "First Name" )]
[Description( "This property uses a TextBox as the default editor." )]
//This custom editor is a Class that implements the ITypeEditor interface
[Editor( typeof( FirstNameEditor ), typeof( FirstNameEditor ) )]
public string FirstName
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Last Name" )]
[Description( "This property uses a TextBox as the default editor." )]
//This custom editor is a UserControl that implements the ITypeEditor interface
[Editor( typeof( LastNameUserControlEditor ), typeof( LastNameUserControlEditor ) )]
public string LastName
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Date of Birth" )]
[Description( "This property uses the DateTimeUpDown as the default editor." )]
public DateTime DateOfBirth
{
get;
set;
}
public static CustomAttributEditorPerson CreateCustomAttributEditorPerson()
{
var person = new CustomAttributEditorPerson();
person.FirstName = "John";
person.LastName = "Doe";
person.DateOfBirth = new DateTime( 1975, 1, 23 );
return person;
}
}
}
//Custom editors that are used as attributes MUST implement the ITypeEditor interface.
public class FirstNameEditor : Microsoft.Windows.Controls.PropertyGrid.Editors.ITypeEditor
{
public FrameworkElement ResolveEditor( Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem )
{
TextBox textBox = new TextBox();
textBox.Background = new SolidColorBrush( Colors.Red );
//create the binding from the bound property item to the editor
var _binding = new Binding( "Value" ); //bind to the Value property of the PropertyItem
_binding.Source = propertyItem;
_binding.ValidatesOnExceptions = true;
_binding.ValidatesOnDataErrors = true;
_binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
BindingOperations.SetBinding( textBox, TextBox.TextProperty, _binding );
return textBox;
}
}
}

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

@ -1,23 +1,41 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.CustomItemsSource"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=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.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.CustomItemsSource"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="Custom ItemsSource">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</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."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<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"/>
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10"/>
</StackPanel>
</Grid>
</infControls:DemoView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</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."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<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" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" />
</StackPanel>
</Grid>
</infControls:DemoView>

186
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.Windows;
using System.Windows.Media;
@ -8,87 +26,111 @@ using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views
{
/// <summary>
/// Interaction logic for CustomItemsSource.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class CustomItemsSource : DemoView
/// <summary>
/// Interaction logic for CustomItemsSource.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class CustomItemsSource : DemoView
{
public CustomItemsSource()
{
public CustomItemsSource()
{
InitializeComponent();
_propertyGrid.SelectedObject = Person.CreatePerson();
}
InitializeComponent();
_propertyGrid.SelectedObject = Person.CreatePerson();
}
public class Person
{
[Category("Information")]
[DisplayName("First Name")]
[Description("This property uses a TextBox as the default editor.")]
public string FirstName { get; set; }
public class Person
{
[Category( "Information" )]
[DisplayName( "First Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string FirstName
{
get;
set;
}
[Category("Information")]
[DisplayName("Last Name")]
[Description("This property uses a TextBox as the default editor.")]
public string LastName { get; set; }
[Category( "Information" )]
[DisplayName( "Last Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string LastName
{
get;
set;
}
[Category("Information")]
[DisplayName("Date of Birth")]
[Description("This property uses the DateTimeUpDown as the default editor.")]
public DateTime DateOfBirth { get; set; }
[Category( "Information" )]
[DisplayName( "Date of Birth" )]
[Description( "This property uses the DateTimeUpDown as the default editor." )]
public DateTime DateOfBirth
{
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 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" )]
[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.")]
[ItemsSource(typeof(FontSizeItemsSource))]
public double WritingFontSize { get; set; }
[Category( "Writing" )]
[DisplayName( "Writing Font Size" )]
[Description( "This property uses the DoubleUpDown as the default editor." )]
[ItemsSource( typeof( FontSizeItemsSource ) )]
public double WritingFontSize
{
get;
set;
}
public static Person CreatePerson()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.DateOfBirth = new DateTime(1975, 1, 23);
person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily("Arial");
person.WritingFontSize = 12.0;
return person;
}
}
public static Person CreatePerson()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.DateOfBirth = new DateTime( 1975, 1, 23 );
person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily( "Arial" );
person.WritingFontSize = 12.0;
return person;
}
}
}
public class FontSizeItemsSource : IItemsSource
public class FontSizeItemsSource : IItemsSource
{
public ItemCollection GetValues()
{
public ItemCollection GetValues()
{
ItemCollection sizes = new ItemCollection();
sizes.Add(5.0, "Five");
sizes.Add(5.5);
sizes.Add(6.0, "Six");
sizes.Add(6.5);
sizes.Add(7.0, "Seven");
sizes.Add(7.5);
sizes.Add(8.0, "Eight");
sizes.Add(8.5);
sizes.Add(9.0, "Nine");
sizes.Add(9.5);
sizes.Add(10.0);
sizes.Add(12.0, "Twelve");
sizes.Add(14.0);
sizes.Add(16.0);
sizes.Add(18.0);
sizes.Add(20.0);
return sizes;
}
ItemCollection sizes = new ItemCollection();
sizes.Add( 5.0, "Five" );
sizes.Add( 5.5 );
sizes.Add( 6.0, "Six" );
sizes.Add( 6.5 );
sizes.Add( 7.0, "Seven" );
sizes.Add( 7.5 );
sizes.Add( 8.0, "Eight" );
sizes.Add( 8.5 );
sizes.Add( 9.0, "Nine" );
sizes.Add( 9.5 );
sizes.Add( 10.0 );
sizes.Add( 12.0, "Twelve" );
sizes.Add( 14.0 );
sizes.Add( 16.0 );
sizes.Add( 18.0 );
sizes.Add( 20.0 );
return sizes;
}
}
}

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

@ -1,21 +1,39 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.DefaultEditors"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=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.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.DefaultEditors"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="Default Editors">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="This example demonstrates the default editors provided by the PropertyGrid."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Default Editors:" Style="{StaticResource Header}" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10"/>
</StackPanel>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="This example demonstrates the default editors provided by the PropertyGrid."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Default Editors:" Style="{StaticResource Header}" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" />
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,106 +1,180 @@
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.Collections.Generic;
using System.Windows.Media;
using System.ComponentModel;
using System.Windows;
using System.Windows.Media;
using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views
{
/// <summary>
/// Interaction logic for DefaultEditors.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class DefaultEditors : DemoView
/// <summary>
/// Interaction logic for DefaultEditors.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class DefaultEditors : DemoView
{
public DefaultEditors()
{
public DefaultEditors()
{
InitializeComponent();
_propertyGrid.SelectedObject = Person.CreatePerson();
}
InitializeComponent();
_propertyGrid.SelectedObject = Person.CreatePerson();
}
public class Person
{
[Category( "Information" )]
[DisplayName( "First Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string FirstName
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Last Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string LastName
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Date of Birth" )]
[Description( "This property uses the DateTimeUpDown as the default editor." )]
public DateTime DateOfBirth
{
get;
set;
}
[DisplayName( "Grade Point Average" )]
[Description( "This property uses the DoubleUpDown as the default editor." )]
public double GradePointAvg
{
get;
set;
}
[Category( "Information" )]
[Description( "This property uses the IntegerUpDown as the default editor." )]
public int Age
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Is Male" )]
[Description( "This property uses a CheckBox as the default editor." )]
public bool IsMale
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Favorite Color" )]
[Description( "This property uses the ColorPicker as the default editor." )]
public Color FavoriteColor
{
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 class Person
public static Person CreatePerson()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.DateOfBirth = new DateTime( 1975, 1, 23 );
person.Age = DateTime.Today.Year - person.DateOfBirth.Year;
person.GradePointAvg = 3.98;
person.IsMale = true;
person.FavoriteColor = Colors.Blue;
person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily( "Arial" );
person.WritingFontSize = 12.5;
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.Spouse = new Person()
{
[Category("Information")]
[DisplayName("First Name")]
[Description("This property uses a TextBox as the default editor.")]
public string FirstName { get; set; }
[Category("Information")]
[DisplayName("Last Name")]
[Description("This property uses a TextBox as the default editor.")]
public string LastName { get; set; }
[Category("Information")]
[DisplayName("Date of Birth")]
[Description("This property uses the DateTimeUpDown as the default editor.")]
public DateTime DateOfBirth { get; set; }
[DisplayName("Grade Point Average")]
[Description("This property uses the DoubleUpDown as the default editor.")]
public double GradePointAvg { get; set; }
[Category("Information")]
[Description("This property uses the IntegerUpDown as the default editor.")]
public int Age { get; set; }
[Category("Information")]
[DisplayName("Is Male")]
[Description("This property uses a CheckBox as the default editor.")]
public bool IsMale { get; set; }
[Category("Information")]
[DisplayName("Favorite Color")]
[Description("This property uses the ColorPicker as the default editor.")]
public Color FavoriteColor { 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()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.DateOfBirth = new DateTime(1975, 1, 23);
person.Age = DateTime.Today.Year - person.DateOfBirth.Year;
person.GradePointAvg = 3.98;
person.IsMale = true;
person.FavoriteColor = Colors.Blue;
person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily("Arial");
person.WritingFontSize = 12.5;
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.Spouse = new Person() { FirstName = "Jane", LastName = "Doe" };
return person;
}
}
FirstName = "Jane",
LastName = "Doe"
};
return person;
}
}
}
}

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

@ -1,23 +1,41 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.ExpandableProperties"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=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.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.ExpandableProperties"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="Exandable Properties">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</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."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Expandable Properties:" Style="{StaticResource Header}" />
<TextBlock Text="In this example the Spouse property has been decorated with the ExpandableObject attribute. Notice how you can drill down into the Spouse properties." TextWrapping="Wrap" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" />
</StackPanel>
</Grid>
</infControls:DemoView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</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."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Expandable Properties:" Style="{StaticResource Header}" />
<TextBlock Text="In this example the Spouse property has been decorated with the ExpandableObject attribute. Notice how you can drill down into the Spouse properties." TextWrapping="Wrap" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" />
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,62 +1,101 @@
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.Collections.Generic;
using System;
using System.Windows.Media;
using System.Windows;
using Microsoft.Windows.Controls.PropertyGrid.Attributes;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views
{
/// <summary>
/// Interaction logic for ExpandableProperties.xaml
/// </summary>
public partial class ExpandableProperties : DemoView
/// <summary>
/// Interaction logic for ExpandableProperties.xaml
/// </summary>
public partial class ExpandableProperties : DemoView
{
public ExpandableProperties()
{
public ExpandableProperties()
{
InitializeComponent();
_propertyGrid.SelectedObject = Person.CreatePerson();
}
InitializeComponent();
_propertyGrid.SelectedObject = Person.CreatePerson();
}
public class Person
{
[Category( "Information" )]
[DisplayName( "First Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string FirstName
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Last Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string LastName
{
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" )]
[Description( "This property is a complex property and has no default editor." )]
[ExpandableObject]
public Person Spouse
{
get;
set;
}
public class Person
public static Person CreatePerson()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.WritingFont = new FontFamily( "Arial" );
person.WritingFontSize = 12.5;
person.Spouse = new Person()
{
[Category("Information")]
[DisplayName("First Name")]
[Description("This property uses a TextBox as the default editor.")]
public string FirstName { get; set; }
[Category("Information")]
[DisplayName("Last Name")]
[Description("This property uses a TextBox as the default editor.")]
public string LastName { 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")]
[Description("This property is a complex property and has no default editor.")]
[ExpandableObject]
public Person Spouse { get; set; }
public static Person CreatePerson()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.WritingFont = new FontFamily("Arial");
person.WritingFontSize = 12.5;
person.Spouse = new Person() { FirstName = "Jane", LastName = "Doe" };
return person;
}
}
FirstName = "Jane",
LastName = "Doe"
};
return person;
}
}
}
}

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

@ -1,68 +1,87 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="PropertyGrid" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<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" />
<GroupBox Header="Features" Grid.Row="1" Margin="5">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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" />
<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." />
<GroupBox Header="Features" Grid.Row="1" Margin="5" >
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Filter:" VerticalAlignment="Center" Grid.Row="1" />
<extToolkit:WatermarkTextBox x:Name="_filter"
Grid.Row="1"
Grid.Column="1"
Watermark="Search"
VerticalAlignment="Center" Margin="5" ToolTip="Filters the properties within the PropertyGrid." />
<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."/>
<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." />
<TextBlock Text="Filter:" VerticalAlignment="Center" Grid.Row="1" />
<extToolkit:WatermarkTextBox x:Name="_filter" Grid.Row="1" Grid.Column="1"
Watermark="Search"
VerticalAlignment="Center" Margin="5" ToolTip="Filters the properties within the PropertyGrid."/>
<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." />
</Grid>
</GroupBox>
<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."/>
<StackPanel Grid.Row="2" Margin="10">
<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."
TextWrapping="Wrap" />
<Grid Height="400" Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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."/>
</Grid>
</GroupBox>
<Button x:Name="_button" Height="200" Width="200" Margin="25" HorizontalAlignment="Center" VerticalAlignment="Center">Inspect Me</Button>
<StackPanel Grid.Row="2" Margin="10">
<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."
TextWrapping="Wrap"/>
<Grid Height="400" Margin="10" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button x:Name="_button" Height="200" Width="200" Margin="25" HorizontalAlignment="Center" VerticalAlignment="Center">Inspect Me</Button>
<extToolkit:PropertyGrid Grid.Column="1"
DisplaySummary="{Binding IsChecked, ElementName=_displaySummary}"
Filter="{Binding Text, ElementName=_filter, Mode=TwoWay}"
IsCategorized="{Binding IsChecked, ElementName=_isCategorized, Mode=TwoWay}"
ShowAdvancedOptions="{Binding IsChecked, ElementName=_showAdvancedOptions}"
SelectedObject="{Binding ElementName=_button}"/>
</Grid>
</StackPanel>
</Grid>
<extToolkit:PropertyGrid Grid.Column="1"
DisplaySummary="{Binding IsChecked, ElementName=_displaySummary}"
Filter="{Binding Text, ElementName=_filter, Mode=TwoWay}"
IsCategorized="{Binding IsChecked, ElementName=_isCategorized, Mode=TwoWay}"
ShowAdvancedOptions="{Binding IsChecked, ElementName=_showAdvancedOptions}"
SelectedObject="{Binding ElementName=_button}" />
</Grid>
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,17 +1,35 @@
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;
namespace Samples.Modules.PropertyGrid.Views
{
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class HomeView : DemoView
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView
{
public HomeView()
{
public HomeView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,22 +1,40 @@
<TreeViewItem x:Class="Samples.Modules.PropertyGrid.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.PropertyGrid.Views"
Header="PropertyGrid" Tag="{x:Type views:HomeView}">
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem Header="Editors">
<TreeViewItem Header="Default Editors" Tag="{x:Type views:DefaultEditors}" />
<TreeViewItem Header="Custom Editors" Tag="{x:Type views:CustomEditors}"/>
</TreeViewItem>
<TreeViewItem Header="Properties">
<TreeViewItem Header="Binding to Structs" Tag="{x:Type views:BindingToStructs}"/>
<TreeViewItem Header="Expandable Properties" Tag="{x:Type views:ExpandableProperties}"/>
<TreeViewItem Header="Providing an ItemsSource" Tag="{x:Type views:CustomItemsSource}"/>
<TreeViewItem Header="Specifying Properties" Tag="{x:Type views:SpecifyingProperties}"/>
</TreeViewItem>
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem Header="Editors">
<TreeViewItem Header="Default Editors" Tag="{x:Type views:DefaultEditors}" />
<TreeViewItem Header="Custom Editors" Tag="{x:Type views:CustomEditors}" />
</TreeViewItem>
<TreeViewItem Header="Properties">
<TreeViewItem Header="Binding to Structs" Tag="{x:Type views:BindingToStructs}" />
<TreeViewItem Header="Expandable Properties" Tag="{x:Type views:ExpandableProperties}" />
<TreeViewItem Header="Providing an ItemsSource" Tag="{x:Type views:CustomItemsSource}" />
<TreeViewItem Header="Specifying Properties" Tag="{x:Type views:SpecifyingProperties}" />
</TreeViewItem>
</TreeViewItem>

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

@ -1,27 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.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
{
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
{
public NavigationView()
{
public NavigationView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,30 +1,50 @@
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.SpecifyingProperties"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=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.
********************************************************************-->
<infControls:DemoView x:Class="Samples.Modules.PropertyGrid.Views.SpecifyingProperties"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="Specifying Properties">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</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."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Specifying Properties:" Style="{StaticResource Header}" />
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10"
AutoGenerateProperties="False">
<!-- Only the following properties will be displayed in the PropertyGrid -->
<extToolkit:PropertyGrid.PropertyDefinitions>
<extToolkit:PropertyDefinition Name="FirstName" />
<extToolkit:PropertyDefinition Name="FavoriteColor" />
<extToolkit:PropertyDefinition Name="PetNames" />
</extToolkit:PropertyGrid.PropertyDefinitions>
</extToolkit:PropertyGrid>
</StackPanel>
</Grid>
</infControls:DemoView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</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."
TextWrapping="Wrap" />
<StackPanel Grid.Row="1" Margin="10">
<TextBlock Text="Specifying Properties:" Style="{StaticResource Header}" />
<extToolkit:PropertyGrid x:Name="_propertyGrid"
Width="450"
Margin="10"
AutoGenerateProperties="False">
<!-- Only the following properties will be displayed in the PropertyGrid -->
<extToolkit:PropertyGrid.PropertyDefinitions>
<extToolkit:PropertyDefinition Name="FirstName" />
<extToolkit:PropertyDefinition Name="FavoriteColor" />
<extToolkit:PropertyDefinition Name="PetNames" />
</extToolkit:PropertyGrid.PropertyDefinitions>
</extToolkit:PropertyGrid>
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,106 +1,180 @@
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.Windows.Media;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows;
using System.Windows.Media;
using Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.PropertyGrid.Views
{
/// <summary>
/// Interaction logic for SpecifyingProperties.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class SpecifyingProperties : DemoView
/// <summary>
/// Interaction logic for SpecifyingProperties.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class SpecifyingProperties : DemoView
{
public SpecifyingProperties()
{
public SpecifyingProperties()
{
InitializeComponent();
_propertyGrid.SelectedObject = Person.CreatePerson();
}
InitializeComponent();
_propertyGrid.SelectedObject = Person.CreatePerson();
}
public class Person
{
[Category( "Information" )]
[DisplayName( "First Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string FirstName
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Last Name" )]
[Description( "This property uses a TextBox as the default editor." )]
public string LastName
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Date of Birth" )]
[Description( "This property uses the DateTimeUpDown as the default editor." )]
public DateTime DateOfBirth
{
get;
set;
}
[DisplayName( "Grade Point Average" )]
[Description( "This property uses the DoubleUpDown as the default editor." )]
public double GradePointAvg
{
get;
set;
}
[Category( "Information" )]
[Description( "This property uses the IntegerUpDown as the default editor." )]
public int Age
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Is Male" )]
[Description( "This property uses a CheckBox as the default editor." )]
public bool IsMale
{
get;
set;
}
[Category( "Information" )]
[DisplayName( "Favorite Color" )]
[Description( "This property uses the ColorPicker as the default editor." )]
public Color FavoriteColor
{
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 class Person
public static Person CreatePerson()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.DateOfBirth = new DateTime( 1975, 1, 23 );
person.Age = DateTime.Today.Year - person.DateOfBirth.Year;
person.GradePointAvg = 3.98;
person.IsMale = true;
person.FavoriteColor = Colors.Blue;
person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily( "Arial" );
person.WritingFontSize = 12.5;
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.Spouse = new Person()
{
[Category("Information")]
[DisplayName("First Name")]
[Description("This property uses a TextBox as the default editor.")]
public string FirstName { get; set; }
[Category("Information")]
[DisplayName("Last Name")]
[Description("This property uses a TextBox as the default editor.")]
public string LastName { get; set; }
[Category("Information")]
[DisplayName("Date of Birth")]
[Description("This property uses the DateTimeUpDown as the default editor.")]
public DateTime DateOfBirth { get; set; }
[DisplayName("Grade Point Average")]
[Description("This property uses the DoubleUpDown as the default editor.")]
public double GradePointAvg { get; set; }
[Category("Information")]
[Description("This property uses the IntegerUpDown as the default editor.")]
public int Age { get; set; }
[Category("Information")]
[DisplayName("Is Male")]
[Description("This property uses a CheckBox as the default editor.")]
public bool IsMale { get; set; }
[Category("Information")]
[DisplayName("Favorite Color")]
[Description("This property uses the ColorPicker as the default editor.")]
public Color FavoriteColor { 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()
{
var person = new Person();
person.FirstName = "John";
person.LastName = "Doe";
person.DateOfBirth = new DateTime(1975, 1, 23);
person.Age = DateTime.Today.Year - person.DateOfBirth.Year;
person.GradePointAvg = 3.98;
person.IsMale = true;
person.FavoriteColor = Colors.Blue;
person.WritingHand = System.Windows.HorizontalAlignment.Right;
person.WritingFont = new FontFamily("Arial");
person.WritingFontSize = 12.5;
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.Spouse = new Person() { FirstName = "Jane", LastName = "Doe" };
return person;
}
}
FirstName = "Jane",
LastName = "Doe"
};
return person;
}
}
}
}

52
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.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Text")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Samples.Modules.Text")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTitle( "Samples.Modules.Text" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "Samples.Modules.Text" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2011" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: ComVisible( false )]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -33,11 +49,11 @@ using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

51
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.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions;
using Samples.Modules.Text.Views;
namespace Samples.Modules.Text
{
public class TextModule: ModuleBase
public class TextModule : ModuleBase
{
public TextModule( IUnityContainer container, IRegionManager regionManager )
: base( container, regionManager )
{
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
}
protected override void RegisterViewsAndTypes()
{
public TextModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager) { }
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView));
}
protected override void RegisterViewsAndTypes()
{
Container.RegisterNavigationType(typeof(HomeView));
Container.RegisterNavigationType(typeof(WatermarkTextBoxView));
}
Container.RegisterNavigationType( typeof( HomeView ) );
Container.RegisterNavigationType( typeof( WatermarkTextBoxView ) );
}
}
}

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

@ -1,13 +1,34 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="Text Controls">
<Grid>
<extToolkit:TokenizedTextBox x:Name="_textBox"
DisplayMemberPath="FullName"
SearchMemberPath="FirstName"
ValueMemberPath="Id" HorizontalAlignment="Center" VerticalAlignment="Center" Width="250" />
</Grid>
<Grid>
<extToolkit:TokenizedTextBox x:Name="_textBox"
DisplayMemberPath="FullName"
SearchMemberPath="FirstName"
ValueMemberPath="Id"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="250" />
</Grid>
</infControls:DemoView>

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

@ -1,42 +1,76 @@
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 Microsoft.Practices.Prism.Regions;
using Samples.Infrastructure.Controls;
namespace Samples.Modules.Text.Views
{
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class HomeView : DemoView
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView
{
public HomeView()
{
public HomeView()
InitializeComponent();
_textBox.Text = "1;2;"; //is of object ids
_textBox.ItemsSource = new List<Email>()
{
InitializeComponent();
_textBox.Text = "1;2;"; //is of object ids
_textBox.ItemsSource = new List<Email>()
{
new Email() { Id = 1, FirstName = "John", LastName = "Doe", EmailAddress = "john@test.com" },
new Email() { Id = 2, FirstName = "Jane", LastName = "Doe", EmailAddress = "jane@test.com" },
};
}
new Email() { Id = 1, FirstName = "John", LastName = "Doe", EmailAddress = "john@test.com" },
new Email() { Id = 2, FirstName = "Jane", LastName = "Doe", EmailAddress = "jane@test.com" },
};
}
public class Email
{
public int Id
{
get;
set;
}
public string FirstName
{
get;
set;
}
public string LastName
{
get;
set;
}
public string EmailAddress
{
get;
set;
}
public class Email
public string FullName
{
get
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string EmailAddress { get; set; }
public string FullName
{
get
{
return String.Format("{0}, {1}", LastName, FirstName);
}
}
return String.Format( "{0}, {1}", LastName, FirstName );
}
}
}
}
}

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

@ -1,16 +1,34 @@
<TreeViewItem x:Class="Samples.Modules.Text.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.Text.Views"
Header="Text" Tag="{x:Type views:HomeView}">
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem Header="MaskedTextBox" />
<TreeViewItem Header="MultiLineTextEditor" />
<TreeViewItem Header="RichTextBox" />
<TreeViewItem Header="WatermarkTextBox" Tag="{x:Type views:WatermarkTextBoxView}" />
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem Header="MaskedTextBox" />
<TreeViewItem Header="MultiLineTextEditor" />
<TreeViewItem Header="RichTextBox" />
<TreeViewItem Header="WatermarkTextBox" Tag="{x:Type views:WatermarkTextBoxView}" />
</TreeViewItem>

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

@ -1,27 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.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
{
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
{
public NavigationView()
{
public NavigationView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,48 +1,66 @@
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="WatermarkTextBox">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</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." />
<GroupBox Header="Features" Grid.Row="1" >
<Grid Margin="5">
<CheckBox x:Name="_selectAll" Content="SelectAllOnGotFocus" VerticalAlignment="Center" Margin="5" ToolTip="Selects all text in the WatermarkTextBox when it receives focus." />
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Default:" Style="{StaticResource Header}" />
<extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" MinWidth="200" Watermark="Enter Text" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}"/>
<TextBlock Text="Image Watermark:" Style="{StaticResource Header}" />
<extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}" >
<extToolkit:WatermarkTextBox.Watermark>
<StackPanel Orientation="Horizontal">
<Image Source="/Samples.Modules.Text;component/Images/PencilTool16.png" Stretch="None" />
<TextBlock Text="Enter Text" Margin="4,0,0,0" />
</StackPanel>
</extToolkit:WatermarkTextBox.Watermark>
</extToolkit:WatermarkTextBox>
<TextBlock Grid.Row="2" Text="Custom WatermarkTemplate:" Style="{StaticResource Header}" />
<extToolkit:WatermarkTextBox Grid.Row="2" Grid.Column="1" Margin="5" Watermark="Enter Text" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}">
<extToolkit:WatermarkTextBox.WatermarkTemplate>
<DataTemplate>
<Border BorderBrush="Green" BorderThickness="1" Padding="5" >
<ContentControl Content="{Binding}" Foreground="DarkRed" FontWeight="Bold" Focusable="False" />
</Border>
</DataTemplate>
</extToolkit:WatermarkTextBox.WatermarkTemplate>
</extToolkit:WatermarkTextBox>
</StackPanel>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</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." />
<GroupBox Header="Features" Grid.Row="1">
<Grid Margin="5">
<CheckBox x:Name="_selectAll" Content="SelectAllOnGotFocus" VerticalAlignment="Center" Margin="5" ToolTip="Selects all text in the WatermarkTextBox when it receives focus." />
</Grid>
</GroupBox>
<StackPanel Grid.Row="2" Margin="10">
<TextBlock Text="Default:" Style="{StaticResource Header}" />
<extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" MinWidth="200" Watermark="Enter Text" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}" />
<TextBlock Text="Image Watermark:" Style="{StaticResource Header}" />
<extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}">
<extToolkit:WatermarkTextBox.Watermark>
<StackPanel Orientation="Horizontal">
<Image Source="/Samples.Modules.Text;component/Images/PencilTool16.png" Stretch="None" />
<TextBlock Text="Enter Text" Margin="4,0,0,0" />
</StackPanel>
</extToolkit:WatermarkTextBox.Watermark>
</extToolkit:WatermarkTextBox>
<TextBlock Grid.Row="2" Text="Custom WatermarkTemplate:" Style="{StaticResource Header}" />
<extToolkit:WatermarkTextBox Grid.Row="2" Grid.Column="1" Margin="5" Watermark="Enter Text" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}">
<extToolkit:WatermarkTextBox.WatermarkTemplate>
<DataTemplate>
<Border BorderBrush="Green" BorderThickness="1" Padding="5">
<ContentControl Content="{Binding}" Foreground="DarkRed" FontWeight="Bold" Focusable="False" />
</Border>
</DataTemplate>
</extToolkit:WatermarkTextBox.WatermarkTemplate>
</extToolkit:WatermarkTextBox>
</StackPanel>
</Grid>
</infControls:DemoView>

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

@ -1,18 +1,35 @@
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 Samples.Infrastructure.Controls;
namespace Samples.Modules.Text.Views
{
/// <summary>
/// Interaction logic for WatermarkTextBoxView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive=false)]
public partial class WatermarkTextBoxView : DemoView
/// <summary>
/// Interaction logic for WatermarkTextBoxView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class WatermarkTextBoxView : DemoView
{
public WatermarkTextBoxView()
{
public WatermarkTextBoxView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

52
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.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Samples.Modules.Wizard")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Samples.Modules.Wizard")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyTitle( "Samples.Modules.Wizard" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "" )]
[assembly: AssemblyProduct( "Samples.Modules.Wizard" )]
[assembly: AssemblyCopyright( "Copyright © 2011" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: ComVisible( false )]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
@ -33,11 +49,11 @@ using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
@ -51,5 +67,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

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

@ -1,24 +1,42 @@
<infControls:DemoView x:Class="Samples.Modules.Wizard.Views.HomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Title="Wizard">
<Grid>
<extToolkit:Wizard FinishButtonClosesWindow="True">
<extToolkit:WizardPage x:Name="IntroPage"
<Grid>
<extToolkit:Wizard FinishButtonClosesWindow="True">
<extToolkit:WizardPage x:Name="IntroPage"
Title="Welcome to my Wizard"
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"
Description="This is the first page in the process."/>
<extToolkit:WizardPage x:Name="Page2" PageType="Interior"
Description="This is the first page in the process." />
<extToolkit:WizardPage x:Name="Page2" PageType="Interior"
Title="Page 2"
Description="This is the second page in the process"/>
<extToolkit:WizardPage x:Name="LastPage" PageType="Interior"
Description="This is the second page in the process" />
<extToolkit:WizardPage x:Name="LastPage" PageType="Interior"
Title="Last Page"
Description="This is the last page in the process"
CanFinish="True"/>
</extToolkit:Wizard>
</Grid>
CanFinish="True" />
</extToolkit:Wizard>
</Grid>
</infControls:DemoView>

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

@ -1,18 +1,35 @@
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 Samples.Infrastructure.Controls;
namespace Samples.Modules.Wizard.Views
{
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime(KeepAlive = false)]
public partial class HomeView : DemoView
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
[RegionMemberLifetime( KeepAlive = false )]
public partial class HomeView : DemoView
{
public HomeView()
{
public HomeView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

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

@ -1,11 +1,29 @@
<TreeViewItem x:Class="Samples.Modules.Wizard.Views.NavigationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<!--*********************************************************************
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:Samples.Modules.Wizard.Views"
Header="Wizard" Tag="{x:Type views:HomeView}" >
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
<TreeViewItem.Resources>
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" />
</TreeViewItem.Resources>
</TreeViewItem>

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

@ -1,27 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.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
{
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
/// <summary>
/// Interaction logic for NavigationView.xaml
/// </summary>
public partial class NavigationView : TreeViewItem
{
public NavigationView()
{
public NavigationView()
{
InitializeComponent();
}
InitializeComponent();
}
}
}

51
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.Unity;
using Samples.Infrastructure;
using Samples.Infrastructure.Extensions;
using Samples.Modules.Wizard.Views;
namespace Samples.Modules.Wizard
{
public class WizardModule : ModuleBase
public class WizardModule : ModuleBase
{
public WizardModule( IUnityContainer container, IRegionManager regionManager )
: base( container, regionManager )
{
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) );
}
protected override void RegisterViewsAndTypes()
{
public WizardModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager) { }
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView));
}
protected override void RegisterViewsAndTypes()
{
Container.RegisterNavigationType(typeof(HomeView));
}
Container.RegisterNavigationType( typeof( HomeView ) );
}
}
}

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

@ -1,26 +1,44 @@
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.Controls;
using Microsoft.Practices.Prism.Commands;
namespace Samples.Infrastructure.Commands
{
public class TreeViewCommandBehavior : CommandBehaviorBase<TreeView>
public class TreeViewCommandBehavior : CommandBehaviorBase<TreeView>
{
public TreeViewCommandBehavior( TreeView treeView )
: base( treeView )
{
treeView.SelectedItemChanged += SelectedItemChanged;
}
void SelectedItemChanged( object sender, RoutedPropertyChangedEventArgs<object> e )
{
public TreeViewCommandBehavior(TreeView treeView)
: base(treeView)
{
treeView.SelectedItemChanged += SelectedItemChanged;
}
void SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
//This treeview command is specfic to the navigation region,
//so I always want to pass the tag of the selected treeviewitem
//because it will conatin the Type of view to navigate to.
var type = (e.NewValue as FrameworkElement).Tag as Type;
CommandParameter = type != null ? type.FullName : null;
ExecuteCommand();
}
//This treeview command is specfic to the navigation region,
//so I always want to pass the tag of the selected treeviewitem
//because it will conatin the Type of view to navigate to.
var type = ( e.NewValue as FrameworkElement ).Tag as Type;
CommandParameter = type != null ? type.FullName : null;
ExecuteCommand();
}
}
}

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

@ -1,64 +1,81 @@
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.Controls;
using System.Windows.Input;
namespace Samples.Infrastructure.Commands
{
public class TreeViewSelected
{
private static readonly DependencyProperty SelectedCommandBehaviorProperty = DependencyProperty.RegisterAttached("SelectedCommandBehavior", typeof(TreeViewCommandBehavior), typeof(TreeViewSelected), null);
public class TreeViewSelected
{
private static readonly DependencyProperty SelectedCommandBehaviorProperty = DependencyProperty.RegisterAttached( "SelectedCommandBehavior", typeof( TreeViewCommandBehavior ), typeof( TreeViewSelected ), null );
public static readonly DependencyProperty CommandProperty = DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(TreeViewSelected), new PropertyMetadata(OnSetCommandCallback));
public static void SetCommand(TreeView menuItem, ICommand command)
{
menuItem.SetValue(CommandProperty, command);
}
public static ICommand GetCommand(TreeView menuItem)
{
return menuItem.GetValue(CommandProperty) as ICommand;
}
public static readonly DependencyProperty CommandProperty = DependencyProperty.RegisterAttached( "Command", typeof( ICommand ), typeof( TreeViewSelected ), new PropertyMetadata( OnSetCommandCallback ) );
public static void SetCommand( TreeView menuItem, ICommand command )
{
menuItem.SetValue( CommandProperty, command );
}
public static ICommand GetCommand( TreeView menuItem )
{
return menuItem.GetValue( CommandProperty ) as ICommand;
}
public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.RegisterAttached("CommandParameter", typeof(object), typeof(TreeViewSelected), new PropertyMetadata(OnSetCommandParameterCallback));
public static void SetCommandParameter(TreeView menuItem, object parameter)
{
menuItem.SetValue(CommandParameterProperty, parameter);
}
public static object GetCommandParameter(TreeView menuItem)
{
return menuItem.GetValue(CommandParameterProperty);
}
public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.RegisterAttached( "CommandParameter", typeof( object ), typeof( TreeViewSelected ), new PropertyMetadata( OnSetCommandParameterCallback ) );
public static void SetCommandParameter( TreeView menuItem, object parameter )
{
menuItem.SetValue( CommandParameterProperty, parameter );
}
public static object GetCommandParameter( TreeView menuItem )
{
return menuItem.GetValue( CommandParameterProperty );
}
private static void OnSetCommandCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
TreeView menuItem = dependencyObject as TreeView;
if (menuItem != null)
{
TreeViewCommandBehavior behavior = GetOrCreateBehavior(menuItem);
behavior.Command = e.NewValue as ICommand;
}
}
private static void OnSetCommandCallback( DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e )
{
TreeView menuItem = dependencyObject as TreeView;
if( menuItem != null )
{
TreeViewCommandBehavior behavior = GetOrCreateBehavior( menuItem );
behavior.Command = e.NewValue as ICommand;
}
}
private static void OnSetCommandParameterCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
TreeView menuItem = dependencyObject as TreeView;
if (menuItem != null)
{
TreeViewCommandBehavior behavior = GetOrCreateBehavior(menuItem);
behavior.CommandParameter = e.NewValue;
}
}
private static void OnSetCommandParameterCallback( DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e )
{
TreeView menuItem = dependencyObject as TreeView;
if( menuItem != null )
{
TreeViewCommandBehavior behavior = GetOrCreateBehavior( menuItem );
behavior.CommandParameter = e.NewValue;
}
}
private static TreeViewCommandBehavior GetOrCreateBehavior(TreeView menuItem)
{
TreeViewCommandBehavior behavior = menuItem.GetValue(SelectedCommandBehaviorProperty) as TreeViewCommandBehavior;
if (behavior == null)
{
behavior = new TreeViewCommandBehavior(menuItem);
menuItem.SetValue(SelectedCommandBehaviorProperty, behavior);
}
private static TreeViewCommandBehavior GetOrCreateBehavior( TreeView menuItem )
{
TreeViewCommandBehavior behavior = menuItem.GetValue( SelectedCommandBehaviorProperty ) as TreeViewCommandBehavior;
if( behavior == null )
{
behavior = new TreeViewCommandBehavior( menuItem );
menuItem.SetValue( SelectedCommandBehaviorProperty, behavior );
}
return behavior;
}
return behavior;
}
}
}

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

@ -1,118 +1,154 @@
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.Controls;
using System.IO;
namespace Samples.Infrastructure.Controls
{
public class DemoView : ContentControl
public class DemoView : ContentControl
{
#region Members
readonly string _applicationPath = String.Empty;
const string _samplesFolderName = "Samples";
#endregion //Members
#region Properties
public static readonly DependencyProperty CSharpTextProperty = DependencyProperty.Register( "CSharpText", typeof( string ), typeof( DemoView ), new UIPropertyMetadata( null ) );
public string CSharpText
{
get
{
return ( string )GetValue( CSharpTextProperty );
}
set
{
SetValue( CSharpTextProperty, value );
}
}
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( "Title", typeof( string ), typeof( DemoView ), new UIPropertyMetadata( null ) );
public string Title
{
get
{
return ( string )GetValue( TitleProperty );
}
set
{
SetValue( TitleProperty, value );
}
}
public static readonly DependencyProperty XamlTextProperty = DependencyProperty.Register( "XamlText", typeof( string ), typeof( DemoView ), new UIPropertyMetadata( null ) );
public string XamlText
{
get
{
return ( string )GetValue( XamlTextProperty );
}
set
{
SetValue( XamlTextProperty, value );
}
}
#endregion //Properties
#region Constructors
static DemoView()
{
DefaultStyleKeyProperty.OverrideMetadata( typeof( DemoView ), new FrameworkPropertyMetadata( typeof( DemoView ) ) );
}
public DemoView()
{
#region Members
readonly string _applicationPath = String.Empty;
const string _samplesFolderName = "Samples";
#endregion //Members
#region Properties
public static readonly DependencyProperty CSharpTextProperty = DependencyProperty.Register("CSharpText", typeof(string), typeof(DemoView), new UIPropertyMetadata(null));
public string CSharpText
{
get { return (string)GetValue(CSharpTextProperty); }
set { SetValue(CSharpTextProperty, value); }
}
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(DemoView), new UIPropertyMetadata(null));
public string Title
{
get { return (string)GetValue(TitleProperty); }
set { SetValue(TitleProperty, value); }
}
public static readonly DependencyProperty XamlTextProperty = DependencyProperty.Register("XamlText", typeof(string), typeof(DemoView), new UIPropertyMetadata(null));
public string XamlText
{
get { return (string)GetValue(XamlTextProperty); }
set { SetValue(XamlTextProperty, value); }
}
#endregion //Properties
#region Constructors
static DemoView()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(DemoView), new FrameworkPropertyMetadata(typeof(DemoView)));
}
public DemoView()
{
_applicationPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
}
#endregion //Constructors
#region Base Class Overrides
protected override void OnContentChanged(object oldContent, object newContent)
{
base.OnContentChanged(oldContent, newContent);
//the parent of the content will be the View
ResolveContentCode((newContent as FrameworkElement).Parent);
}
#endregion //Base Class Overrides
#region Methods
private void ResolveContentCode(object newContent)
{
//get the type of the content loaded in the ContentRegion
var type = newContent.GetType();
//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);
//get the module name
var moduleName = type.Module.Name.Replace(".dll", String.Empty);
SetText(viewName, moduleName);
}
private void SetText(string viewName, string moduleName)
{
SetCSharpText(viewName, moduleName);
SetXamlText(viewName, moduleName);
}
private void SetCSharpText(string viewName, string moduleName)
{
//now we need to append the file extension
string fileName = String.Format("{0}.xaml", viewName);
string filePath = GetFilePath(moduleName, fileName);
XamlText = ReadFileText(filePath);
}
private void SetXamlText(string viewName, string moduleName)
{
//now we need to append the file extension
string fileName = String.Format("{0}.xaml.cs", viewName);
string filePath = GetFilePath(moduleName, fileName);
CSharpText = ReadFileText(filePath);
}
private string GetFilePath(string moduleName, string fileName)
{
return Path.Combine(_applicationPath, _samplesFolderName, moduleName, fileName);
}
private static string ReadFileText(string filePath)
{
string text = String.Empty;
if (File.Exists(filePath))
text = File.ReadAllText(filePath);
return text;
}
#endregion //Methods
_applicationPath = Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location );
}
#endregion //Constructors
#region Base Class Overrides
protected override void OnContentChanged( object oldContent, object newContent )
{
base.OnContentChanged( oldContent, newContent );
//the parent of the content will be the View
ResolveContentCode( ( newContent as FrameworkElement ).Parent );
}
#endregion //Base Class Overrides
#region Methods
private void ResolveContentCode( object newContent )
{
//get the type of the content loaded in the ContentRegion
var type = newContent.GetType();
//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 );
//get the module name
var moduleName = type.Module.Name.Replace( ".dll", String.Empty );
SetText( viewName, moduleName );
}
private void SetText( string viewName, string moduleName )
{
SetCSharpText( viewName, moduleName );
SetXamlText( viewName, moduleName );
}
private void SetCSharpText( string viewName, string moduleName )
{
//now we need to append the file extension
string fileName = String.Format( "{0}.xaml", viewName );
string filePath = GetFilePath( moduleName, fileName );
XamlText = ReadFileText( filePath );
}
private void SetXamlText( string viewName, string moduleName )
{
//now we need to append the file extension
string fileName = String.Format( "{0}.xaml.cs", viewName );
string filePath = GetFilePath( moduleName, fileName );
CSharpText = ReadFileText( filePath );
}
private string GetFilePath( string moduleName, string fileName )
{
return Path.Combine( _applicationPath, _samplesFolderName, moduleName, fileName );
}
private static string ReadFileText( string filePath )
{
string text = String.Empty;
if( File.Exists( filePath ) )
text = File.ReadAllText( filePath );
return text;
}
#endregion //Methods
}
}

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

@ -1,43 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using Samples.Infrastructure.Core.CodeFormatting;
/************************************************************************
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.Data;
using System.Windows.Documents;
using System.Windows.Media;
using Samples.Infrastructure.Core.CodeFormatting;
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 )
{
if( value == null )
return value;
String val = ( String )value;
CSharpFormat cSharpFormat = new CSharpFormat();
FlowDocument doc = new FlowDocument();
Paragraph p = new Paragraph();
p = cSharpFormat.FormatCode( val );
doc.Blocks.Add( p );
RichTextBox rtb = new RichTextBox();
rtb.IsReadOnly = true;
rtb.Document = doc;
rtb.Document.PageWidth = 2500.0;
rtb.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.FontFamily = new FontFamily( "Courier New" );
return rtb;
}
public object ConvertBack( 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)
return value;
String val = (String)value;
CSharpFormat cSharpFormat = new CSharpFormat();
FlowDocument doc = new FlowDocument();
Paragraph p = new Paragraph();
p = cSharpFormat.FormatCode(val);
doc.Blocks.Add(p);
RichTextBox rtb = new RichTextBox();
rtb.IsReadOnly = true;
rtb.Document = doc;
rtb.Document.PageWidth = 2500.0;
rtb.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.FontFamily = new FontFamily("Courier New");
return rtb;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
throw new NotImplementedException();
}
}
}

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

@ -1,121 +1,139 @@
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.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Documents;
using System.Windows.Controls;
using System.Windows.Media;
using Samples.Infrastructure.Core.CodeFormatting;
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 )
{
if( value == null )
return value;
string xaml = value as string;
FlowDocument doc = new FlowDocument();
ColorizeXAML( xaml, doc );
RichTextBox rtb = new RichTextBox();
rtb.IsReadOnly = true;
rtb.Document = doc;
rtb.Document.PageWidth = 2500.0;
rtb.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.FontFamily = new FontFamily( "Courier New" );
return rtb;
}
public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
{
throw new NotImplementedException();
}
#region SyntaxColoring
#region ColorizeXAML
public void ColorizeXAML( string xamlText, FlowDocument targetDoc )
{
XmlTokenizer tokenizer = new XmlTokenizer();
XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement;
List<XmlToken> tokens = tokenizer.Tokenize( xamlText, ref mode );
List<string> tokenTexts = new List<string>( tokens.Count );
List<Color> colors = new List<Color>( tokens.Count );
int position = 0;
foreach( XmlToken token in tokens )
{
string tokenText = xamlText.Substring( position, token.Length );
tokenTexts.Add( tokenText );
Color color = ColorForToken( token, tokenText );
colors.Add( color );
position += token.Length;
}
Paragraph p = new Paragraph();
// Loop through tokens
for( int i = 0; i < tokenTexts.Count; i++ )
{
Run r = new Run( tokenTexts[ i ] );
r.Foreground = new SolidColorBrush( colors[ i ] );
p.Inlines.Add( r );
}
targetDoc.Blocks.Add( p );
}
#endregion //ColorizeXAML
static Color ColorForToken( XmlToken token, string tokenText )
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return value;
string xaml = value as string;
FlowDocument doc = new FlowDocument();
ColorizeXAML(xaml, doc);
RichTextBox rtb = new RichTextBox();
rtb.IsReadOnly = true;
rtb.Document = doc;
rtb.Document.PageWidth = 2500.0;
rtb.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
rtb.FontFamily = new FontFamily("Courier New");
return rtb;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#region SyntaxColoring
#region ColorizeXAML
public void ColorizeXAML(string xamlText, FlowDocument targetDoc)
{
XmlTokenizer tokenizer = new XmlTokenizer();
XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement;
List<XmlToken> tokens = tokenizer.Tokenize(xamlText, ref mode);
List<string> tokenTexts = new List<string>(tokens.Count);
List<Color> colors = new List<Color>(tokens.Count);
int position = 0;
foreach (XmlToken token in tokens)
{
string tokenText = xamlText.Substring(position, token.Length);
tokenTexts.Add(tokenText);
Color color = ColorForToken(token, tokenText);
colors.Add(color);
position += token.Length;
}
Paragraph p = new Paragraph();
// Loop through tokens
for (int i = 0; i < tokenTexts.Count; i++)
{
Run r = new Run(tokenTexts[i]);
r.Foreground = new SolidColorBrush(colors[i]);
p.Inlines.Add(r);
}
targetDoc.Blocks.Add(p);
}
#endregion //ColorizeXAML
static Color ColorForToken(XmlToken token, string tokenText)
{
Color color = Color.FromRgb(0, 0, 0);
switch (token.Kind)
{
case XmlTokenKind.Open:
case XmlTokenKind.OpenClose:
case XmlTokenKind.Close:
case XmlTokenKind.SelfClose:
case XmlTokenKind.CommentBegin:
case XmlTokenKind.CommentEnd:
case XmlTokenKind.CDataBegin:
case XmlTokenKind.CDataEnd:
case XmlTokenKind.Equals:
case XmlTokenKind.OpenProcessingInstruction:
case XmlTokenKind.CloseProcessingInstruction:
case XmlTokenKind.AttributeValue:
color = Color.FromRgb(0, 0, 255);
// color = "blue";
break;
case XmlTokenKind.ElementName:
color = Color.FromRgb(163, 21, 21);
// color = "brown";
break;
case XmlTokenKind.TextContent:
// color = "black";
break;
case XmlTokenKind.AttributeName:
case XmlTokenKind.Entity:
color = Color.FromRgb(255, 0, 0);
// color = "red";
break;
case XmlTokenKind.CommentText:
color = Color.FromRgb(0, 128, 0);
// color = "green";
break;
}
if (token.Kind == XmlTokenKind.ElementWhitespace
|| (token.Kind == XmlTokenKind.TextContent && tokenText.Trim() == ""))
{
// color = null;
}
return color;
}
#endregion SyntaxColoring
Color color = Color.FromRgb( 0, 0, 0 );
switch( token.Kind )
{
case XmlTokenKind.Open:
case XmlTokenKind.OpenClose:
case XmlTokenKind.Close:
case XmlTokenKind.SelfClose:
case XmlTokenKind.CommentBegin:
case XmlTokenKind.CommentEnd:
case XmlTokenKind.CDataBegin:
case XmlTokenKind.CDataEnd:
case XmlTokenKind.Equals:
case XmlTokenKind.OpenProcessingInstruction:
case XmlTokenKind.CloseProcessingInstruction:
case XmlTokenKind.AttributeValue:
color = Color.FromRgb( 0, 0, 255 );
// color = "blue";
break;
case XmlTokenKind.ElementName:
color = Color.FromRgb( 163, 21, 21 );
// color = "brown";
break;
case XmlTokenKind.TextContent:
// color = "black";
break;
case XmlTokenKind.AttributeName:
case XmlTokenKind.Entity:
color = Color.FromRgb( 255, 0, 0 );
// color = "red";
break;
case XmlTokenKind.CommentText:
color = Color.FromRgb( 0, 128, 0 );
// color = "green";
break;
}
if( token.Kind == XmlTokenKind.ElementWhitespace
|| ( token.Kind == XmlTokenKind.TextContent && tokenText.Trim() == "" ) )
{
// color = null;
}
return color;
}
#endregion SyntaxColoring
}
}

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

@ -22,370 +22,418 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Documents;
using System.Windows.Media;
namespace Samples.Infrastructure.Core.CodeFormatting
{
public class CSharpFormat : CLikeFormat
public class CSharpFormat : CLikeFormat
{
/// <summary>
/// The list of C# keywords.
/// </summary>
protected override string Keywords
{
/// <summary>
/// The list of C# keywords.
/// </summary>
protected override string Keywords
{
get
{
return "abstract as base bool break byte case catch char "
+ "checked class const continue decimal default delegate do double else "
+ "enum event explicit extern false finally fixed float for foreach goto "
+ "if implicit in int interface internal is lock long namespace new null "
+ "object operator out override partial params private protected public readonly "
+ "ref return sbyte sealed short sizeof stackalloc static string struct "
+ "switch this throw true try typeof uint ulong unchecked unsafe ushort "
+ "using value virtual void volatile where while yield";
}
}
/// <summary>
/// The list of C# preprocessors.
/// </summary>
protected override string Preprocessors
{
get
{
return "#if #else #elif #endif #define #undef #warning "
+ "#error #line #region #endregion #pragma";
}
}
get
{
return "abstract as base bool break byte case catch char "
+ "checked class const continue decimal default delegate do double else "
+ "enum event explicit extern false finally fixed float for foreach goto "
+ "if implicit in int interface internal is lock long namespace new null "
+ "object operator out override partial params private protected public readonly "
+ "ref return sbyte sealed short sizeof stackalloc static string struct "
+ "switch this throw true try typeof uint ulong unchecked unsafe ushort "
+ "using value virtual void volatile where while yield";
}
}
/// <summary>
/// Provides a base class for formatting languages similar to C.
/// The list of C# preprocessors.
/// </summary>
public abstract class CLikeFormat : CodeFormat
protected override string Preprocessors
{
/// <summary>
/// Regular expression string to match single line and multi-line
/// comments (// and /* */).
/// </summary>
protected override string CommentRegEx
{
get { return @"/\*.*?\*/|//.*?(?=\r|\n)"; }
}
/// <summary>
/// Regular expression string to match string and character literals.
/// </summary>
protected override string StringRegEx
{
get { return @"@?""""|@?"".*?(?!\\).""|''|'.*?(?!\\).'"; }
}
get
{
return "#if #else #elif #endif #define #undef #warning "
+ "#error #line #region #endregion #pragma";
}
}
}
/// <summary>
/// Provides a base class for formatting languages similar to C.
/// </summary>
public abstract class CLikeFormat : CodeFormat
{
/// <summary>
/// Provides a base class for formatting most programming languages.
/// Regular expression string to match single line and multi-line
/// comments (// and /* */).
/// </summary>
public abstract class CodeFormat : SourceFormat
protected override string CommentRegEx
{
/// <summary>
/// Must be overridden to provide a list of keywords defined in
/// each language.
/// </summary>
/// <remarks>
/// Keywords must be separated with spaces.
/// </remarks>
protected abstract string Keywords
{
get;
}
/// <summary>
/// Can be overridden to provide a list of preprocessors defined in
/// each language.
/// </summary>
/// <remarks>
/// Preprocessors must be separated with spaces.
/// </remarks>
protected virtual string Preprocessors
{
get { return ""; }
}
get
{
return @"/\*.*?\*/|//.*?(?=\r|\n)";
}
}
/// <summary>
/// Must be overridden to provide a regular expression string
/// to match strings literals.
/// </summary>
protected abstract string StringRegEx
{
get;
}
/// <summary>
/// Regular expression string to match string and character literals.
/// </summary>
protected override string StringRegEx
{
get
{
return @"@?""""|@?"".*?(?!\\).""|''|'.*?(?!\\).'";
}
}
}
/// <summary>
/// Must be overridden to provide a regular expression string
/// to match comments.
/// </summary>
protected abstract string CommentRegEx
{
get;
}
/// <summary>
/// Provides a base class for formatting most programming languages.
/// </summary>
public abstract class CodeFormat : SourceFormat
{
/// <summary>
/// Must be overridden to provide a list of keywords defined in
/// each language.
/// </summary>
/// <remarks>
/// Keywords must be separated with spaces.
/// </remarks>
protected abstract string Keywords
{
get;
}
/// <summary>
/// Determines if the language is case sensitive.
/// </summary>
/// <value><b>true</b> if the language is case sensitive, <b>false</b>
/// otherwise. The default is true.</value>
/// <remarks>
/// A case-insensitive language formatter must override this
/// property to return false.
/// </remarks>
public virtual bool CaseSensitive
{
get { return true; }
}
/// <summary>
/// Can be overridden to provide a list of preprocessors defined in
/// each language.
/// </summary>
/// <remarks>
/// Preprocessors must be separated with spaces.
/// </remarks>
protected virtual string Preprocessors
{
get
{
return "";
}
}
/// <summary/>
protected CodeFormat()
{
//generate the keyword and preprocessor regexes from the keyword lists
Regex r;
r = new Regex(@"\w+|-\w+|#\w+|@@\w+|#(?:\\(?:s|w)(?:\*|\+)?\w+)+|@\\w\*+");
string regKeyword = r.Replace(Keywords, @"(?<=^|\W)$0(?=\W)");
string regPreproc = r.Replace(Preprocessors, @"(?<=^|\s)$0(?=\s|$)");
r = new Regex(@" +");
regKeyword = r.Replace(regKeyword, @"|");
regPreproc = r.Replace(regPreproc, @"|");
if (regPreproc.Length == 0)
{
regPreproc = "(?!.*)_{37}(?<!.*)"; //use something quite impossible...
}
//build a master regex with capturing groups
StringBuilder regAll = new StringBuilder();
regAll.Append("(");
regAll.Append(CommentRegEx);
regAll.Append(")|(");
regAll.Append(StringRegEx);
if (regPreproc.Length > 0)
{
regAll.Append(")|(");
regAll.Append(regPreproc);
}
regAll.Append(")|(");
regAll.Append(regKeyword);
regAll.Append(")");
RegexOptions caseInsensitive = CaseSensitive ? 0 : RegexOptions.IgnoreCase;
CodeRegex = new Regex(regAll.ToString(), RegexOptions.Singleline | caseInsensitive);
CodeParagraphGlobal = new List<Run>();
}
/// <summary>
/// Must be overridden to provide a regular expression string
/// to match strings literals.
/// </summary>
protected abstract string StringRegEx
{
get;
}
/// <summary>
/// Called to evaluate the HTML fragment corresponding to each
/// matching token in the code.
/// </summary>
/// <param name="match">The <see cref="Match"/> resulting from a
/// single regular expression match.</param>
/// <returns>A string containing the HTML code fragment.</returns>
protected override string MatchEval(Match match) //protected override
{
if (match.Groups[1].Success) //comment
{
StringReader reader = new StringReader(match.ToString());
string line;
StringBuilder sb = new StringBuilder();
while ((line = reader.ReadLine()) != null)
{
Run r = new Run(line);
r.Foreground = new SolidColorBrush(Color.FromRgb(0, 128, 0));
CodeParagraphGlobal.Add(r);
}
return "::::::";
}
else if (match.Groups[2].Success) //string literal
{
Run r = new Run(match.ToString());
r.Foreground = new SolidColorBrush(Color.FromRgb(0, 96, 128));
CodeParagraphGlobal.Add(r);
return "::::::";
}
else if (match.Groups[3].Success) //preprocessor keyword
{
Run r = new Run(match.ToString());
r.Foreground = new SolidColorBrush(Color.FromRgb(204, 102, 51));
CodeParagraphGlobal.Add(r);
return "::::::";
}
else if (match.Groups[4].Success) //keyword
{
Run r = new Run(match.ToString());
r.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
CodeParagraphGlobal.Add(r);
return "::::::";
}
else
{
return "";
}
}
/// <summary>
/// Must be overridden to provide a regular expression string
/// to match comments.
/// </summary>
protected abstract string CommentRegEx
{
get;
}
/// <summary>
/// Provides a base implementation for all code formatters.
/// Determines if the language is case sensitive.
/// </summary>
/// <value><b>true</b> if the language is case sensitive, <b>false</b>
/// otherwise. The default is true.</value>
/// <remarks>
/// <para>
/// To display the formatted code on your web site, the web page must
/// refer to a stylesheet that defines the formatting for the different
/// CSS classes generated by CSharpFormat:
/// .csharpcode, pre, .rem, .kwrd, .str, .op, .preproc, .alt, .lnum.
/// </para>
/// <para>
/// Note that if you have multi-line comments in your source code
/// (like /* ... */), the "line numbers" or "alternate line background"
/// options will generate code that is not strictly HTML 4.01 compliant.
/// The code will still look good with IE5+ or Mozilla 0.8+.
/// </para>
/// A case-insensitive language formatter must override this
/// property to return false.
/// </remarks>
public abstract class SourceFormat
public virtual bool CaseSensitive
{
/// <summary/>
protected SourceFormat()
{
_tabSpaces = 4;
_lineNumbers = false;
_alternate = false;
_embedStyleSheet = false;
}
get
{
return true;
}
}
private byte _tabSpaces;
/// <summary/>
protected CodeFormat()
{
//generate the keyword and preprocessor regexes from the keyword lists
Regex r;
r = new Regex( @"\w+|-\w+|#\w+|@@\w+|#(?:\\(?:s|w)(?:\*|\+)?\w+)+|@\\w\*+" );
string regKeyword = r.Replace( Keywords, @"(?<=^|\W)$0(?=\W)" );
string regPreproc = r.Replace( Preprocessors, @"(?<=^|\s)$0(?=\s|$)" );
r = new Regex( @" +" );
regKeyword = r.Replace( regKeyword, @"|" );
regPreproc = r.Replace( regPreproc, @"|" );
if( regPreproc.Length == 0 )
{
regPreproc = "(?!.*)_{37}(?<!.*)"; //use something quite impossible...
}
//build a master regex with capturing groups
StringBuilder regAll = new StringBuilder();
regAll.Append( "(" );
regAll.Append( CommentRegEx );
regAll.Append( ")|(" );
regAll.Append( StringRegEx );
if( regPreproc.Length > 0 )
{
regAll.Append( ")|(" );
regAll.Append( regPreproc );
}
regAll.Append( ")|(" );
regAll.Append( regKeyword );
regAll.Append( ")" );
RegexOptions caseInsensitive = CaseSensitive ? 0 : RegexOptions.IgnoreCase;
CodeRegex = new Regex( regAll.ToString(), RegexOptions.Singleline | caseInsensitive );
CodeParagraphGlobal = new List<Run>();
}
/// <summary>
/// Gets or sets the tabs width.
/// </summary>
/// <value>The number of space characters to substitute for tab
/// characters. The default is <b>4</b>, unless overridden is a
/// derived class.</value>
public byte TabSpaces
/// <summary>
/// Called to evaluate the HTML fragment corresponding to each
/// matching token in the code.
/// </summary>
/// <param name="match">The <see cref="Match"/> resulting from a
/// single regular expression match.</param>
/// <returns>A string containing the HTML code fragment.</returns>
protected override string MatchEval( Match match ) //protected override
{
if( match.Groups[ 1 ].Success ) //comment
{
StringReader reader = new StringReader( match.ToString() );
string line;
StringBuilder sb = new StringBuilder();
while( ( line = reader.ReadLine() ) != null )
{
get { return _tabSpaces; }
set { _tabSpaces = value; }
Run r = new Run( line );
r.Foreground = new SolidColorBrush( Color.FromRgb( 0, 128, 0 ) );
CodeParagraphGlobal.Add( r );
}
return "::::::";
}
else if( match.Groups[ 2 ].Success ) //string literal
{
Run r = new Run( match.ToString() );
r.Foreground = new SolidColorBrush( Color.FromRgb( 0, 96, 128 ) );
CodeParagraphGlobal.Add( r );
return "::::::";
}
else if( match.Groups[ 3 ].Success ) //preprocessor keyword
{
Run r = new Run( match.ToString() );
r.Foreground = new SolidColorBrush( Color.FromRgb( 204, 102, 51 ) );
CodeParagraphGlobal.Add( r );
return "::::::";
}
else if( match.Groups[ 4 ].Success ) //keyword
{
Run r = new Run( match.ToString() );
r.Foreground = new SolidColorBrush( Color.FromRgb( 0, 0, 255 ) );
CodeParagraphGlobal.Add( r );
return "::::::";
}
else
{
return "";
}
}
}
/// <summary>
/// Provides a base implementation for all code formatters.
/// </summary>
/// <remarks>
/// <para>
/// To display the formatted code on your web site, the web page must
/// refer to a stylesheet that defines the formatting for the different
/// CSS classes generated by CSharpFormat:
/// .csharpcode, pre, .rem, .kwrd, .str, .op, .preproc, .alt, .lnum.
/// </para>
/// <para>
/// Note that if you have multi-line comments in your source code
/// (like /* ... */), the "line numbers" or "alternate line background"
/// options will generate code that is not strictly HTML 4.01 compliant.
/// The code will still look good with IE5+ or Mozilla 0.8+.
/// </para>
/// </remarks>
public abstract class SourceFormat
{
/// <summary/>
protected SourceFormat()
{
_tabSpaces = 4;
_lineNumbers = false;
_alternate = false;
_embedStyleSheet = false;
}
private bool _lineNumbers;
private byte _tabSpaces;
/// <summary>
/// Enables or disables line numbers in output.
/// </summary>
/// <value>When <b>true</b>, line numbers are generated.
/// The default is <b>false</b>.</value>
public bool LineNumbers
{
get { return _lineNumbers; }
set { _lineNumbers = value; }
}
/// <summary>
/// Gets or sets the tabs width.
/// </summary>
/// <value>The number of space characters to substitute for tab
/// characters. The default is <b>4</b>, unless overridden is a
/// derived class.</value>
public byte TabSpaces
{
get
{
return _tabSpaces;
}
set
{
_tabSpaces = value;
}
}
private bool _alternate;
private bool _lineNumbers;
/// <summary>
/// Enables or disables alternating line background.
/// </summary>
/// <value>When <b>true</b>, lines background is alternated.
/// The default is <b>false</b>.</value>
public bool Alternate
{
get { return _alternate; }
set { _alternate = value; }
}
/// <summary>
/// Enables or disables line numbers in output.
/// </summary>
/// <value>When <b>true</b>, line numbers are generated.
/// The default is <b>false</b>.</value>
public bool LineNumbers
{
get
{
return _lineNumbers;
}
set
{
_lineNumbers = value;
}
}
private bool _embedStyleSheet;
private bool _alternate;
/// <summary>
/// Enables or disables the embedded CSS style sheet.
/// </summary>
/// <value>When <b>true</b>, the CSS &lt;style&gt; element is included
/// in the HTML output. The default is <b>false</b>.</value>
public bool EmbedStyleSheet
{
get { return _embedStyleSheet; }
set { _embedStyleSheet = value; }
}
/// <summary>
/// Enables or disables alternating line background.
/// </summary>
/// <value>When <b>true</b>, lines background is alternated.
/// The default is <b>false</b>.</value>
public bool Alternate
{
get
{
return _alternate;
}
set
{
_alternate = value;
}
}
/// <summary>
/// Transforms a source code string to HTML 4.01.
/// </summary>
/// <returns>A string containing the HTML formatted code.</returns>
public Paragraph FormatCode(string source)
{
return FormatCode(source, _lineNumbers, _alternate, _embedStyleSheet, false);
}
private bool _embedStyleSheet;
private Regex codeRegex;
/// <summary>
/// Enables or disables the embedded CSS style sheet.
/// </summary>
/// <value>When <b>true</b>, the CSS &lt;style&gt; element is included
/// in the HTML output. The default is <b>false</b>.</value>
public bool EmbedStyleSheet
{
get
{
return _embedStyleSheet;
}
set
{
_embedStyleSheet = value;
}
}
/// <summary>
/// The regular expression used to capture language tokens.
/// </summary>
protected Regex CodeRegex
{
get { return codeRegex; }
set { codeRegex = value; }
}
/// <summary>
/// Transforms a source code string to HTML 4.01.
/// </summary>
/// <returns>A string containing the HTML formatted code.</returns>
public Paragraph FormatCode( string source )
{
return FormatCode( source, _lineNumbers, _alternate, _embedStyleSheet, false );
}
private List<Run> codeParagraphGlobal;
/// <summary>
/// This is a List of Run's that can be added later to the string of code
/// </summary>
protected List<Run> CodeParagraphGlobal
{
get { return codeParagraphGlobal; }
set { codeParagraphGlobal = value; }
}
private Regex codeRegex;
/// <summary>
/// Called to evaluate the HTML fragment corresponding to each
/// matching token in the code.
/// </summary>
/// <param name="match">The <see cref="Match"/> resulting from a
/// single regular expression match.</param>
/// <returns>A string containing the HTML code fragment.</returns>
protected abstract string MatchEval(Match match); //protected abstract
//does the formatting job
private Paragraph FormatCode(string source, bool lineNumbers,
bool alternate, bool embedStyleSheet, bool subCode)
/// <summary>
/// The regular expression used to capture language tokens.
/// </summary>
protected Regex CodeRegex
{
get
{
return codeRegex;
}
set
{
codeRegex = value;
}
}
private List<Run> codeParagraphGlobal;
/// <summary>
/// This is a List of Run's that can be added later to the string of code
/// </summary>
protected List<Run> CodeParagraphGlobal
{
get
{
return codeParagraphGlobal;
}
set
{
codeParagraphGlobal = value;
}
}
/// <summary>
/// Called to evaluate the HTML fragment corresponding to each
/// matching token in the code.
/// </summary>
/// <param name="match">The <see cref="Match"/> resulting from a
/// single regular expression match.</param>
/// <returns>A string containing the HTML code fragment.</returns>
protected abstract string MatchEval( Match match ); //protected abstract
//does the formatting job
private Paragraph FormatCode( string source, bool lineNumbers,
bool alternate, bool embedStyleSheet, bool subCode )
{
Paragraph codeParagraph = new Paragraph();
//replace special characters
StringBuilder sb = new StringBuilder( source );
//color the code
source = codeRegex.Replace( sb.ToString(), new MatchEvaluator( this.MatchEval ) );
//codeRegex.Replace(
string[] characters = { "::::::" };
string[] split = source.Split( characters, new StringSplitOptions() );
int currentChunk = 0;
foreach( string code in split )
{
currentChunk++;
Run r = new Run( code );
codeParagraph.Inlines.Add( r );
if( ( currentChunk - 1 ) < codeParagraphGlobal.Count )
{
Paragraph codeParagraph = new Paragraph();
//replace special characters
StringBuilder sb = new StringBuilder(source);
//color the code
source = codeRegex.Replace(sb.ToString(), new MatchEvaluator(this.MatchEval));
//codeRegex.Replace(
string[] characters = { "::::::" };
string[] split = source.Split(characters, new StringSplitOptions());
int currentChunk = 0;
foreach (string code in split)
{
currentChunk++;
Run r = new Run(code);
codeParagraph.Inlines.Add(r);
if ((currentChunk - 1) < codeParagraphGlobal.Count)
{
codeParagraph.Inlines.Add(codeParagraphGlobal[currentChunk - 1]);
}
}
return codeParagraph;
codeParagraph.Inlines.Add( codeParagraphGlobal[ currentChunk - 1 ] );
}
}
return codeParagraph;
}
}
}

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

@ -1,351 +1,350 @@
//Author: Nick Kramer [MSFT]
//Source: http://blogs.msdn.com/b/nickkramer/archive/2006/09/22/766934.aspx
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Samples.Infrastructure.Core.CodeFormatting
{
// XML tokenizer, tokens are designed to match Visual Studio syntax highlighting
class XmlTokenizer
// XML tokenizer, tokens are designed to match Visual Studio syntax highlighting
class XmlTokenizer
{
private string input;
private int position = 0;
private XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement;
public static List<XmlToken> Tokenize( string input )
{
private string input;
private int position = 0;
private XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement;
public static List<XmlToken> Tokenize(string input)
{
XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement;
XmlTokenizer tokenizer = new XmlTokenizer();
return tokenizer.Tokenize(input, ref mode);
}
public List<XmlToken> Tokenize(string input, ref XmlTokenizerMode _mode)
{
this.input = input;
this.mode = _mode;
this.position = 0;
List<XmlToken> result = Tokenize();
_mode = this.mode;
return result;
}
private List<XmlToken> Tokenize()
{
List<XmlToken> list = new List<XmlToken>();
XmlToken token;
do
{
int previousPosition = position;
token = NextToken();
string tokenText = input.Substring(previousPosition, token.Length);
list.Add(token);
}
while (token.Kind != XmlTokenKind.EOF);
List<string> strings = TokensToStrings(list, input);
return list;
}
private List<string> TokensToStrings(List<XmlToken> list, string input)
{
List<string> output = new List<string>();
int position = 0;
foreach (XmlToken token in list)
{
output.Add(input.Substring(position, token.Length));
position += token.Length;
}
return output;
}
// debugging function
public string RemainingText
{
get
{
return input.Substring(position);
}
}
private XmlToken NextToken()
{
if (position >= input.Length)
return new XmlToken(XmlTokenKind.EOF, 0);
XmlToken token;
switch (mode)
{
case XmlTokenizerMode.AfterAttributeEquals:
token = TokenizeAttributeValue();
break;
case XmlTokenizerMode.AfterAttributeName:
token = TokenizeSimple("=", XmlTokenKind.Equals, XmlTokenizerMode.AfterAttributeEquals);
break;
case XmlTokenizerMode.AfterOpen:
token = TokenizeName(XmlTokenKind.ElementName, XmlTokenizerMode.InsideElement);
break;
case XmlTokenizerMode.InsideCData:
token = TokenizeInsideCData();
break;
case XmlTokenizerMode.InsideComment:
token = TokenizeInsideComment();
break;
case XmlTokenizerMode.InsideElement:
token = TokenizeInsideElement();
break;
case XmlTokenizerMode.InsideProcessingInstruction:
token = TokenizeInsideProcessingInstruction();
break;
case XmlTokenizerMode.OutsideElement:
token = TokenizeOutsideElement();
break;
default:
token = new XmlToken(XmlTokenKind.EOF, 0);
Debug.Fail("missing case");
break;
}
return token;
}
private bool IsNameCharacter(char character)
{
// XML rule: Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
bool result = char.IsLetterOrDigit(character) || character == '.' | character == '-' | character == '_' | character == ':';
return result;
}
private XmlToken TokenizeAttributeValue()
{
Debug.Assert(mode == XmlTokenizerMode.AfterAttributeEquals);
int closePosition = input.IndexOf(input[position], position + 1);
XmlToken token = new XmlToken(XmlTokenKind.AttributeValue, closePosition + 1 - position);
position = closePosition + 1;
mode = XmlTokenizerMode.InsideElement;
return token;
}
private XmlToken TokenizeName(XmlTokenKind kind, XmlTokenizerMode nextMode)
{
Debug.Assert(mode == XmlTokenizerMode.AfterOpen || mode == XmlTokenizerMode.InsideElement);
int i;
for (i = position; i < input.Length; i++)
if (!IsNameCharacter(input[i]))
break;
XmlToken token = new XmlToken(kind, i - position);
mode = nextMode;
position = i;
return token;
}
private XmlToken TokenizeElementWhitespace()
{
int i;
for (i = position; i < input.Length; i++)
if (!char.IsWhiteSpace(input[i]))
break;
XmlToken token = new XmlToken(XmlTokenKind.ElementWhitespace, i - position);
position = i;
return token;
}
private bool StartsWith(string text)
{
if (position + text.Length > input.Length)
return false;
else
return input.Substring(position, text.Length) == text;
}
private XmlToken TokenizeInsideElement()
{
if (char.IsWhiteSpace(input[position]))
return TokenizeElementWhitespace();
else
if (StartsWith("/>"))
return TokenizeSimple("/>", XmlTokenKind.SelfClose, XmlTokenizerMode.OutsideElement);
else
if (StartsWith(">"))
return TokenizeSimple(">", XmlTokenKind.Close, XmlTokenizerMode.OutsideElement);
else
return TokenizeName(XmlTokenKind.AttributeName, XmlTokenizerMode.AfterAttributeName);
}
private XmlToken TokenizeText()
{
Debug.Assert(input[position] != '<');
Debug.Assert(input[position] != '&');
Debug.Assert(mode == XmlTokenizerMode.OutsideElement);
int i;
for (i = position; i < input.Length; i++)
if (input[i] == '<' || input[i] == '&')
break;
XmlToken token = new XmlToken(XmlTokenKind.TextContent, i - position);
position = i;
return token;
}
private XmlToken TokenizeOutsideElement()
{
Debug.Assert(mode == XmlTokenizerMode.OutsideElement);
if (position >= input.Length)
return new XmlToken(XmlTokenKind.EOF, 0);
switch (input[position])
{
case '<':
return TokenizeOpen();
case '&':
return TokenizeEntity();
default:
return TokenizeText();
}
}
private XmlToken TokenizeSimple(string text, XmlTokenKind kind, XmlTokenizerMode nextMode)
{
XmlToken token = new XmlToken(kind, text.Length);
position += text.Length;
mode = nextMode;
return token;
}
private XmlToken TokenizeOpen()
{
Debug.Assert(input[position] == '<');
if (StartsWith("<!--"))
return TokenizeSimple("<!--", XmlTokenKind.CommentBegin, XmlTokenizerMode.InsideComment);
else
if (StartsWith("<![CDATA["))
return TokenizeSimple("<![CDATA[", XmlTokenKind.CDataBegin, XmlTokenizerMode.InsideCData);
else
if (StartsWith("<?"))
return TokenizeSimple("<?", XmlTokenKind.OpenProcessingInstruction, XmlTokenizerMode.InsideProcessingInstruction);
else
if (StartsWith("</"))
return TokenizeSimple("</", XmlTokenKind.OpenClose, XmlTokenizerMode.AfterOpen);
else
return TokenizeSimple("<", XmlTokenKind.Open, XmlTokenizerMode.AfterOpen);
}
private XmlToken TokenizeEntity()
{
Debug.Assert(mode == XmlTokenizerMode.OutsideElement);
Debug.Assert(input[position] == '&');
XmlToken token = new XmlToken(XmlTokenKind.Entity, input.IndexOf(';', position) - position);
position += token.Length;
return token;
}
private XmlToken TokenizeInsideProcessingInstruction()
{
Debug.Assert(mode == XmlTokenizerMode.InsideProcessingInstruction);
int tokenend = input.IndexOf("?>", position);
if (position == tokenend)
{
position += "?>".Length;
mode = XmlTokenizerMode.OutsideElement;
return new XmlToken(XmlTokenKind.CloseProcessingInstruction, "?>".Length);
}
else
{
XmlToken token = new XmlToken(XmlTokenKind.TextContent, tokenend - position);
position = tokenend;
return token;
}
}
private XmlToken TokenizeInsideCData()
{
Debug.Assert(mode == XmlTokenizerMode.InsideCData);
int tokenend = input.IndexOf("]]>", position);
if (position == tokenend)
{
position += "]]>".Length;
mode = XmlTokenizerMode.OutsideElement;
return new XmlToken(XmlTokenKind.CDataEnd, "]]>".Length);
}
else
{
XmlToken token = new XmlToken(XmlTokenKind.TextContent, tokenend - position);
position = tokenend;
return token;
}
}
private XmlToken TokenizeInsideComment()
{
Debug.Assert(mode == XmlTokenizerMode.InsideComment);
int tokenend = input.IndexOf("-->", position);
if (position == tokenend)
{
position += "-->".Length;
mode = XmlTokenizerMode.OutsideElement;
return new XmlToken(XmlTokenKind.CommentEnd, "-->".Length);
}
XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement;
XmlTokenizer tokenizer = new XmlTokenizer();
return tokenizer.Tokenize( input, ref mode );
}
public List<XmlToken> Tokenize( string input, ref XmlTokenizerMode _mode )
{
this.input = input;
this.mode = _mode;
this.position = 0;
List<XmlToken> result = Tokenize();
_mode = this.mode;
return result;
}
private List<XmlToken> Tokenize()
{
List<XmlToken> list = new List<XmlToken>();
XmlToken token;
do
{
int previousPosition = position;
token = NextToken();
string tokenText = input.Substring( previousPosition, token.Length );
list.Add( token );
}
while( token.Kind != XmlTokenKind.EOF );
List<string> strings = TokensToStrings( list, input );
return list;
}
private List<string> TokensToStrings( List<XmlToken> list, string input )
{
List<string> output = new List<string>();
int position = 0;
foreach( XmlToken token in list )
{
output.Add( input.Substring( position, token.Length ) );
position += token.Length;
}
return output;
}
// debugging function
public string RemainingText
{
get
{
return input.Substring( position );
}
}
private XmlToken NextToken()
{
if( position >= input.Length )
return new XmlToken( XmlTokenKind.EOF, 0 );
XmlToken token;
switch( mode )
{
case XmlTokenizerMode.AfterAttributeEquals:
token = TokenizeAttributeValue();
break;
case XmlTokenizerMode.AfterAttributeName:
token = TokenizeSimple( "=", XmlTokenKind.Equals, XmlTokenizerMode.AfterAttributeEquals );
break;
case XmlTokenizerMode.AfterOpen:
token = TokenizeName( XmlTokenKind.ElementName, XmlTokenizerMode.InsideElement );
break;
case XmlTokenizerMode.InsideCData:
token = TokenizeInsideCData();
break;
case XmlTokenizerMode.InsideComment:
token = TokenizeInsideComment();
break;
case XmlTokenizerMode.InsideElement:
token = TokenizeInsideElement();
break;
case XmlTokenizerMode.InsideProcessingInstruction:
token = TokenizeInsideProcessingInstruction();
break;
case XmlTokenizerMode.OutsideElement:
token = TokenizeOutsideElement();
break;
default:
token = new XmlToken( XmlTokenKind.EOF, 0 );
Debug.Fail( "missing case" );
break;
}
return token;
}
private bool IsNameCharacter( char character )
{
// XML rule: Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
bool result = char.IsLetterOrDigit( character ) || character == '.' | character == '-' | character == '_' | character == ':';
return result;
}
private XmlToken TokenizeAttributeValue()
{
Debug.Assert( mode == XmlTokenizerMode.AfterAttributeEquals );
int closePosition = input.IndexOf( input[ position ], position + 1 );
XmlToken token = new XmlToken( XmlTokenKind.AttributeValue, closePosition + 1 - position );
position = closePosition + 1;
mode = XmlTokenizerMode.InsideElement;
return token;
}
private XmlToken TokenizeName( XmlTokenKind kind, XmlTokenizerMode nextMode )
{
Debug.Assert( mode == XmlTokenizerMode.AfterOpen || mode == XmlTokenizerMode.InsideElement );
int i;
for( i = position; i < input.Length; i++ )
if( !IsNameCharacter( input[ i ] ) )
break;
XmlToken token = new XmlToken( kind, i - position );
mode = nextMode;
position = i;
return token;
}
private XmlToken TokenizeElementWhitespace()
{
int i;
for( i = position; i < input.Length; i++ )
if( !char.IsWhiteSpace( input[ i ] ) )
break;
XmlToken token = new XmlToken( XmlTokenKind.ElementWhitespace, i - position );
position = i;
return token;
}
private bool StartsWith( string text )
{
if( position + text.Length > input.Length )
return false;
else
return input.Substring( position, text.Length ) == text;
}
private XmlToken TokenizeInsideElement()
{
if( char.IsWhiteSpace( input[ position ] ) )
return TokenizeElementWhitespace();
else
if( StartsWith( "/>" ) )
return TokenizeSimple( "/>", XmlTokenKind.SelfClose, XmlTokenizerMode.OutsideElement );
else
if( StartsWith( ">" ) )
return TokenizeSimple( ">", XmlTokenKind.Close, XmlTokenizerMode.OutsideElement );
else
return TokenizeName( XmlTokenKind.AttributeName, XmlTokenizerMode.AfterAttributeName );
}
private XmlToken TokenizeText()
{
Debug.Assert( input[ position ] != '<' );
Debug.Assert( input[ position ] != '&' );
Debug.Assert( mode == XmlTokenizerMode.OutsideElement );
int i;
for( i = position; i < input.Length; i++ )
if( input[ i ] == '<' || input[ i ] == '&' )
break;
XmlToken token = new XmlToken( XmlTokenKind.TextContent, i - position );
position = i;
return token;
}
private XmlToken TokenizeOutsideElement()
{
Debug.Assert( mode == XmlTokenizerMode.OutsideElement );
if( position >= input.Length )
return new XmlToken( XmlTokenKind.EOF, 0 );
switch( input[ position ] )
{
case '<':
return TokenizeOpen();
case '&':
return TokenizeEntity();
default:
return TokenizeText();
}
}
private XmlToken TokenizeSimple( string text, XmlTokenKind kind, XmlTokenizerMode nextMode )
{
XmlToken token = new XmlToken( kind, text.Length );
position += text.Length;
mode = nextMode;
return token;
}
private XmlToken TokenizeOpen()
{
Debug.Assert( input[ position ] == '<' );
if( StartsWith( "<!--" ) )
return TokenizeSimple( "<!--", XmlTokenKind.CommentBegin, XmlTokenizerMode.InsideComment );
else
if( StartsWith( "<![CDATA[" ) )
return TokenizeSimple( "<![CDATA[", XmlTokenKind.CDataBegin, XmlTokenizerMode.InsideCData );
else
if( StartsWith( "<?" ) )
return TokenizeSimple( "<?", XmlTokenKind.OpenProcessingInstruction, XmlTokenizerMode.InsideProcessingInstruction );
else
if( StartsWith( "</" ) )
return TokenizeSimple( "</", XmlTokenKind.OpenClose, XmlTokenizerMode.AfterOpen );
else
{
XmlToken token = new XmlToken(XmlTokenKind.CommentText, tokenend - position);
position = tokenend;
return token;
}
}
return TokenizeSimple( "<", XmlTokenKind.Open, XmlTokenizerMode.AfterOpen );
}
// Used so you can restart the tokenizer for the next line of XML
enum XmlTokenizerMode
private XmlToken TokenizeEntity()
{
InsideComment,
InsideProcessingInstruction,
AfterOpen,
AfterAttributeName,
AfterAttributeEquals,
InsideElement,
// after element name, before attribute or />
OutsideElement,
InsideCData
Debug.Assert( mode == XmlTokenizerMode.OutsideElement );
Debug.Assert( input[ position ] == '&' );
XmlToken token = new XmlToken( XmlTokenKind.Entity, input.IndexOf( ';', position ) - position );
position += token.Length;
return token;
}
struct XmlToken
private XmlToken TokenizeInsideProcessingInstruction()
{
Debug.Assert( mode == XmlTokenizerMode.InsideProcessingInstruction );
int tokenend = input.IndexOf( "?>", position );
if( position == tokenend )
{
position += "?>".Length;
mode = XmlTokenizerMode.OutsideElement;
return new XmlToken( XmlTokenKind.CloseProcessingInstruction, "?>".Length );
}
else
{
XmlToken token = new XmlToken( XmlTokenKind.TextContent, tokenend - position );
position = tokenend;
return token;
}
}
private XmlToken TokenizeInsideCData()
{
Debug.Assert( mode == XmlTokenizerMode.InsideCData );
int tokenend = input.IndexOf( "]]>", position );
if( position == tokenend )
{
position += "]]>".Length;
mode = XmlTokenizerMode.OutsideElement;
return new XmlToken( XmlTokenKind.CDataEnd, "]]>".Length );
}
else
{
XmlToken token = new XmlToken( XmlTokenKind.TextContent, tokenend - position );
position = tokenend;
return token;
}
}
private XmlToken TokenizeInsideComment()
{
public XmlTokenKind Kind;
public short Length;
public XmlToken(XmlTokenKind kind, int length)
{
Kind = kind;
Length = (short)length;
}
Debug.Assert( mode == XmlTokenizerMode.InsideComment );
int tokenend = input.IndexOf( "-->", position );
if( position == tokenend )
{
position += "-->".Length;
mode = XmlTokenizerMode.OutsideElement;
return new XmlToken( XmlTokenKind.CommentEnd, "-->".Length );
}
else
{
XmlToken token = new XmlToken( XmlTokenKind.CommentText, tokenend - position );
position = tokenend;
return token;
}
}
}
/*
* this file implements a mostly correct XML tokenizer. The token boundaries
* have been chosen to match Visual Studio syntax highlighting, so a few of
* the boundaries are little weird. (Especially comments) known issues:
*
* Doesn't handle DTD's
* mediocre handling of processing instructions <? ?> -- it won't crash,
* but the token boundaries are wrong
* Doesn't enforce correct XML
* there's probably a few cases where it will die if given in valid XML
*
*
* This tokenizer has been designed to be restartable, so you can tokenize
* one line of XML at a time.
*/
enum XmlTokenKind
// Used so you can restart the tokenizer for the next line of XML
enum XmlTokenizerMode
{
InsideComment,
InsideProcessingInstruction,
AfterOpen,
AfterAttributeName,
AfterAttributeEquals,
InsideElement,
// after element name, before attribute or />
OutsideElement,
InsideCData
}
struct XmlToken
{
public XmlTokenKind Kind;
public short Length;
public XmlToken( XmlTokenKind kind, int length )
{
Open,
// <
Close,
//>
SelfClose,
// />
OpenClose,
// </
ElementName,
ElementWhitespace,
//whitespace between attributes
AttributeName,
Equals,
// inside attribute
AttributeValue,
// attribute value
CommentBegin,
// <!--
CommentText,
CommentEnd,
// -->
Entity,
// &gt;
OpenProcessingInstruction,
// <?
CloseProcessingInstruction,
// ?>
CDataBegin,
// <![CDATA[
CDataEnd,
// ]]>
TextContent,
//WhitespaceContent, // text content that's whitespace. Space is embedded inside
EOF,
// end of file
Kind = kind;
Length = ( short )length;
}
}
/*
* this file implements a mostly correct XML tokenizer. The token boundaries
* have been chosen to match Visual Studio syntax highlighting, so a few of
* the boundaries are little weird. (Especially comments) known issues:
*
* Doesn't handle DTD's
* mediocre handling of processing instructions <? ?> -- it won't crash,
* but the token boundaries are wrong
* Doesn't enforce correct XML
* there's probably a few cases where it will die if given in valid XML
*
*
* This tokenizer has been designed to be restartable, so you can tokenize
* one line of XML at a time.
*/
enum XmlTokenKind
{
Open,
// <
Close,
//>
SelfClose,
// />
OpenClose,
// </
ElementName,
ElementWhitespace,
//whitespace between attributes
AttributeName,
Equals,
// inside attribute
AttributeValue,
// attribute value
CommentBegin,
// <!--
CommentText,
CommentEnd,
// -->
Entity,
// &gt;
OpenProcessingInstruction,
// <?
CloseProcessingInstruction,
// ?>
CDataBegin,
// <![CDATA[
CDataEnd,
// ]]>
TextContent,
//WhitespaceContent, // text content that's whitespace. Space is embedded inside
EOF,
// end of file
}
}

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

Loading…
Cancel
Save