309 changed files with 31481 additions and 23497 deletions
@ -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.Prism.Regions; |
||||
|
using Microsoft.Practices.Unity; |
||||
|
using Samples.Infrastructure; |
||||
using Samples.Infrastructure.Extensions; |
using Samples.Infrastructure.Extensions; |
||||
using Samples.Modules.BusyIndicator.NavigationItems; |
using Samples.Modules.BusyIndicator.NavigationItems; |
||||
using Samples.Modules.BusyIndicator.Views; |
using Samples.Modules.BusyIndicator.Views; |
||||
|
|
||||
namespace Samples.Modules.BusyIndicator |
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) |
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( BusyIndicatorNavItem ) ); |
||||
: 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)); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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:navItems="clr-namespace:Samples.Modules.BusyIndicator.NavigationItems" |
||||
xmlns:views="clr-namespace:Samples.Modules.BusyIndicator.Views" |
xmlns:views="clr-namespace:Samples.Modules.BusyIndicator.Views" |
||||
Header="BusyIndicator" Tag="{x:Type views:BusyIndicatorView}"> |
Header="BusyIndicator" Tag="{x:Type views:BusyIndicatorView}"> |
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="navItems:BusyIndicatorNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="navItems:BusyIndicatorNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</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> |
</TreeViewItem> |
||||
|
|||||
@ -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; |
using System.Windows.Controls; |
||||
|
|
||||
namespace Samples.Modules.BusyIndicator.NavigationItems |
namespace Samples.Modules.BusyIndicator.NavigationItems |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for BusyIndicatorNavItem.xaml
|
/// Interaction logic for BusyIndicatorNavItem.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class BusyIndicatorNavItem : TreeViewItem |
public partial class BusyIndicatorNavItem : TreeViewItem |
||||
|
{ |
||||
|
public BusyIndicatorNavItem() |
||||
{ |
{ |
||||
public BusyIndicatorNavItem() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"> |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"> |
||||
|
|
||||
<DataTemplate x:Key="SampleContent" > |
<DataTemplate x:Key="SampleContent"> |
||||
<Grid Margin="10" > |
<Grid Margin="10"> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto"/> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto"/> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto"/> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto"/> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto"/> |
<RowDefinition Height="Auto" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"/> |
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition Width="*"/> |
<ColumnDefinition Width="*" /> |
||||
</Grid.ColumnDefinitions> |
</Grid.ColumnDefinitions> |
||||
|
|
||||
<TextBlock Grid.Row="0" Text="First Name:" Margin="2" VerticalAlignment="Center" /> |
<TextBlock Grid.Row="0" Text="First Name:" Margin="2" VerticalAlignment="Center" /> |
||||
<extToolkit:WatermarkTextBox Grid.Row="0" Grid.Column="1" Margin="2" VerticalAlignment="Center" Watermark="Enter First Name" /> |
<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" /> |
<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" /> |
<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" /> |
<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" /> |
<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" /> |
<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" /> |
<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" /> |
<TextBlock Grid.Row="4" Text="Favorite Color:" Margin="2" VerticalAlignment="Center" /> |
||||
<extToolkit:ColorPicker Grid.Row="4" Grid.Column="1" 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"> |
<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">OK</Button> |
||||
<Button Width="65" Margin="2">Cancel</Button> |
<Button Width="65" Margin="2">Cancel</Button> |
||||
</StackPanel> |
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</DataTemplate> |
</DataTemplate> |
||||
|
|
||||
</ResourceDictionary> |
</ResourceDictionary> |
||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="BusyIndicator"> |
Title="BusyIndicator"> |
||||
<infControls:DemoView.Resources> |
<infControls:DemoView.Resources> |
||||
<ResourceDictionary> |
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="/Samples.Modules.Busyindicator;component/Resources/Common.xaml" /> |
<ResourceDictionary Source="/Samples.Modules.Busyindicator;component/Resources/Common.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
</ResourceDictionary.MergedDictionaries> |
||||
</ResourceDictionary> |
</ResourceDictionary> |
||||
</infControls:DemoView.Resources> |
</infControls:DemoView.Resources> |
||||
|
|
||||
<Grid> |
<Grid> |
||||
|
|
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="This example demonstrates how to create a custom content template by setting the BusyContentTemplate property to an instance of a custom DataTemplate. Take notice of how the default ProgressBar is being hidden by setting the PrgressBarStyle property. The default OverlayStyle is also being set to a custom style." |
<TextBlock Text="This example demonstrates how to create a custom content template by setting the BusyContentTemplate property to an instance of a custom DataTemplate. Take notice of how the default ProgressBar is being hidden by setting the PrgressBarStyle property. The default OverlayStyle is also being set to a custom style." |
||||
TextWrapping="Wrap" /> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<StackPanel Grid.Row="1" Margin="10"> |
<StackPanel Grid.Row="1" Margin="10"> |
||||
<TextBlock Grid.Row="2" Text="Custom Content Template:" Style="{StaticResource Header}" /> |
<TextBlock Grid.Row="2" Text="Custom Content Template:" Style="{StaticResource Header}" /> |
||||
<extToolkit:BusyIndicator IsBusy="True"> |
<extToolkit:BusyIndicator IsBusy="True"> |
||||
<extToolkit:BusyIndicator.BusyContentTemplate> |
<extToolkit:BusyIndicator.BusyContentTemplate> |
||||
<DataTemplate> |
<DataTemplate> |
||||
<StackPanel Margin="4"> |
<StackPanel Margin="4"> |
||||
<TextBlock Text="Downloading Email" FontWeight="Bold" HorizontalAlignment="Center"/> |
<TextBlock Text="Downloading Email" FontWeight="Bold" HorizontalAlignment="Center" /> |
||||
<StackPanel Margin="4"> |
<StackPanel Margin="4"> |
||||
<TextBlock Text="Downloading message 4/10..."/> |
<TextBlock Text="Downloading message 4/10..." /> |
||||
<ProgressBar Value="40" Height="15"/> |
<ProgressBar Value="40" Height="15" /> |
||||
</StackPanel> |
</StackPanel> |
||||
<Grid> |
<Grid> |
||||
<Grid.ColumnDefinitions> |
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition/> |
<ColumnDefinition/> |
||||
<ColumnDefinition/> |
<ColumnDefinition/> |
||||
</Grid.ColumnDefinitions> |
</Grid.ColumnDefinitions> |
||||
<Button Grid.Column="0" Content="Pause" HorizontalAlignment="Right" Margin="0 0 2 0"/> |
<Button Grid.Column="0" Content="Pause" HorizontalAlignment="Right" Margin="0 0 2 0" /> |
||||
<Button Grid.Column="1" Content="Cancel" HorizontalAlignment="Left" Margin="2 0 0 0"/> |
<Button Grid.Column="1" Content="Cancel" HorizontalAlignment="Left" Margin="2 0 0 0" /> |
||||
</Grid> |
</Grid> |
||||
</StackPanel> |
</StackPanel> |
||||
</DataTemplate> |
</DataTemplate> |
||||
</extToolkit:BusyIndicator.BusyContentTemplate> |
</extToolkit:BusyIndicator.BusyContentTemplate> |
||||
<extToolkit:BusyIndicator.OverlayStyle> |
<extToolkit:BusyIndicator.OverlayStyle> |
||||
<Style TargetType="Rectangle"> |
<Style TargetType="Rectangle"> |
||||
<Setter Property="Fill" Value="#B1EB1D1D"/> |
<Setter Property="Fill" Value="#B1EB1D1D" /> |
||||
</Style> |
</Style> |
||||
</extToolkit:BusyIndicator.OverlayStyle> |
</extToolkit:BusyIndicator.OverlayStyle> |
||||
<extToolkit:BusyIndicator.ProgressBarStyle> |
<extToolkit:BusyIndicator.ProgressBarStyle> |
||||
<Style TargetType="ProgressBar"> |
<Style TargetType="ProgressBar"> |
||||
<Setter Property="Visibility" Value="Collapsed"/> |
<Setter Property="Visibility" Value="Collapsed" /> |
||||
</Style> |
</Style> |
||||
</extToolkit:BusyIndicator.ProgressBarStyle> |
</extToolkit:BusyIndicator.ProgressBarStyle> |
||||
|
|
||||
<ContentControl ContentTemplate="{StaticResource SampleContent}" /> |
<ContentControl ContentTemplate="{StaticResource SampleContent}" /> |
||||
</extToolkit:BusyIndicator> |
</extToolkit:BusyIndicator> |
||||
</StackPanel> |
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|
||||
|
|||||
@ -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 Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.BusyIndicator.Views |
namespace Samples.Modules.BusyIndicator.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for BusyIndicatorCustomContentTemplateView.xaml
|
/// Interaction logic for BusyIndicatorCustomContentTemplateView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive=false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class BusyIndicatorCustomContentTemplateView : DemoView |
public partial class BusyIndicatorCustomContentTemplateView : DemoView |
||||
|
{ |
||||
|
public BusyIndicatorCustomContentTemplateView() |
||||
{ |
{ |
||||
public BusyIndicatorCustomContentTemplateView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="BusyIndicator"> |
Title="BusyIndicator"> |
||||
<infControls:DemoView.Resources> |
<infControls:DemoView.Resources> |
||||
<ResourceDictionary> |
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="/Samples.Modules.Busyindicator;component/Resources/Common.xaml" /> |
<ResourceDictionary Source="/Samples.Modules.Busyindicator;component/Resources/Common.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
</ResourceDictionary.MergedDictionaries> |
||||
</ResourceDictionary> |
</ResourceDictionary> |
||||
</infControls:DemoView.Resources> |
</infControls:DemoView.Resources> |
||||
|
|
||||
<Grid> |
<Grid> |
||||
|
|
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="This example demonstrates how to define your own custom content. This is done by setting the BusyContent property." |
<TextBlock Text="This example demonstrates how to define your own custom content. This is done by setting the BusyContent property." |
||||
TextWrapping="Wrap" /> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<StackPanel Grid.Row="1" Margin="10"> |
<StackPanel Grid.Row="1" Margin="10"> |
||||
<TextBlock Text="Custom Content:" Style="{StaticResource Header}" /> |
<TextBlock Text="Custom Content:" Style="{StaticResource Header}" /> |
||||
<extToolkit:BusyIndicator IsBusy="True"> |
<extToolkit:BusyIndicator IsBusy="True"> |
||||
<extToolkit:BusyIndicator.BusyContent> |
<extToolkit:BusyIndicator.BusyContent> |
||||
<StackPanel Orientation="Horizontal" > |
<StackPanel Orientation="Horizontal"> |
||||
<Image Source="/Samples.Modules.BusyIndicator;component/Images/CdBurning32.png" /> |
<Image Source="/Samples.Modules.BusyIndicator;component/Images/CdBurning32.png" /> |
||||
<StackPanel Margin="5,0"> |
<StackPanel Margin="5,0"> |
||||
<TextBlock Text="Burning CD..." VerticalAlignment="Center" /> |
<TextBlock Text="Burning CD..." VerticalAlignment="Center" /> |
||||
<TextBlock Text="Madonna - Like a Virgin" VerticalAlignment="Center" Margin="8,0" /> |
<TextBlock Text="Madonna - Like a Virgin" VerticalAlignment="Center" Margin="8,0" /> |
||||
</StackPanel> |
</StackPanel> |
||||
</StackPanel> |
</StackPanel> |
||||
</extToolkit:BusyIndicator.BusyContent> |
</extToolkit:BusyIndicator.BusyContent> |
||||
<ContentControl ContentTemplate="{StaticResource SampleContent}" /> |
<ContentControl ContentTemplate="{StaticResource SampleContent}" /> |
||||
</extToolkit:BusyIndicator> |
</extToolkit:BusyIndicator> |
||||
</StackPanel> |
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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 Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.BusyIndicator.Views |
namespace Samples.Modules.BusyIndicator.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for BusyIndicatorCustomContentView.xaml
|
/// Interaction logic for BusyIndicatorCustomContentView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive=false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class BusyIndicatorCustomContentView : DemoView |
public partial class BusyIndicatorCustomContentView : DemoView |
||||
|
{ |
||||
|
public BusyIndicatorCustomContentView() |
||||
{ |
{ |
||||
public BusyIndicatorCustomContentView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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 System.Windows.Data; |
||||
|
using Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.BusyIndicator.Views |
namespace Samples.Modules.BusyIndicator.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for HomeView.xaml
|
/// Interaction logic for HomeView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive=false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class BusyIndicatorView : DemoView |
public partial class BusyIndicatorView : DemoView |
||||
|
{ |
||||
|
public BusyIndicatorView() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public class IntegerToTimespanConverter : IValueConverter |
||||
|
{ |
||||
|
public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) |
||||
{ |
{ |
||||
public BusyIndicatorView() |
return TimeSpan.FromMilliseconds( ( int )value ); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
|
||||
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) |
throw new NotImplementedException(); |
||||
{ |
|
||||
return TimeSpan.FromMilliseconds((int)value); |
|
||||
} |
|
||||
|
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
|
||||
{ |
|
||||
throw new NotImplementedException(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,30 +1,49 @@ |
|||||
using System; |
/************************************************************************ |
||||
using Samples.Infrastructure; |
|
||||
|
Extended WPF Toolkit |
||||
|
|
||||
|
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
using Microsoft.Practices.Unity; |
using Microsoft.Practices.Unity; |
||||
|
using Samples.Infrastructure; |
||||
using Samples.Infrastructure.Extensions; |
using Samples.Infrastructure.Extensions; |
||||
using Samples.Modules.Button.Views; |
|
||||
using Samples.Modules.Button.NavigationItems; |
using Samples.Modules.Button.NavigationItems; |
||||
|
using Samples.Modules.Button.Views; |
||||
|
|
||||
namespace Samples.Modules.Button |
namespace Samples.Modules.Button |
||||
{ |
{ |
||||
public class ButtonModule : ModuleBase |
public class ButtonModule : ModuleBase |
||||
|
{ |
||||
|
public ButtonModule( IUnityContainer container, IRegionManager regionManager ) |
||||
|
: 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) |
Container.RegisterNavigationType( typeof( ButtonSpinnerView ) ); |
||||
: base(container, regionManager) { } |
Container.RegisterNavigationType( typeof( DropDownButtonView ) ); |
||||
|
Container.RegisterNavigationType( typeof( SplitButtonView ) ); |
||||
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)); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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:navItems="clr-namespace:Samples.Modules.Button.NavigationItems" |
||||
xmlns:views="clr-namespace:Samples.Modules.Button.Views" |
xmlns:views="clr-namespace:Samples.Modules.Button.Views" |
||||
Header="ButtonSpinner" Tag="{x:Type views:ButtonSpinnerView}" > |
Header="ButtonSpinner" Tag="{x:Type views:ButtonSpinnerView}" > |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="navItems:ButtonSpinnerNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="navItems:ButtonSpinnerNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -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; |
using System.Windows.Controls; |
||||
|
|
||||
namespace Samples.Modules.Button.NavigationItems |
namespace Samples.Modules.Button.NavigationItems |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for ButtonSpinnerNavItem.xaml
|
/// Interaction logic for ButtonSpinnerNavItem.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class ButtonSpinnerNavItem : TreeViewItem |
public partial class ButtonSpinnerNavItem : TreeViewItem |
||||
|
{ |
||||
|
public ButtonSpinnerNavItem() |
||||
{ |
{ |
||||
public ButtonSpinnerNavItem() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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:navItems="clr-namespace:Samples.Modules.Button.NavigationItems" |
||||
xmlns:views="clr-namespace:Samples.Modules.Button.Views" |
xmlns:views="clr-namespace:Samples.Modules.Button.Views" |
||||
Header="DropDownButton" Tag="{x:Type views:DropDownButtonView}"> |
Header="DropDownButton" Tag="{x:Type views:DropDownButtonView}"> |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="navItems:DropDownButtonNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="navItems:DropDownButtonNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -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; |
using System.Windows.Controls; |
||||
|
|
||||
namespace Samples.Modules.Button.NavigationItems |
namespace Samples.Modules.Button.NavigationItems |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for DropDownButtonNavItem.xaml
|
/// Interaction logic for DropDownButtonNavItem.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class DropDownButtonNavItem : TreeViewItem |
public partial class DropDownButtonNavItem : TreeViewItem |
||||
|
{ |
||||
|
public DropDownButtonNavItem() |
||||
{ |
{ |
||||
public DropDownButtonNavItem() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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:navItems="clr-namespace:Samples.Modules.Button.NavigationItems" |
||||
xmlns:views="clr-namespace:Samples.Modules.Button.Views" |
xmlns:views="clr-namespace:Samples.Modules.Button.Views" |
||||
Header="SplitButton" Tag="{x:Type views:SplitButtonView}"> |
Header="SplitButton" Tag="{x:Type views:SplitButtonView}"> |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="navItems:SplitButtonNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="navItems:SplitButtonNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -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; |
using System.Windows.Controls; |
||||
|
|
||||
namespace Samples.Modules.Button.NavigationItems |
namespace Samples.Modules.Button.NavigationItems |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for SplitButtonNavItem.xaml
|
/// Interaction logic for SplitButtonNavItem.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class SplitButtonNavItem : TreeViewItem |
public partial class SplitButtonNavItem : TreeViewItem |
||||
|
{ |
||||
|
public SplitButtonNavItem() |
||||
{ |
{ |
||||
public SplitButtonNavItem() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="ButtonSpinner"> |
Title="ButtonSpinner"> |
||||
<Grid> |
<Grid> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="The ButtonSpinner control allows you to add button spinners to any element and then respond to the Spin event to manipulate that element. The Spin event lets the developer know which direction the buttons are spinning; SpinDirection.Increase indicates an increment, SpinDirection.Decrease indicates a decrement." |
<TextBlock Text="The ButtonSpinner control allows you to add button spinners to any element and then respond to the Spin event to manipulate that element. The Spin event lets the developer know which direction the buttons are spinning; SpinDirection.Increase indicates an increment, SpinDirection.Decrease indicates a decrement." |
||||
TextWrapping="Wrap" /> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<GroupBox Header="Features" Grid.Row="1" Margin="5" > |
<GroupBox Header="Features" Grid.Row="1" Margin="5"> |
||||
<Grid Margin="5"> |
<Grid Margin="5"> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition Width="*" /> |
<ColumnDefinition Width="*" /> |
||||
</Grid.ColumnDefinitions> |
</Grid.ColumnDefinitions> |
||||
|
|
||||
<TextBlock Text="AllowSpin:" VerticalAlignment="Center" /> |
<TextBlock Text="AllowSpin:" VerticalAlignment="Center" /> |
||||
<CheckBox x:Name="_allowSpin" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="When true allows the ButtonSpinner to perform increment/decrement operations."/> |
<CheckBox x:Name="_allowSpin" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="When true allows the ButtonSpinner to perform increment/decrement operations." /> |
||||
|
|
||||
<TextBlock Text="ShowButtonSpinner:" VerticalAlignment="Center" Grid.Row="1" /> |
<TextBlock Text="ShowButtonSpinner:" VerticalAlignment="Center" Grid.Row="1" /> |
||||
<CheckBox x:Name="_showButtonSpinner" Grid.Row="1" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Gets/Sets the visibility of the button spinners."/> |
<CheckBox x:Name="_showButtonSpinner" Grid.Row="1" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Gets/Sets the visibility of the button spinners." /> |
||||
</Grid> |
</Grid> |
||||
</GroupBox> |
</GroupBox> |
||||
|
|
||||
<StackPanel Grid.Row="2" Margin="10"> |
<StackPanel Grid.Row="2" Margin="10"> |
||||
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> |
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> |
||||
<TextBlock Text="You can wrap any element by placing it inside the content area of the ButtonSpinner control. As an example, lets create our own simple numeric up/down control" |
<TextBlock Text="You can wrap any element by placing it inside the content area of the ButtonSpinner control. As an example, lets create our own simple numeric up/down control" |
||||
TextWrapping="Wrap"/> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<extToolkit:ButtonSpinner Margin="10" Width="150" HorizontalAlignment="Left" |
<extToolkit:ButtonSpinner Margin="10" |
||||
AllowSpin="{Binding IsChecked, ElementName=_allowSpin}" |
Width="150" |
||||
ShowButtonSpinner="{Binding IsChecked, ElementName=_showButtonSpinner}" |
HorizontalAlignment="Left" |
||||
Spin="ButtonSpinner_Spin" > |
AllowSpin="{Binding IsChecked, ElementName=_allowSpin}" |
||||
<TextBox Text="0" BorderThickness="0" HorizontalContentAlignment="Right" /> |
ShowButtonSpinner="{Binding IsChecked, ElementName=_showButtonSpinner}" |
||||
</extToolkit:ButtonSpinner> |
Spin="ButtonSpinner_Spin"> |
||||
</StackPanel> |
<TextBox Text="0" BorderThickness="0" HorizontalContentAlignment="Right" /> |
||||
</Grid> |
</extToolkit:ButtonSpinner> |
||||
|
</StackPanel> |
||||
|
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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.Practices.Prism.Regions; |
||||
using Microsoft.Windows.Controls; |
using Microsoft.Windows.Controls; |
||||
using System.Windows.Controls; |
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.Button.Views |
namespace Samples.Modules.Button.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for ButtonSpinnerView.xaml
|
/// Interaction logic for ButtonSpinnerView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class ButtonSpinnerView : DemoView |
public partial class ButtonSpinnerView : DemoView |
||||
|
{ |
||||
|
public ButtonSpinnerView() |
||||
{ |
{ |
||||
public ButtonSpinnerView() |
InitializeComponent(); |
||||
{ |
} |
||||
InitializeComponent(); |
|
||||
} |
private void ButtonSpinner_Spin( object sender, Microsoft.Windows.Controls.SpinEventArgs e ) |
||||
|
{ |
||||
private void ButtonSpinner_Spin(object sender, Microsoft.Windows.Controls.SpinEventArgs e) |
ButtonSpinner spinner = ( ButtonSpinner )sender; |
||||
{ |
TextBox txtBox = ( TextBox )spinner.Content; |
||||
ButtonSpinner spinner = (ButtonSpinner)sender; |
|
||||
TextBox txtBox = (TextBox)spinner.Content; |
try |
||||
|
{ |
||||
try |
int value = String.IsNullOrEmpty( txtBox.Text ) ? 0 : Convert.ToInt32( txtBox.Text ); |
||||
{ |
if( e.Direction == Microsoft.Windows.Controls.SpinDirection.Increase ) |
||||
int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text); |
value++; |
||||
if (e.Direction == Microsoft.Windows.Controls.SpinDirection.Increase) |
else |
||||
value++; |
value--; |
||||
else |
txtBox.Text = value.ToString(); |
||||
value--; |
} |
||||
txtBox.Text = value.ToString(); |
catch |
||||
} |
{ |
||||
catch |
txtBox.Text = "0"; |
||||
{ |
} |
||||
txtBox.Text = "0"; |
|
||||
} |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="DropDownButton" > |
Title="DropDownButton"> |
||||
<Grid> |
<Grid> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="The DropDownButton control is a button that when clicked displays a drop down in which you can place any custom content within." |
<TextBlock Text="The DropDownButton control is a button that when clicked displays a drop down in which you can place any custom content within." |
||||
TextWrapping="Wrap" /> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<GroupBox Header="Features" Grid.Row="1" Margin="5" > |
<GroupBox Header="Features" Grid.Row="1" Margin="5"> |
||||
<Grid Margin="5"> |
<Grid Margin="5"> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition Width="*" /> |
<ColumnDefinition Width="*" /> |
||||
</Grid.ColumnDefinitions> |
</Grid.ColumnDefinitions> |
||||
|
|
||||
<TextBlock Text="IsOpen: " VerticalAlignment="Center" /> |
<TextBlock Text="IsOpen: " VerticalAlignment="Center" /> |
||||
<CheckBox x:Name="_isOpen" Grid.Column="1" IsChecked="False" VerticalAlignment="Center" Margin="5" ClickMode="Press" ToolTip="Get/Sets a value indicating whether or not the drop down is open." /> |
<CheckBox x:Name="_isOpen" Grid.Column="1" IsChecked="False" VerticalAlignment="Center" Margin="5" ClickMode="Press" ToolTip="Get/Sets a value indicating whether or not the drop down is open." /> |
||||
</Grid> |
</Grid> |
||||
</GroupBox> |
</GroupBox> |
||||
|
|
||||
<StackPanel Grid.Row="2" Margin="10"> |
<StackPanel Grid.Row="2" Margin="10"> |
||||
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> |
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> |
||||
<extToolkit:DropDownButton x:Name="_dropDownButton" Margin="10" Width="150" HorizontalAlignment="Left" Content="Click Me" IsOpen="{Binding IsChecked, ElementName=_isOpen, Mode=TwoWay}" |
<extToolkit:DropDownButton x:Name="_dropDownButton" Margin="10" Width="150" HorizontalAlignment="Left" Content="Click Me" IsOpen="{Binding IsChecked, ElementName=_isOpen, Mode=TwoWay}" |
||||
Click="DropDownButton_Click"> |
Click="DropDownButton_Click"> |
||||
<extToolkit:DropDownButton.DropDownContent> |
<extToolkit:DropDownButton.DropDownContent> |
||||
<StackPanel> |
<StackPanel> |
||||
<extToolkit:ColorCanvas /> |
<extToolkit:ColorCanvas /> |
||||
<Button Click="Button_Click" Margin="10">OK</Button> |
<Button Click="Button_Click" Margin="10">OK</Button> |
||||
</StackPanel> |
</StackPanel> |
||||
</extToolkit:DropDownButton.DropDownContent> |
</extToolkit:DropDownButton.DropDownContent> |
||||
</extToolkit:DropDownButton> |
</extToolkit:DropDownButton> |
||||
</StackPanel> |
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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 Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.Button.Views |
namespace Samples.Modules.Button.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for DropDownButtonView.xaml
|
/// Interaction logic for DropDownButtonView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class DropDownButtonView : DemoView |
public partial class DropDownButtonView : DemoView |
||||
|
{ |
||||
|
public DropDownButtonView() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
} |
||||
|
|
||||
|
private void DropDownButton_Click( object sender, System.Windows.RoutedEventArgs e ) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private void Button_Click( object sender, System.Windows.RoutedEventArgs e ) |
||||
{ |
{ |
||||
public DropDownButtonView() |
_dropDownButton.IsOpen = false; |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void DropDownButton_Click(object sender, System.Windows.RoutedEventArgs e) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
private void Button_Click(object sender, System.Windows.RoutedEventArgs e) |
|
||||
{ |
|
||||
_dropDownButton.IsOpen = false; |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="SplitButton"> |
Title="SplitButton"> |
||||
<Grid> |
<Grid> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within." |
<TextBlock Text="The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within." |
||||
TextWrapping="Wrap" /> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<GroupBox Header="Features" Grid.Row="1" Margin="5" > |
<GroupBox Header="Features" Grid.Row="1" Margin="5"> |
||||
<Grid Margin="5"> |
<Grid Margin="5"> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition Width="*" /> |
<ColumnDefinition Width="*" /> |
||||
</Grid.ColumnDefinitions> |
</Grid.ColumnDefinitions> |
||||
|
|
||||
<TextBlock Text="IsOpen: " VerticalAlignment="Center" /> |
<TextBlock Text="IsOpen: " VerticalAlignment="Center" /> |
||||
<CheckBox x:Name="_isOpen" Grid.Column="1" IsChecked="False" VerticalAlignment="Center" Margin="5" ClickMode="Press" ToolTip="Get/Sets a value indicating whether or not the drop down is open."/> |
<CheckBox x:Name="_isOpen" Grid.Column="1" IsChecked="False" VerticalAlignment="Center" Margin="5" ClickMode="Press" ToolTip="Get/Sets a value indicating whether or not the drop down is open." /> |
||||
</Grid> |
</Grid> |
||||
</GroupBox> |
</GroupBox> |
||||
|
|
||||
<StackPanel Grid.Row="2" Margin="10"> |
<StackPanel Grid.Row="2" Margin="10"> |
||||
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> |
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> |
||||
<extToolkit:SplitButton x:Name="_splitButton" Margin="10" Width="150" HorizontalAlignment="Left" Content="Click Me" IsOpen="{Binding IsChecked, ElementName=_isOpen, Mode=TwoWay}" |
<extToolkit:SplitButton x:Name="_splitButton" Margin="10" Width="150" HorizontalAlignment="Left" Content="Click Me" IsOpen="{Binding IsChecked, ElementName=_isOpen, Mode=TwoWay}" |
||||
Click="SplitButton_Click"> |
Click="SplitButton_Click"> |
||||
<extToolkit:SplitButton.DropDownContent> |
<extToolkit:SplitButton.DropDownContent> |
||||
<StackPanel> |
<StackPanel> |
||||
<extToolkit:ColorCanvas /> |
<extToolkit:ColorCanvas /> |
||||
<Button Click="Button_Click" Margin="10">OK</Button> |
<Button Click="Button_Click" Margin="10">OK</Button> |
||||
</StackPanel> |
</StackPanel> |
||||
</extToolkit:SplitButton.DropDownContent> |
</extToolkit:SplitButton.DropDownContent> |
||||
</extToolkit:SplitButton> |
</extToolkit:SplitButton> |
||||
|
</StackPanel> |
||||
</StackPanel> |
</Grid> |
||||
</Grid> |
|
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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 Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.Button.Views |
namespace Samples.Modules.Button.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for SplitButtonView.xaml
|
/// Interaction logic for SplitButtonView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class SplitButtonView : DemoView |
public partial class SplitButtonView : DemoView |
||||
|
{ |
||||
|
public SplitButtonView() |
||||
|
{ |
||||
|
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() |
_splitButton.IsOpen = false; |
||||
{ |
|
||||
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; |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,28 +1,47 @@ |
|||||
using System; |
/************************************************************************ |
||||
using Samples.Infrastructure; |
|
||||
|
Extended WPF Toolkit |
||||
|
|
||||
|
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
using Microsoft.Practices.Unity; |
using Microsoft.Practices.Unity; |
||||
|
using Samples.Infrastructure; |
||||
using Samples.Infrastructure.Extensions; |
using Samples.Infrastructure.Extensions; |
||||
using Samples.Modules.Calculator.Views; |
|
||||
using Samples.Modules.Calculator.NavigationItems; |
using Samples.Modules.Calculator.NavigationItems; |
||||
|
using Samples.Modules.Calculator.Views; |
||||
|
|
||||
namespace Samples.Modules.Calculator |
namespace Samples.Modules.Calculator |
||||
{ |
{ |
||||
public class CalculatorModule : ModuleBase |
public class CalculatorModule : ModuleBase |
||||
|
{ |
||||
|
public CalculatorModule( IUnityContainer container, IRegionManager regionManager ) |
||||
|
: 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) |
Container.RegisterNavigationType( typeof( CalculatorView ) ); |
||||
: base(container, regionManager) { } |
Container.RegisterNavigationType( typeof( CalculatorUpDownView ) ); |
||||
|
|
||||
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)); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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:navItems="clr-namespace:Samples.Modules.Calculator.NavigationItems" |
||||
xmlns:views="clr-namespace:Samples.Modules.Calculator.Views" |
xmlns:views="clr-namespace:Samples.Modules.Calculator.Views" |
||||
Header="Calculator" Tag="{x:Type views:CalculatorView}" > |
Header="Calculator" Tag="{x:Type views:CalculatorView}"> |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="navItems:CalculatorNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="navItems:CalculatorNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -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; |
using System.Windows.Controls; |
||||
|
|
||||
namespace Samples.Modules.Calculator.NavigationItems |
namespace Samples.Modules.Calculator.NavigationItems |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for CalculatorNavItem.xaml
|
/// Interaction logic for CalculatorNavItem.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class CalculatorNavItem : TreeViewItem |
public partial class CalculatorNavItem : TreeViewItem |
||||
|
{ |
||||
|
public CalculatorNavItem() |
||||
{ |
{ |
||||
public CalculatorNavItem() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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:navItems="clr-namespace:Samples.Modules.Calculator.NavigationItems" |
||||
xmlns:views="clr-namespace:Samples.Modules.Calculator.Views" |
xmlns:views="clr-namespace:Samples.Modules.Calculator.Views" |
||||
Header="CalculatorUpDown" Tag="{x:Type views:CalculatorUpDownView}" > |
Header="CalculatorUpDown" Tag="{x:Type views:CalculatorUpDownView}"> |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="navItems:CalculatorUpDownNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="navItems:CalculatorUpDownNavItem" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -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; |
using System.Windows.Controls; |
||||
|
|
||||
namespace Samples.Modules.Calculator.NavigationItems |
namespace Samples.Modules.Calculator.NavigationItems |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for CalculatorUpDownNavItem.xaml
|
/// Interaction logic for CalculatorUpDownNavItem.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class CalculatorUpDownNavItem : TreeViewItem |
public partial class CalculatorUpDownNavItem : TreeViewItem |
||||
|
{ |
||||
|
public CalculatorUpDownNavItem() |
||||
{ |
{ |
||||
public CalculatorUpDownNavItem() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="CalculatorUpDown"> |
Title="CalculatorUpDown"> |
||||
<Grid> |
<Grid> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations." |
<TextBlock Text="The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations." |
||||
TextWrapping="Wrap" /> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<GroupBox Header="Features" Grid.Row="1" Margin="5" > |
<GroupBox Header="Features" Grid.Row="1" Margin="5"> |
||||
<Grid Margin="5" HorizontalAlignment="Left"> |
<Grid Margin="5" HorizontalAlignment="Left"> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition Width="*" /> |
<ColumnDefinition Width="*" /> |
||||
<ColumnDefinition Width="*" /> |
<ColumnDefinition Width="*" /> |
||||
<ColumnDefinition Width="*" /> |
<ColumnDefinition Width="*" /> |
||||
</Grid.ColumnDefinitions> |
</Grid.ColumnDefinitions> |
||||
<TextBlock Text="Precision: " VerticalAlignment="Center" /> |
<TextBlock Text="Precision: " VerticalAlignment="Center" /> |
||||
<extToolkit:IntegerUpDown x:Name="_precision" Grid.Column="1" Width="75" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Minimum="0" Value="2" ToolTip="Gets/Sets the maximum number of digits displayed to the right of the decimal point." /> |
<extToolkit:IntegerUpDown x:Name="_precision" Grid.Column="1" Width="75" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Minimum="0" Value="2" ToolTip="Gets/Sets the maximum number of digits displayed to the right of the decimal point." /> |
||||
<TextBlock Text="FormatString:" Grid.Row="1" VerticalAlignment="Center"/> |
<TextBlock Text="FormatString:" Grid.Row="1" VerticalAlignment="Center" /> |
||||
<ComboBox x:Name="_formatString" SelectedIndex="0" Grid.Row="1" Grid.Column="1" Width="150" Margin="5"> |
<ComboBox x:Name="_formatString" SelectedIndex="0" Grid.Row="1" Grid.Column="1" Width="150" Margin="5"> |
||||
<ComboBoxItem Tag="C2">Currency</ComboBoxItem> |
<ComboBoxItem Tag="C2">Currency</ComboBoxItem> |
||||
<ComboBoxItem Tag="F2">Fixed Point</ComboBoxItem> |
<ComboBoxItem Tag="F2">Fixed Point</ComboBoxItem> |
||||
<ComboBoxItem Tag="G">General</ComboBoxItem> |
<ComboBoxItem Tag="G">General</ComboBoxItem> |
||||
<ComboBoxItem Tag="N">Number</ComboBoxItem> |
<ComboBoxItem Tag="N">Number</ComboBoxItem> |
||||
<ComboBoxItem Tag="P2">Percent</ComboBoxItem> |
<ComboBoxItem Tag="P2">Percent</ComboBoxItem> |
||||
</ComboBox> |
</ComboBox> |
||||
<TextBlock Text="Watermakr:" Grid.Row="2" VerticalAlignment="Center"/> |
<TextBlock Text="Watermakr:" Grid.Row="2" VerticalAlignment="Center" /> |
||||
<TextBox x:Name="_watermark" Grid.Row="2" Grid.Column="1" Width="150" Margin="5" Text="Enter Value"/> |
<TextBox x:Name="_watermark" Grid.Row="2" Grid.Column="1" Width="150" Margin="5" Text="Enter Value" /> |
||||
<TextBlock Grid.Column="2" Text="Increment" VerticalAlignment="Center" /> |
<TextBlock Grid.Column="2" Text="Increment" VerticalAlignment="Center" /> |
||||
<TextBlock Grid.Column="2" Grid.Row="1" Text="Minimum" VerticalAlignment="Center" /> |
<TextBlock Grid.Column="2" Grid.Row="1" Text="Minimum" VerticalAlignment="Center" /> |
||||
<TextBlock Grid.Column="2" Grid.Row="2" Text="Maximum" VerticalAlignment="Center" /> |
<TextBlock Grid.Column="2" Grid.Row="2" Text="Maximum" VerticalAlignment="Center" /> |
||||
<extToolkit:IntegerUpDown Grid.Column="3" Name="_increment" Minimum="0" Value="1" VerticalAlignment="Center" Margin="5" Width="150" /> |
<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="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" /> |
<extToolkit:IntegerUpDown Grid.Column="3" Grid.Row="2" Name="_maximum" Value="5000" VerticalAlignment="Center" Margin="5" Width="150" /> |
||||
</Grid> |
</Grid> |
||||
</GroupBox> |
</GroupBox> |
||||
|
|
||||
<StackPanel Grid.Row="2" Margin="10" HorizontalAlignment="Left"> |
<StackPanel Grid.Row="2" Margin="10" HorizontalAlignment="Left"> |
||||
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> |
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> |
||||
<extToolkit:CalculatorUpDown Margin="10" Width="250" |
<extToolkit:CalculatorUpDown Margin="10" Width="250" |
||||
Increment="{Binding Value, ElementName=_increment}" |
Increment="{Binding Value, ElementName=_increment}" |
||||
Maximum="{Binding Value, ElementName=_maximum}" |
Maximum="{Binding Value, ElementName=_maximum}" |
||||
Minimum="{Binding Value, ElementName=_minimum}" |
Minimum="{Binding Value, ElementName=_minimum}" |
||||
Precision="{Binding Value, ElementName=_precision}" |
Precision="{Binding Value, ElementName=_precision}" |
||||
FormatString="{Binding SelectedItem.Tag, ElementName=_formatString}" |
FormatString="{Binding SelectedItem.Tag, ElementName=_formatString}" |
||||
Watermark="{Binding Text, ElementName=_watermark}"/> |
Watermark="{Binding Text, ElementName=_watermark}" /> |
||||
</StackPanel> |
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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 Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.Calculator.Views |
namespace Samples.Modules.Calculator.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for CalculatorUpDownView.xaml
|
/// Interaction logic for CalculatorUpDownView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class CalculatorUpDownView : DemoView |
public partial class CalculatorUpDownView : DemoView |
||||
|
{ |
||||
|
public CalculatorUpDownView() |
||||
{ |
{ |
||||
public CalculatorUpDownView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="Calculator"> |
Title="Calculator"> |
||||
<Grid> |
<Grid> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="The Calculator is a control used for performing mathematical calculations." |
<TextBlock Text="The Calculator is a control used for performing mathematical calculations." |
||||
TextWrapping="Wrap" /> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<GroupBox Header="Features" Grid.Row="1" Margin="5" > |
<GroupBox Header="Features" Grid.Row="1" Margin="5"> |
||||
<Grid Margin="5"> |
<Grid Margin="5"> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition Width="*" /> |
<ColumnDefinition Width="*" /> |
||||
</Grid.ColumnDefinitions> |
</Grid.ColumnDefinitions> |
||||
|
|
||||
<TextBlock Text="Precision: " VerticalAlignment="Center" /> |
<TextBlock Text="Precision: " VerticalAlignment="Center" /> |
||||
<extToolkit:IntegerUpDown x:Name="_precision" Grid.Column="1" Width="75" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Minimum="0" Value="2" ToolTip="Gets/Sets the maximum number of digits displayed to the right of the decimal point." /> |
<extToolkit:IntegerUpDown x:Name="_precision" Grid.Column="1" Width="75" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Minimum="0" Value="2" ToolTip="Gets/Sets the maximum number of digits displayed to the right of the decimal point." /> |
||||
</Grid> |
</Grid> |
||||
</GroupBox> |
</GroupBox> |
||||
|
|
||||
<StackPanel Grid.Row="2" Margin="10"> |
<StackPanel Grid.Row="2" Margin="10"> |
||||
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> |
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> |
||||
<TextBlock Text="When the Calculator has focus, you can use the keyboard to interact with the key pad. Click the Calculator to give focus." Margin="10,0"/> |
<TextBlock Text="When the Calculator has focus, you can use the keyboard to interact with the key pad. Click the Calculator to give focus." Margin="10,0" /> |
||||
<extToolkit:Calculator Margin="10" Width="250" Precision="{Binding Value, ElementName=_precision}" /> |
<extToolkit:Calculator Margin="10" Width="250" Precision="{Binding Value, ElementName=_precision}" /> |
||||
</StackPanel> |
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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 Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.Calculator.Views |
namespace Samples.Modules.Calculator.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for CalculatorView.xaml
|
/// Interaction logic for CalculatorView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class CalculatorView : DemoView |
public partial class CalculatorView : DemoView |
||||
|
{ |
||||
|
public CalculatorView() |
||||
{ |
{ |
||||
public CalculatorView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,25 +1,44 @@ |
|||||
using System; |
/************************************************************************ |
||||
using Microsoft.Practices.Unity; |
|
||||
|
Extended WPF Toolkit |
||||
|
|
||||
|
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
|
using Microsoft.Practices.Unity; |
||||
using Samples.Infrastructure; |
using Samples.Infrastructure; |
||||
using Samples.Infrastructure.Extensions; |
using Samples.Infrastructure.Extensions; |
||||
using Samples.Modules.ChildWindow.Views; |
using Samples.Modules.ChildWindow.Views; |
||||
|
|
||||
namespace Samples.Modules.ChildWindow |
namespace Samples.Modules.ChildWindow |
||||
{ |
{ |
||||
public class ChildWindowModule: ModuleBase |
public class ChildWindowModule : ModuleBase |
||||
|
{ |
||||
|
public ChildWindowModule( IUnityContainer container, IRegionManager regionManager ) |
||||
|
: base( container, regionManager ) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
protected override void InitializeModule() |
||||
|
{ |
||||
|
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) ); |
||||
|
} |
||||
|
|
||||
|
protected override void RegisterViewsAndTypes() |
||||
{ |
{ |
||||
public ChildWindowModule(IUnityContainer container, IRegionManager regionManager) |
Container.RegisterNavigationType( typeof( HomeView ) ); |
||||
: base(container, regionManager) { } |
|
||||
|
|
||||
protected override void InitializeModule() |
|
||||
{ |
|
||||
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); |
|
||||
} |
|
||||
|
|
||||
protected override void RegisterViewsAndTypes() |
|
||||
{ |
|
||||
Container.RegisterNavigationType(typeof(HomeView)); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
||||
Title="ChildWindow"> |
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> |
</Grid> |
||||
</GroupBox> |
</extToolkit:ChildWindow> |
||||
|
</Grid> |
||||
<Grid Grid.Row="2" Margin="10"> |
</Grid> |
||||
<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> |
|
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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 Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.ChildWindow.Views |
namespace Samples.Modules.ChildWindow.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for HomeView.xaml
|
/// Interaction logic for HomeView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class HomeView : DemoView |
public partial class HomeView : DemoView |
||||
|
{ |
||||
|
public HomeView() |
||||
{ |
{ |
||||
public HomeView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:views="clr-namespace:Samples.Modules.ChildWindow.Views" |
xmlns:views="clr-namespace:Samples.Modules.ChildWindow.Views" |
||||
Header="ChildWindow" Tag="{x:Type views:HomeView}"> |
Header="ChildWindow" Tag="{x:Type views:HomeView}"> |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -1,27 +1,33 @@ |
|||||
using System; |
/************************************************************************ |
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
Extended WPF Toolkit |
||||
using System.Text; |
|
||||
using System.Windows; |
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using System.Windows.Controls; |
using System.Windows.Controls; |
||||
using System.Windows.Data; |
|
||||
using System.Windows.Documents; |
|
||||
using System.Windows.Input; |
|
||||
using System.Windows.Media; |
|
||||
using System.Windows.Media.Imaging; |
|
||||
using System.Windows.Navigation; |
|
||||
using System.Windows.Shapes; |
|
||||
|
|
||||
namespace Samples.Modules.ChildWindow.Views |
namespace Samples.Modules.ChildWindow.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for NavigationView.xaml
|
/// Interaction logic for NavigationView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class NavigationView : TreeViewItem |
public partial class NavigationView : TreeViewItem |
||||
|
{ |
||||
|
public NavigationView() |
||||
{ |
{ |
||||
public NavigationView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,160 +1,198 @@ |
|||||
using System; |
/************************************************************************ |
||||
using Samples.Infrastructure.Controls; |
|
||||
using Microsoft.Practices.Prism.Regions; |
Extended WPF Toolkit |
||||
using System.ComponentModel; |
|
||||
|
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
using System.Collections.ObjectModel; |
||||
|
using System.ComponentModel; |
||||
|
using Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.Color.Views |
namespace Samples.Modules.Color.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for HomeView.xaml
|
/// Interaction logic for HomeView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class HomeView : DemoView |
public partial class HomeView : DemoView |
||||
|
{ |
||||
|
public HomeView() |
||||
|
{ |
||||
|
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,";
|
if( PropertyChanged != null ) |
||||
public string SelectedValue |
PropertyChanged( this, new PropertyChangedEventArgs( propertyName ) ); |
||||
{ |
|
||||
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)); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
|
|
||||
public class Person : INotifyPropertyChanged |
public class Person : INotifyPropertyChanged |
||||
|
{ |
||||
|
private bool _isSelected; |
||||
|
public bool IsSelected |
||||
{ |
{ |
||||
private bool _isSelected; |
get |
||||
public bool IsSelected |
{ |
||||
{ |
return _isSelected; |
||||
get { return _isSelected; } |
} |
||||
set |
set |
||||
{ |
{ |
||||
_isSelected = value; |
_isSelected = value; |
||||
OnPropertyChanged("IsSelected"); |
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)); |
|
||||
} |
|
||||
} |
} |
||||
|
|
||||
|
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 ) ); |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:views="clr-namespace:Samples.Modules.Color.Views" |
xmlns:views="clr-namespace:Samples.Modules.Color.Views" |
||||
Header="Color" Tag="{x:Type views:HomeView}"> |
Header="Color" Tag="{x:Type views:HomeView}"> |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -1,27 +1,33 @@ |
|||||
using System; |
/************************************************************************ |
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
Extended WPF Toolkit |
||||
using System.Text; |
|
||||
using System.Windows; |
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using System.Windows.Controls; |
using System.Windows.Controls; |
||||
using System.Windows.Data; |
|
||||
using System.Windows.Documents; |
|
||||
using System.Windows.Input; |
|
||||
using System.Windows.Media; |
|
||||
using System.Windows.Media.Imaging; |
|
||||
using System.Windows.Navigation; |
|
||||
using System.Windows.Shapes; |
|
||||
|
|
||||
namespace Samples.Modules.Color.Views |
namespace Samples.Modules.Color.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for NavigationView.xaml
|
/// Interaction logic for NavigationView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class NavigationView : TreeViewItem |
public partial class NavigationView : TreeViewItem |
||||
|
{ |
||||
|
public NavigationView() |
||||
{ |
{ |
||||
public NavigationView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,25 +1,44 @@ |
|||||
using System; |
/************************************************************************ |
||||
using Microsoft.Practices.Unity; |
|
||||
|
Extended WPF Toolkit |
||||
|
|
||||
|
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
|
using Microsoft.Practices.Unity; |
||||
using Samples.Infrastructure; |
using Samples.Infrastructure; |
||||
using Samples.Infrastructure.Extensions; |
using Samples.Infrastructure.Extensions; |
||||
using Samples.Modules.DateTime.Views; |
using Samples.Modules.DateTime.Views; |
||||
|
|
||||
namespace Samples.Modules.DateTime |
namespace Samples.Modules.DateTime |
||||
{ |
{ |
||||
public class DateTimeModule: ModuleBase |
public class DateTimeModule : ModuleBase |
||||
|
{ |
||||
|
public DateTimeModule( IUnityContainer container, IRegionManager regionManager ) |
||||
|
: base( container, regionManager ) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
protected override void InitializeModule() |
||||
|
{ |
||||
|
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) ); |
||||
|
} |
||||
|
|
||||
|
protected override void RegisterViewsAndTypes() |
||||
{ |
{ |
||||
public DateTimeModule(IUnityContainer container, IRegionManager regionManager) |
Container.RegisterNavigationType( typeof( HomeView ) ); |
||||
: base(container, regionManager) { } |
|
||||
|
|
||||
protected override void InitializeModule() |
|
||||
{ |
|
||||
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); |
|
||||
} |
|
||||
|
|
||||
protected override void RegisterViewsAndTypes() |
|
||||
{ |
|
||||
Container.RegisterNavigationType(typeof(HomeView)); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
Title="DateTime Controls"> |
Title="DateTime Controls"> |
||||
<Grid> |
<Grid> |
||||
<extToolkit:DateTimePicker IsReadOnly="False" /> |
<extToolkit:DateTimePicker IsReadOnly="False" /> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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 Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.DateTime.Views |
namespace Samples.Modules.DateTime.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for HomeView.xaml
|
/// Interaction logic for HomeView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class HomeView : DemoView |
public partial class HomeView : DemoView |
||||
|
{ |
||||
|
public HomeView() |
||||
{ |
{ |
||||
public HomeView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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" |
xmlns:views="clr-namespace:Samples.Modules.DateTime.Views" |
||||
Header="DateTime" Tag="{x:Type views:HomeView}"> |
Header="DateTime" Tag="{x:Type views:HomeView}"> |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -1,27 +1,33 @@ |
|||||
using System; |
/************************************************************************ |
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
Extended WPF Toolkit |
||||
using System.Text; |
|
||||
using System.Windows; |
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using System.Windows.Controls; |
using System.Windows.Controls; |
||||
using System.Windows.Data; |
|
||||
using System.Windows.Documents; |
|
||||
using System.Windows.Input; |
|
||||
using System.Windows.Media; |
|
||||
using System.Windows.Media.Imaging; |
|
||||
using System.Windows.Navigation; |
|
||||
using System.Windows.Shapes; |
|
||||
|
|
||||
namespace Samples.Modules.DateTime.Views |
namespace Samples.Modules.DateTime.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for NavigationView.xaml
|
/// Interaction logic for NavigationView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class NavigationView : TreeViewItem |
public partial class NavigationView : TreeViewItem |
||||
|
{ |
||||
|
public NavigationView() |
||||
{ |
{ |
||||
public NavigationView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,25 +1,44 @@ |
|||||
using System; |
/************************************************************************ |
||||
using Microsoft.Practices.Unity; |
|
||||
|
Extended WPF Toolkit |
||||
|
|
||||
|
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
|
using Microsoft.Practices.Unity; |
||||
using Samples.Infrastructure; |
using Samples.Infrastructure; |
||||
using Samples.Infrastructure.Extensions; |
using Samples.Infrastructure.Extensions; |
||||
using Samples.Modules.Numeric.Views; |
using Samples.Modules.Numeric.Views; |
||||
|
|
||||
namespace Samples.Modules.Numeric |
namespace Samples.Modules.Numeric |
||||
{ |
{ |
||||
public class NumericModule: ModuleBase |
public class NumericModule : ModuleBase |
||||
|
{ |
||||
|
public NumericModule( IUnityContainer container, IRegionManager regionManager ) |
||||
|
: base( container, regionManager ) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
protected override void InitializeModule() |
||||
|
{ |
||||
|
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) ); |
||||
|
} |
||||
|
|
||||
|
protected override void RegisterViewsAndTypes() |
||||
{ |
{ |
||||
public NumericModule(IUnityContainer container, IRegionManager regionManager) |
Container.RegisterNavigationType( typeof( HomeView ) ); |
||||
: base(container, regionManager) { } |
|
||||
|
|
||||
protected override void InitializeModule() |
|
||||
{ |
|
||||
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); |
|
||||
} |
|
||||
|
|
||||
protected override void RegisterViewsAndTypes() |
|
||||
{ |
|
||||
Container.RegisterNavigationType(typeof(HomeView)); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
Title="Numeric Controls"> |
Title="Numeric Controls"> |
||||
<Grid> |
<Grid> |
||||
<TextBlock Text="Numeric View" /> |
<TextBlock Text="Numeric View" /> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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 Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.Numeric.Views |
namespace Samples.Modules.Numeric.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for HomeView.xaml
|
/// Interaction logic for HomeView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class HomeView : DemoView |
public partial class HomeView : DemoView |
||||
|
{ |
||||
|
public HomeView() |
||||
{ |
{ |
||||
public HomeView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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" |
xmlns:views="clr-namespace:Samples.Modules.Numeric.Views" |
||||
Header="Numeric" Tag="{x:Type views:HomeView}"> |
Header="Numeric" Tag="{x:Type views:HomeView}"> |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -1,27 +1,33 @@ |
|||||
using System; |
/************************************************************************ |
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
Extended WPF Toolkit |
||||
using System.Text; |
|
||||
using System.Windows; |
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using System.Windows.Controls; |
using System.Windows.Controls; |
||||
using System.Windows.Data; |
|
||||
using System.Windows.Documents; |
|
||||
using System.Windows.Input; |
|
||||
using System.Windows.Media; |
|
||||
using System.Windows.Media.Imaging; |
|
||||
using System.Windows.Navigation; |
|
||||
using System.Windows.Shapes; |
|
||||
|
|
||||
namespace Samples.Modules.Numeric.Views |
namespace Samples.Modules.Numeric.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for NavigationView.xaml
|
/// Interaction logic for NavigationView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class NavigationView : TreeViewItem |
public partial class NavigationView : TreeViewItem |
||||
|
{ |
||||
|
public NavigationView() |
||||
{ |
{ |
||||
public NavigationView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,31 +1,50 @@ |
|||||
using System; |
/************************************************************************ |
||||
using Microsoft.Practices.Unity; |
|
||||
|
Extended WPF Toolkit |
||||
|
|
||||
|
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
|
using Microsoft.Practices.Unity; |
||||
using Samples.Infrastructure; |
using Samples.Infrastructure; |
||||
using Samples.Infrastructure.Extensions; |
using Samples.Infrastructure.Extensions; |
||||
using Samples.Modules.PropertyGrid.Views; |
using Samples.Modules.PropertyGrid.Views; |
||||
|
|
||||
namespace Samples.Modules.PropertyGrid |
namespace Samples.Modules.PropertyGrid |
||||
{ |
{ |
||||
public class PropertyGridModule: ModuleBase |
public class PropertyGridModule : ModuleBase |
||||
|
{ |
||||
|
public PropertyGridModule( IUnityContainer container, IRegionManager regionManager ) |
||||
|
: base( container, regionManager ) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
protected override void InitializeModule() |
||||
|
{ |
||||
|
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) ); |
||||
|
} |
||||
|
|
||||
|
protected override void RegisterViewsAndTypes() |
||||
{ |
{ |
||||
public PropertyGridModule(IUnityContainer container, IRegionManager regionManager) |
Container.RegisterNavigationType( typeof( HomeView ) ); |
||||
: base(container, regionManager) { } |
Container.RegisterNavigationType( typeof( CustomEditors ) ); |
||||
|
Container.RegisterNavigationType( typeof( CustomItemsSource ) ); |
||||
protected override void InitializeModule() |
Container.RegisterNavigationType( typeof( DefaultEditors ) ); |
||||
{ |
Container.RegisterNavigationType( typeof( ExpandableProperties ) ); |
||||
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); |
Container.RegisterNavigationType( typeof( SpecifyingProperties ) ); |
||||
} |
Container.RegisterNavigationType( typeof( BindingToStructs ) ); |
||||
|
|
||||
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)); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
x:Name="_uc"> |
x:Name="_uc"> |
||||
<StackPanel> |
<StackPanel> |
||||
<TextBox Text="{Binding Value, ElementName=_uc}" Background="YellowGreen" /> |
<TextBox Text="{Binding Value, ElementName=_uc}" Background="YellowGreen" /> |
||||
<Button Click="Button_Click">Clear</Button> |
<Button Click="Button_Click">Clear</Button> |
||||
</StackPanel> |
</StackPanel> |
||||
</UserControl> |
</UserControl> |
||||
|
|||||
@ -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 System.Windows.Controls; |
||||
using Microsoft.Windows.Controls.PropertyGrid.Editors; |
|
||||
using System.Windows.Data; |
using System.Windows.Data; |
||||
|
using Microsoft.Windows.Controls.PropertyGrid.Editors; |
||||
|
|
||||
namespace Samples.Modules.PropertyGrid |
namespace Samples.Modules.PropertyGrid |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for LastNameUserControlEditor.xaml
|
/// Interaction logic for LastNameUserControlEditor.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class LastNameUserControlEditor : UserControl, ITypeEditor |
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() |
Binding binding = new Binding( "Value" ); |
||||
{ |
binding.Source = propertyItem; |
||||
InitializeComponent(); |
binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; |
||||
} |
BindingOperations.SetBinding( this, LastNameUserControlEditor.ValueProperty, binding ); |
||||
|
return this; |
||||
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; |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,96 +1,118 @@ |
|||||
using System; |
/************************************************************************ |
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
Extended WPF Toolkit |
||||
using System.Text; |
|
||||
using System.Windows; |
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
using System.Windows.Controls; |
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
|
using System; |
||||
|
using System.ComponentModel; |
||||
using System.Windows.Data; |
using System.Windows.Data; |
||||
using System.Windows.Documents; |
|
||||
using System.Windows.Input; |
|
||||
using System.Windows.Media; |
|
||||
using System.Windows.Media.Imaging; |
|
||||
using System.Windows.Navigation; |
|
||||
using System.Windows.Shapes; |
|
||||
using Samples.Infrastructure.Controls; |
|
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
using System.ComponentModel; |
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.PropertyGrid.Views |
namespace Samples.Modules.PropertyGrid.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for BindingToStructs.xaml
|
/// Interaction logic for BindingToStructs.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class BindingToStructs : DemoView |
public partial class BindingToStructs : DemoView |
||||
|
{ |
||||
|
public BindingToStructs() |
||||
{ |
{ |
||||
public BindingToStructs() |
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; } |
|
||||
|
|
||||
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; |
|
||||
} |
|
||||
} |
|
||||
} |
} |
||||
|
|
||||
public struct Dimension |
public class Person |
||||
{ |
{ |
||||
public double Height; |
[Category( "Information" )] |
||||
public double Weight; |
[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; |
Height = 75.0, |
||||
this.Weight = weight; |
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) |
public class DimensionsConverter : IValueConverter |
||||
{ |
{ |
||||
_originalValue = ((Dimension)value); |
static Dimension _originalValue; // the static struct that stores original value at the start of editing
|
||||
|
|
||||
if (parameter.ToString() == "Height") |
public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) |
||||
return ((Dimension)value).Height; |
{ |
||||
if (parameter.ToString() == "Weight") |
_originalValue = ( ( Dimension )value ); |
||||
return ((Dimension)value).Weight; |
|
||||
|
|
||||
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) |
return _originalValue; |
||||
{ |
} |
||||
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; |
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; |
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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" |
Extended WPF Toolkit |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
|
||||
|
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:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
||||
Title="Custom Editors"> |
Title="Custom Editors"> |
||||
<Grid> |
<Grid> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
|
<TextBlock Text="This example demonstrates the various methods of creating and using custom editors. You can supply your own editor based on a Type, a property name, or both. To supply your own editor for a property you have to create an EditorDefinition for the PropertyGrid." |
||||
|
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." |
<!-- 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. --> |
||||
TextWrapping="Wrap" /> |
<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"> |
</extToolkit:PropertyGrid.EditorDefinitions> |
||||
<TextBlock Text="Custom Editors with a DataTemplate:" Style="{StaticResource Header}" /> |
</extToolkit:PropertyGrid> |
||||
<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"/> |
</StackPanel> |
||||
<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> |
|
||||
|
|
||||
<StackPanel Grid.Row="2" Margin="10"> |
<StackPanel Grid.Row="2" Margin="10"> |
||||
<TextBlock Text="Custom Editors with an Attribute:" Style="{StaticResource Header}" /> |
<TextBlock Text="Custom Editors with an Attribute:" Style="{StaticResource Header}" /> |
||||
<TextBlock Text="You can supply editors for a property by using the System.ComponentModel.EditorAttribute. In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl." TextWrapping="Wrap" /> |
<TextBlock Text="You can supply editors for a property by using the System.ComponentModel.EditorAttribute. In order to provide an editor with an attribute, the editor MUST implement the ITypeEditor interface. Your editor can be a simple class or a complex UserControl." TextWrapping="Wrap" /> |
||||
<extToolkit:PropertyGrid x:Name="_propertyGrid2" Width="450" Margin="10"/> |
<extToolkit:PropertyGrid x:Name="_propertyGrid2" Width="450" Margin="10" /> |
||||
</StackPanel> |
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
using System.Windows; |
using System.Windows; |
||||
using System.Windows.Media; |
|
||||
using System.Windows.Controls; |
using System.Windows.Controls; |
||||
using System.Windows.Data; |
using System.Windows.Data; |
||||
|
using System.Windows.Media; |
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.PropertyGrid.Views |
namespace Samples.Modules.PropertyGrid.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for CustomEditors.xaml
|
/// Interaction logic for CustomEditors.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class CustomEditors : DemoView |
public partial class CustomEditors : DemoView |
||||
|
{ |
||||
|
public CustomEditors() |
||||
{ |
{ |
||||
public CustomEditors() |
InitializeComponent(); |
||||
{ |
_propertyGrid1.SelectedObject = Person.CreatePerson(); |
||||
InitializeComponent(); |
_propertyGrid2.SelectedObject = CustomAttributEditorPerson.CreateCustomAttributEditorPerson(); |
||||
_propertyGrid1.SelectedObject = Person.CreatePerson(); |
} |
||||
_propertyGrid2.SelectedObject = CustomAttributEditorPerson.CreateCustomAttributEditorPerson(); |
|
||||
} |
|
||||
|
|
||||
public class Person |
public class Person |
||||
{ |
{ |
||||
[Category("Information")] |
[Category( "Information" )] |
||||
[DisplayName("First Name")] |
[DisplayName( "First Name" )] |
||||
[Description("This property uses a TextBox as the default editor.")] |
[Description( "This property uses a TextBox as the default editor." )] |
||||
public string FirstName { get; set; } |
public string FirstName |
||||
|
{ |
||||
[Category("Information")] |
get; |
||||
[DisplayName("Last Name")] |
set; |
||||
[Description("This property uses a TextBox as the default editor.")] |
} |
||||
public string LastName { get; set; } |
|
||||
|
[Category( "Information" )] |
||||
[Category("Information")] |
[DisplayName( "Last Name" )] |
||||
[DisplayName("Date of Birth")] |
[Description( "This property uses a TextBox as the default editor." )] |
||||
[Description("This property uses the DateTimeUpDown as the default editor.")] |
public string LastName |
||||
public DateTime DateOfBirth { get; set; } |
{ |
||||
|
get; |
||||
[DisplayName("Grade Point Average")] |
set; |
||||
[Description("This property uses the DoubleUpDown as the default editor.")] |
} |
||||
public double GradePointAvg { get; set; } |
|
||||
|
[Category( "Information" )] |
||||
[Category("Information")] |
[DisplayName( "Date of Birth" )] |
||||
[Description("This property uses the IntegerUpDown as the default editor.")] |
[Description( "This property uses the DateTimeUpDown as the default editor." )] |
||||
public int Age { get; set; } |
public DateTime DateOfBirth |
||||
|
{ |
||||
[Category("Information")] |
get; |
||||
[DisplayName("Is Male")] |
set; |
||||
[Description("This property uses a CheckBox as the default editor.")] |
} |
||||
public bool IsMale { get; set; } |
|
||||
|
[DisplayName( "Grade Point Average" )] |
||||
[Category("Information")] |
[Description( "This property uses the DoubleUpDown as the default editor." )] |
||||
[DisplayName("Favorite Color")] |
public double GradePointAvg |
||||
[Description("This property uses the ColorPicker as the default editor.")] |
{ |
||||
public Color FavoriteColor { get; set; } |
get; |
||||
|
set; |
||||
[Category("Writing")] |
} |
||||
[DisplayName("Writing Hand")] |
|
||||
[Description("This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values")] |
[Category( "Information" )] |
||||
public HorizontalAlignment WritingHand { get; set; } |
[Description( "This property uses the IntegerUpDown as the default editor." )] |
||||
|
public int Age |
||||
[Category("Writing")] |
{ |
||||
[DisplayName("Writing Font")] |
get; |
||||
[Description("This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values")] |
set; |
||||
public FontFamily WritingFont { get; set; } |
} |
||||
|
|
||||
[Category("Writing")] |
[Category( "Information" )] |
||||
[DisplayName("Writing Font Size")] |
[DisplayName( "Is Male" )] |
||||
[Description("This property uses the DoubleUpDown as the default editor.")] |
[Description( "This property uses a CheckBox as the default editor." )] |
||||
public double WritingFontSize { get; set; } |
public bool IsMale |
||||
|
{ |
||||
[Category("Conections")] |
get; |
||||
[DisplayName("Pet Names")] |
set; |
||||
[Description("This property uses the PrimitiveTypeCollectionEditor as the default editor.")] |
} |
||||
public List<String> PetNames { get; set; } |
|
||||
|
[Category( "Information" )] |
||||
[Category("Conections")] |
[DisplayName( "Favorite Color" )] |
||||
[Description("This property uses the CollectionEditor as the default editor.")] |
[Description( "This property uses the ColorPicker as the default editor." )] |
||||
public List<Person> Friends { get; set; } |
public Color FavoriteColor |
||||
|
{ |
||||
[Category("Conections")] |
get; |
||||
[Description("This property is a complex property and has no default editor.")] |
set; |
||||
public Person Spouse { get; set; } |
} |
||||
|
|
||||
public static Person CreatePerson() |
[Category( "Writing" )] |
||||
{ |
[DisplayName( "Writing Hand" )] |
||||
var person = new Person(); |
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )] |
||||
person.FirstName = "John"; |
public HorizontalAlignment WritingHand |
||||
person.LastName = "Doe"; |
{ |
||||
person.DateOfBirth = new DateTime(1975, 1, 23); |
get; |
||||
person.Age = DateTime.Today.Year - person.DateOfBirth.Year; |
set; |
||||
person.GradePointAvg = 3.98; |
} |
||||
person.IsMale = true; |
|
||||
person.FavoriteColor = Colors.Blue; |
[Category( "Writing" )] |
||||
person.WritingHand = System.Windows.HorizontalAlignment.Right; |
[DisplayName( "Writing Font" )] |
||||
person.WritingFont = new FontFamily("Arial"); |
[Description( "This property uses a ComboBox as the default editor. The ComboBox is auto populated with the enum values" )] |
||||
person.WritingFontSize = 12.5; |
public FontFamily WritingFont |
||||
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" } }; |
get; |
||||
person.Spouse = new Person() { FirstName = "Jane", LastName = "Doe" }; |
set; |
||||
return person; |
} |
||||
} |
|
||||
} |
[Category( "Writing" )] |
||||
|
[DisplayName( "Writing Font Size" )] |
||||
public class CustomAttributEditorPerson |
[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")] |
FirstName = "Jane", |
||||
[DisplayName("First Name")] |
LastName = "Doe" |
||||
[Description("This property uses a TextBox as the default editor.")] |
}; |
||||
//This custom editor is a Class that implements the ITypeEditor interface
|
return person; |
||||
[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 CustomAttributEditorPerson |
||||
public class FirstNameEditor : Microsoft.Windows.Controls.PropertyGrid.Editors.ITypeEditor |
|
||||
{ |
{ |
||||
public FrameworkElement ResolveEditor(Microsoft.Windows.Controls.PropertyGrid.PropertyItem propertyItem) |
[Category( "Information" )] |
||||
{ |
[DisplayName( "First Name" )] |
||||
TextBox textBox = new TextBox(); |
[Description( "This property uses a TextBox as the default editor." )] |
||||
textBox.Background = new SolidColorBrush(Colors.Red); |
//This custom editor is a Class that implements the ITypeEditor interface
|
||||
|
[Editor( typeof( FirstNameEditor ), typeof( FirstNameEditor ) )] |
||||
//create the binding from the bound property item to the editor
|
public string FirstName |
||||
var _binding = new Binding("Value"); //bind to the Value property of the PropertyItem
|
{ |
||||
_binding.Source = propertyItem; |
get; |
||||
_binding.ValidatesOnExceptions = true; |
set; |
||||
_binding.ValidatesOnDataErrors = true; |
} |
||||
_binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; |
|
||||
BindingOperations.SetBinding(textBox, TextBox.TextProperty, _binding); |
[Category( "Information" )] |
||||
return textBox; |
[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; |
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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" |
Extended WPF Toolkit |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
|
||||
|
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" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="Custom ItemsSource"> |
Title="Custom ItemsSource"> |
||||
<Grid> |
<Grid> |
||||
|
|
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by create a class that implements IItemsSource and decorating your property with the ItemsSourceAttribute." |
<TextBlock Text="Sometimes it is desirable to want to provide a collection of values represented by a ComboBox for a given property. The PropertyGrid supports this scenario by create a class that implements IItemsSource and decorating your property with the ItemsSourceAttribute." |
||||
TextWrapping="Wrap" /> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<StackPanel Grid.Row="1" Margin="10"> |
<StackPanel Grid.Row="1" Margin="10"> |
||||
<TextBlock Text="Providing a Custom ItemsSource:" Style="{StaticResource Header}" /> |
<TextBlock Text="Providing a Custom ItemsSource:" Style="{StaticResource Header}" /> |
||||
<TextBlock Text="This example uses a collection of Doubles to represent the available options for the WritingFontSize property." TextWrapping="Wrap"/> |
<TextBlock Text="This example uses a collection of Doubles to represent the available options for the WritingFontSize property." TextWrapping="Wrap" /> |
||||
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10"/> |
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" /> |
||||
</StackPanel> |
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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" |
Extended WPF Toolkit |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
|
||||
|
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" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="Default Editors"> |
Title="Default Editors"> |
||||
<Grid> |
<Grid> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="This example demonstrates the default editors provided by the PropertyGrid." |
<TextBlock Text="This example demonstrates the default editors provided by the PropertyGrid." |
||||
TextWrapping="Wrap" /> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<StackPanel Grid.Row="1" Margin="10"> |
<StackPanel Grid.Row="1" Margin="10"> |
||||
<TextBlock Text="Default Editors:" Style="{StaticResource Header}" /> |
<TextBlock Text="Default Editors:" Style="{StaticResource Header}" /> |
||||
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10"/> |
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" /> |
||||
</StackPanel> |
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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; |
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using System.Windows.Media; |
|
||||
using System.ComponentModel; |
using System.ComponentModel; |
||||
using System.Windows; |
using System.Windows; |
||||
|
using System.Windows.Media; |
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.PropertyGrid.Views |
namespace Samples.Modules.PropertyGrid.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for DefaultEditors.xaml
|
/// Interaction logic for DefaultEditors.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class DefaultEditors : DemoView |
public partial class DefaultEditors : DemoView |
||||
|
{ |
||||
|
public DefaultEditors() |
||||
{ |
{ |
||||
public DefaultEditors() |
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")] |
FirstName = "Jane", |
||||
[DisplayName("First Name")] |
LastName = "Doe" |
||||
[Description("This property uses a TextBox as the default editor.")] |
}; |
||||
public string FirstName { get; set; } |
return person; |
||||
|
} |
||||
[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; |
|
||||
} |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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" |
Extended WPF Toolkit |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
|
||||
|
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" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="Exandable Properties"> |
Title="Exandable Properties"> |
||||
<Grid> |
<Grid> |
||||
|
|
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="Sometimes it is neccessary to show the properties of a complex object. The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute." |
<TextBlock Text="Sometimes it is neccessary to show the properties of a complex object. The PropertyGrid supports this scenario and allows you to drill down into a property's heirarchy. To enable this behavior you must decorate your property with the ExpandableObject attribute." |
||||
TextWrapping="Wrap" /> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<StackPanel Grid.Row="1" Margin="10"> |
<StackPanel Grid.Row="1" Margin="10"> |
||||
<TextBlock Text="Expandable Properties:" Style="{StaticResource Header}" /> |
<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" /> |
<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" /> |
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" /> |
||||
</StackPanel> |
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
@ -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.ComponentModel; |
||||
using System.Collections.Generic; |
|
||||
using System; |
|
||||
using System.Windows.Media; |
using System.Windows.Media; |
||||
using System.Windows; |
|
||||
using Microsoft.Windows.Controls.PropertyGrid.Attributes; |
using Microsoft.Windows.Controls.PropertyGrid.Attributes; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.PropertyGrid.Views |
namespace Samples.Modules.PropertyGrid.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for ExpandableProperties.xaml
|
/// Interaction logic for ExpandableProperties.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class ExpandableProperties : DemoView |
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")] |
FirstName = "Jane", |
||||
[DisplayName("First Name")] |
LastName = "Doe" |
||||
[Description("This property uses a TextBox as the default editor.")] |
}; |
||||
public string FirstName { get; set; } |
return person; |
||||
|
} |
||||
[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; |
|
||||
} |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="PropertyGrid" > |
Title="PropertyGrid" > |
||||
<Grid> |
<Grid> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*"/> |
||||
</Grid.RowDefinitions> |
</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." |
<TextBlock Text="Display Sumary:" VerticalAlignment="Center" /> |
||||
TextWrapping="Wrap" /> |
<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" > |
<TextBlock Text="Filter:" VerticalAlignment="Center" Grid.Row="1" /> |
||||
<Grid Margin="5"> |
<extToolkit:WatermarkTextBox x:Name="_filter" |
||||
<Grid.RowDefinitions> |
Grid.Row="1" |
||||
<RowDefinition Height="Auto" /> |
Grid.Column="1" |
||||
<RowDefinition Height="Auto" /> |
Watermark="Search" |
||||
</Grid.RowDefinitions> |
VerticalAlignment="Center" Margin="5" ToolTip="Filters the properties within the PropertyGrid." /> |
||||
<Grid.ColumnDefinitions> |
|
||||
<ColumnDefinition Width="Auto" /> |
|
||||
<ColumnDefinition Width="*" /> |
|
||||
<ColumnDefinition Width="Auto" /> |
|
||||
<ColumnDefinition Width="*" /> |
|
||||
</Grid.ColumnDefinitions> |
|
||||
|
|
||||
<TextBlock Text="Display Sumary:" VerticalAlignment="Center" /> |
<TextBlock Text="Is Categorized:" VerticalAlignment="Center" Grid.Column="2" /> |
||||
<CheckBox x:Name="_displaySummary" Grid.Column="1" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Shows/Hides the summary panel of the PropertyGrid."/> |
<CheckBox x:Name="_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" /> |
<TextBlock Text="Show Advanced Options:" VerticalAlignment="Center" Grid.Row="1" Grid.Column="2" /> |
||||
<extToolkit:WatermarkTextBox x:Name="_filter" Grid.Row="1" Grid.Column="1" |
<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." /> |
||||
Watermark="Search" |
</Grid> |
||||
VerticalAlignment="Center" Margin="5" ToolTip="Filters the properties within the PropertyGrid."/> |
</GroupBox> |
||||
|
|
||||
<TextBlock Text="Is Categorized:" VerticalAlignment="Center" Grid.Column="2" /> |
<StackPanel Grid.Row="2" Margin="10"> |
||||
<CheckBox x:Name="_isCategorized" Grid.Column="3" IsChecked="True" VerticalAlignment="Center" Margin="5" ToolTip="Gets/Sets the layout of the PropertyGrid."/> |
<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" /> |
<Button x:Name="_button" Height="200" Width="200" Margin="25" HorizontalAlignment="Center" VerticalAlignment="Center">Inspect Me</Button> |
||||
<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> |
|
||||
|
|
||||
<StackPanel Grid.Row="2" Margin="10"> |
<extToolkit:PropertyGrid Grid.Column="1" |
||||
<TextBlock Text="Usage:" Style="{StaticResource Header}" /> |
DisplaySummary="{Binding IsChecked, ElementName=_displaySummary}" |
||||
<TextBlock Text="To inspect an object simply set the PropertyGrid.SelectedObject property to an instance of the object you want to inspect." |
Filter="{Binding Text, ElementName=_filter, Mode=TwoWay}" |
||||
TextWrapping="Wrap"/> |
IsCategorized="{Binding IsChecked, ElementName=_isCategorized, Mode=TwoWay}" |
||||
<Grid Height="400" Margin="10" > |
ShowAdvancedOptions="{Binding IsChecked, ElementName=_showAdvancedOptions}" |
||||
<Grid.ColumnDefinitions> |
SelectedObject="{Binding ElementName=_button}" /> |
||||
<ColumnDefinition /> |
</Grid> |
||||
<ColumnDefinition Width="*" /> |
</StackPanel> |
||||
</Grid.ColumnDefinitions> |
</Grid> |
||||
|
|
||||
<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> |
|
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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; |
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.PropertyGrid.Views |
namespace Samples.Modules.PropertyGrid.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for HomeView.xaml
|
/// Interaction logic for HomeView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class HomeView : DemoView |
public partial class HomeView : DemoView |
||||
|
{ |
||||
|
public HomeView() |
||||
{ |
{ |
||||
public HomeView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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" |
xmlns:views="clr-namespace:Samples.Modules.PropertyGrid.Views" |
||||
Header="PropertyGrid" Tag="{x:Type views:HomeView}"> |
Header="PropertyGrid" Tag="{x:Type views:HomeView}"> |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
<TreeViewItem Header="Editors"> |
<TreeViewItem Header="Editors"> |
||||
<TreeViewItem Header="Default Editors" Tag="{x:Type views:DefaultEditors}" /> |
<TreeViewItem Header="Default Editors" Tag="{x:Type views:DefaultEditors}" /> |
||||
<TreeViewItem Header="Custom Editors" Tag="{x:Type views:CustomEditors}"/> |
<TreeViewItem Header="Custom Editors" Tag="{x:Type views:CustomEditors}" /> |
||||
</TreeViewItem> |
</TreeViewItem> |
||||
<TreeViewItem Header="Properties"> |
<TreeViewItem Header="Properties"> |
||||
<TreeViewItem Header="Binding to Structs" Tag="{x:Type views:BindingToStructs}"/> |
<TreeViewItem Header="Binding to Structs" Tag="{x:Type views:BindingToStructs}" /> |
||||
<TreeViewItem Header="Expandable Properties" Tag="{x:Type views:ExpandableProperties}"/> |
<TreeViewItem Header="Expandable Properties" Tag="{x:Type views:ExpandableProperties}" /> |
||||
<TreeViewItem Header="Providing an ItemsSource" Tag="{x:Type views:CustomItemsSource}"/> |
<TreeViewItem Header="Providing an ItemsSource" Tag="{x:Type views:CustomItemsSource}" /> |
||||
<TreeViewItem Header="Specifying Properties" Tag="{x:Type views:SpecifyingProperties}"/> |
<TreeViewItem Header="Specifying Properties" Tag="{x:Type views:SpecifyingProperties}" /> |
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -1,27 +1,33 @@ |
|||||
using System; |
/************************************************************************ |
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
Extended WPF Toolkit |
||||
using System.Text; |
|
||||
using System.Windows; |
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using System.Windows.Controls; |
using System.Windows.Controls; |
||||
using System.Windows.Data; |
|
||||
using System.Windows.Documents; |
|
||||
using System.Windows.Input; |
|
||||
using System.Windows.Media; |
|
||||
using System.Windows.Media.Imaging; |
|
||||
using System.Windows.Navigation; |
|
||||
using System.Windows.Shapes; |
|
||||
|
|
||||
namespace Samples.Modules.PropertyGrid.Views |
namespace Samples.Modules.PropertyGrid.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for NavigationView.xaml
|
/// Interaction logic for NavigationView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class NavigationView : TreeViewItem |
public partial class NavigationView : TreeViewItem |
||||
|
{ |
||||
|
public NavigationView() |
||||
{ |
{ |
||||
public NavigationView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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" |
Extended WPF Toolkit |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
|
||||
|
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" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="Specifying Properties"> |
Title="Specifying Properties"> |
||||
<Grid> |
<Grid> |
||||
|
|
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="By default the propertyGrid will autogenerate all the properties for a given object. You can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show." |
<TextBlock Text="By default the propertyGrid will autogenerate all the properties for a given object. You can override this behavior by setting the AutoGenerateProperties property to False, and then provide a collection of PropertyDefinitions of the properties you would like to show." |
||||
TextWrapping="Wrap" /> |
TextWrapping="Wrap" /> |
||||
|
|
||||
<StackPanel Grid.Row="1" Margin="10"> |
<StackPanel Grid.Row="1" Margin="10"> |
||||
<TextBlock Text="Specifying Properties:" Style="{StaticResource Header}" /> |
<TextBlock Text="Specifying Properties:" Style="{StaticResource Header}" /> |
||||
<extToolkit:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10" |
<extToolkit:PropertyGrid x:Name="_propertyGrid" |
||||
AutoGenerateProperties="False"> |
Width="450" |
||||
<!-- Only the following properties will be displayed in the PropertyGrid --> |
Margin="10" |
||||
<extToolkit:PropertyGrid.PropertyDefinitions> |
AutoGenerateProperties="False"> |
||||
<extToolkit:PropertyDefinition Name="FirstName" /> |
<!-- Only the following properties will be displayed in the PropertyGrid --> |
||||
<extToolkit:PropertyDefinition Name="FavoriteColor" /> |
<extToolkit:PropertyGrid.PropertyDefinitions> |
||||
<extToolkit:PropertyDefinition Name="PetNames" /> |
<extToolkit:PropertyDefinition Name="FirstName" /> |
||||
</extToolkit:PropertyGrid.PropertyDefinitions> |
<extToolkit:PropertyDefinition Name="FavoriteColor" /> |
||||
</extToolkit:PropertyGrid> |
<extToolkit:PropertyDefinition Name="PetNames" /> |
||||
</StackPanel> |
</extToolkit:PropertyGrid.PropertyDefinitions> |
||||
</Grid> |
</extToolkit:PropertyGrid> |
||||
</infControls:DemoView> |
</StackPanel> |
||||
|
</Grid> |
||||
|
</infControls:DemoView> |
||||
|
|||||
@ -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; |
||||
using System.Windows.Media; |
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
using System.Windows; |
using System.Windows; |
||||
|
using System.Windows.Media; |
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.PropertyGrid.Views |
namespace Samples.Modules.PropertyGrid.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for SpecifyingProperties.xaml
|
/// Interaction logic for SpecifyingProperties.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class SpecifyingProperties : DemoView |
public partial class SpecifyingProperties : DemoView |
||||
|
{ |
||||
|
public SpecifyingProperties() |
||||
{ |
{ |
||||
public SpecifyingProperties() |
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")] |
FirstName = "Jane", |
||||
[DisplayName("First Name")] |
LastName = "Doe" |
||||
[Description("This property uses a TextBox as the default editor.")] |
}; |
||||
public string FirstName { get; set; } |
return person; |
||||
|
} |
||||
[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; |
|
||||
} |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,26 +1,45 @@ |
|||||
using System; |
/************************************************************************ |
||||
using Microsoft.Practices.Unity; |
|
||||
|
Extended WPF Toolkit |
||||
|
|
||||
|
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
|
using Microsoft.Practices.Unity; |
||||
using Samples.Infrastructure; |
using Samples.Infrastructure; |
||||
using Samples.Infrastructure.Extensions; |
using Samples.Infrastructure.Extensions; |
||||
using Samples.Modules.Text.Views; |
using Samples.Modules.Text.Views; |
||||
|
|
||||
namespace Samples.Modules.Text |
namespace Samples.Modules.Text |
||||
{ |
{ |
||||
public class TextModule: ModuleBase |
public class TextModule : ModuleBase |
||||
|
{ |
||||
|
public TextModule( IUnityContainer container, IRegionManager regionManager ) |
||||
|
: base( container, regionManager ) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
protected override void InitializeModule() |
||||
|
{ |
||||
|
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) ); |
||||
|
} |
||||
|
|
||||
|
protected override void RegisterViewsAndTypes() |
||||
{ |
{ |
||||
public TextModule(IUnityContainer container, IRegionManager regionManager) |
Container.RegisterNavigationType( typeof( HomeView ) ); |
||||
: base(container, regionManager) { } |
Container.RegisterNavigationType( typeof( WatermarkTextBoxView ) ); |
||||
|
|
||||
protected override void InitializeModule() |
|
||||
{ |
|
||||
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); |
|
||||
} |
|
||||
|
|
||||
protected override void RegisterViewsAndTypes() |
|
||||
{ |
|
||||
Container.RegisterNavigationType(typeof(HomeView)); |
|
||||
Container.RegisterNavigationType(typeof(WatermarkTextBoxView)); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="Text Controls"> |
Title="Text Controls"> |
||||
<Grid> |
<Grid> |
||||
<extToolkit:TokenizedTextBox x:Name="_textBox" |
<extToolkit:TokenizedTextBox x:Name="_textBox" |
||||
DisplayMemberPath="FullName" |
DisplayMemberPath="FullName" |
||||
SearchMemberPath="FirstName" |
SearchMemberPath="FirstName" |
||||
ValueMemberPath="Id" HorizontalAlignment="Center" VerticalAlignment="Center" Width="250" /> |
ValueMemberPath="Id" |
||||
</Grid> |
HorizontalAlignment="Center" |
||||
|
VerticalAlignment="Center" |
||||
|
Width="250" /> |
||||
|
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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 System.Collections.Generic; |
||||
|
using Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.Text.Views |
namespace Samples.Modules.Text.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for HomeView.xaml
|
/// Interaction logic for HomeView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class HomeView : DemoView |
public partial class HomeView : DemoView |
||||
|
{ |
||||
|
public HomeView() |
||||
{ |
{ |
||||
public HomeView() |
InitializeComponent(); |
||||
|
|
||||
|
_textBox.Text = "1;2;"; //is of object ids
|
||||
|
_textBox.ItemsSource = new List<Email>() |
||||
{ |
{ |
||||
InitializeComponent(); |
new Email() { Id = 1, FirstName = "John", LastName = "Doe", EmailAddress = "john@test.com" }, |
||||
|
new Email() { Id = 2, FirstName = "Jane", LastName = "Doe", EmailAddress = "jane@test.com" }, |
||||
_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" }, |
public class Email |
||||
new Email() { Id = 2, FirstName = "Jane", LastName = "Doe", EmailAddress = "jane@test.com" }, |
{ |
||||
}; |
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; } |
return String.Format( "{0}, {1}", LastName, FirstName ); |
||||
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); |
|
||||
} |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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" |
xmlns:views="clr-namespace:Samples.Modules.Text.Views" |
||||
Header="Text" Tag="{x:Type views:HomeView}"> |
Header="Text" Tag="{x:Type views:HomeView}"> |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
<TreeViewItem Header="MaskedTextBox" /> |
<TreeViewItem Header="MaskedTextBox" /> |
||||
<TreeViewItem Header="MultiLineTextEditor" /> |
<TreeViewItem Header="MultiLineTextEditor" /> |
||||
<TreeViewItem Header="RichTextBox" /> |
<TreeViewItem Header="RichTextBox" /> |
||||
<TreeViewItem Header="WatermarkTextBox" Tag="{x:Type views:WatermarkTextBoxView}" /> |
<TreeViewItem Header="WatermarkTextBox" Tag="{x:Type views:WatermarkTextBoxView}" /> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -1,27 +1,33 @@ |
|||||
using System; |
/************************************************************************ |
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
Extended WPF Toolkit |
||||
using System.Text; |
|
||||
using System.Windows; |
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using System.Windows.Controls; |
using System.Windows.Controls; |
||||
using System.Windows.Data; |
|
||||
using System.Windows.Documents; |
|
||||
using System.Windows.Input; |
|
||||
using System.Windows.Media; |
|
||||
using System.Windows.Media.Imaging; |
|
||||
using System.Windows.Navigation; |
|
||||
using System.Windows.Shapes; |
|
||||
|
|
||||
namespace Samples.Modules.Text.Views |
namespace Samples.Modules.Text.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for NavigationView.xaml
|
/// Interaction logic for NavigationView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class NavigationView : TreeViewItem |
public partial class NavigationView : TreeViewItem |
||||
|
{ |
||||
|
public NavigationView() |
||||
{ |
{ |
||||
public NavigationView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
||||
Title="WatermarkTextBox"> |
Title="WatermarkTextBox"> |
||||
<Grid> |
<Grid> |
||||
<Grid.RowDefinitions> |
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="*"/> |
<RowDefinition Height="*" /> |
||||
</Grid.RowDefinitions> |
</Grid.RowDefinitions> |
||||
|
|
||||
<TextBlock Text="The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, usually a String, to represent null or missing text." /> |
<TextBlock Text="The WatermarkTextBox is simply a TextBox that allows you to sepcify an object, usually a String, to represent null or missing text." /> |
||||
|
|
||||
<GroupBox Header="Features" Grid.Row="1" > |
<GroupBox Header="Features" Grid.Row="1"> |
||||
<Grid Margin="5"> |
<Grid Margin="5"> |
||||
<CheckBox x:Name="_selectAll" Content="SelectAllOnGotFocus" VerticalAlignment="Center" Margin="5" ToolTip="Selects all text in the WatermarkTextBox when it receives focus." /> |
<CheckBox x:Name="_selectAll" Content="SelectAllOnGotFocus" VerticalAlignment="Center" Margin="5" ToolTip="Selects all text in the WatermarkTextBox when it receives focus." /> |
||||
</Grid> |
</Grid> |
||||
</GroupBox> |
</GroupBox> |
||||
|
|
||||
<StackPanel Grid.Row="2" Margin="10"> |
<StackPanel Grid.Row="2" Margin="10"> |
||||
<TextBlock Text="Default:" Style="{StaticResource Header}" /> |
<TextBlock Text="Default:" Style="{StaticResource Header}" /> |
||||
<extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" MinWidth="200" Watermark="Enter Text" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}"/> |
<extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" MinWidth="200" Watermark="Enter Text" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}" /> |
||||
|
|
||||
<TextBlock Text="Image Watermark:" Style="{StaticResource Header}" /> |
<TextBlock Text="Image Watermark:" Style="{StaticResource Header}" /> |
||||
<extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}" > |
<extToolkit:WatermarkTextBox Grid.Column="1" Margin="5" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}"> |
||||
<extToolkit:WatermarkTextBox.Watermark> |
<extToolkit:WatermarkTextBox.Watermark> |
||||
<StackPanel Orientation="Horizontal"> |
<StackPanel Orientation="Horizontal"> |
||||
<Image Source="/Samples.Modules.Text;component/Images/PencilTool16.png" Stretch="None" /> |
<Image Source="/Samples.Modules.Text;component/Images/PencilTool16.png" Stretch="None" /> |
||||
<TextBlock Text="Enter Text" Margin="4,0,0,0" /> |
<TextBlock Text="Enter Text" Margin="4,0,0,0" /> |
||||
</StackPanel> |
</StackPanel> |
||||
</extToolkit:WatermarkTextBox.Watermark> |
</extToolkit:WatermarkTextBox.Watermark> |
||||
</extToolkit:WatermarkTextBox> |
</extToolkit:WatermarkTextBox> |
||||
|
|
||||
<TextBlock Grid.Row="2" Text="Custom WatermarkTemplate:" Style="{StaticResource Header}" /> |
<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 Grid.Row="2" Grid.Column="1" Margin="5" Watermark="Enter Text" SelectAllOnGotFocus="{Binding IsChecked, ElementName=_selectAll}"> |
||||
<extToolkit:WatermarkTextBox.WatermarkTemplate> |
<extToolkit:WatermarkTextBox.WatermarkTemplate> |
||||
<DataTemplate> |
<DataTemplate> |
||||
<Border BorderBrush="Green" BorderThickness="1" Padding="5" > |
<Border BorderBrush="Green" BorderThickness="1" Padding="5"> |
||||
<ContentControl Content="{Binding}" Foreground="DarkRed" FontWeight="Bold" Focusable="False" /> |
<ContentControl Content="{Binding}" Foreground="DarkRed" FontWeight="Bold" Focusable="False" /> |
||||
</Border> |
</Border> |
||||
</DataTemplate> |
</DataTemplate> |
||||
</extToolkit:WatermarkTextBox.WatermarkTemplate> |
</extToolkit:WatermarkTextBox.WatermarkTemplate> |
||||
</extToolkit:WatermarkTextBox> |
</extToolkit:WatermarkTextBox> |
||||
</StackPanel> |
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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 Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.Text.Views |
namespace Samples.Modules.Text.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for WatermarkTextBoxView.xaml
|
/// Interaction logic for WatermarkTextBoxView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive=false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class WatermarkTextBoxView : DemoView |
public partial class WatermarkTextBoxView : DemoView |
||||
|
{ |
||||
|
public WatermarkTextBoxView() |
||||
{ |
{ |
||||
public WatermarkTextBoxView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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" |
Extended WPF Toolkit |
||||
xmlns:infControls="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure" |
|
||||
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
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"> |
Title="Wizard"> |
||||
<Grid> |
<Grid> |
||||
<extToolkit:Wizard FinishButtonClosesWindow="True"> |
<extToolkit:Wizard FinishButtonClosesWindow="True"> |
||||
<extToolkit:WizardPage x:Name="IntroPage" |
<extToolkit:WizardPage x:Name="IntroPage" |
||||
Title="Welcome to my Wizard" |
Title="Welcome to my Wizard" |
||||
Description="This Wizard will walk you though how to do something." /> |
Description="This Wizard will walk you though how to do something." /> |
||||
<extToolkit:WizardPage x:Name="Page1" PageType="Interior" |
<extToolkit:WizardPage x:Name="Page1" PageType="Interior" |
||||
Title="Page 1" |
Title="Page 1" |
||||
Description="This is the first page in the process."/> |
Description="This is the first page in the process." /> |
||||
<extToolkit:WizardPage x:Name="Page2" PageType="Interior" |
<extToolkit:WizardPage x:Name="Page2" PageType="Interior" |
||||
Title="Page 2" |
Title="Page 2" |
||||
Description="This is the second page in the process"/> |
Description="This is the second page in the process" /> |
||||
<extToolkit:WizardPage x:Name="LastPage" PageType="Interior" |
<extToolkit:WizardPage x:Name="LastPage" PageType="Interior" |
||||
Title="Last Page" |
Title="Last Page" |
||||
Description="This is the last page in the process" |
Description="This is the last page in the process" |
||||
CanFinish="True"/> |
CanFinish="True" /> |
||||
</extToolkit:Wizard> |
</extToolkit:Wizard> |
||||
</Grid> |
</Grid> |
||||
</infControls:DemoView> |
</infControls:DemoView> |
||||
|
|||||
@ -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 Microsoft.Practices.Prism.Regions; |
||||
|
using Samples.Infrastructure.Controls; |
||||
|
|
||||
namespace Samples.Modules.Wizard.Views |
namespace Samples.Modules.Wizard.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for HomeView.xaml
|
/// Interaction logic for HomeView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
[RegionMemberLifetime(KeepAlive = false)] |
[RegionMemberLifetime( KeepAlive = false )] |
||||
public partial class HomeView : DemoView |
public partial class HomeView : DemoView |
||||
|
{ |
||||
|
public HomeView() |
||||
{ |
{ |
||||
public HomeView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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" |
xmlns:views="clr-namespace:Samples.Modules.Wizard.Views" |
||||
Header="Wizard" Tag="{x:Type views:HomeView}" > |
Header="Wizard" Tag="{x:Type views:HomeView}" > |
||||
|
|
||||
<TreeViewItem.Resources> |
<TreeViewItem.Resources> |
||||
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
<Style TargetType="views:NavigationView" BasedOn="{StaticResource {x:Type TreeViewItem}}" /> |
||||
</TreeViewItem.Resources> |
</TreeViewItem.Resources> |
||||
|
|
||||
</TreeViewItem> |
</TreeViewItem> |
||||
|
|||||
@ -1,27 +1,33 @@ |
|||||
using System; |
/************************************************************************ |
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
Extended WPF Toolkit |
||||
using System.Text; |
|
||||
using System.Windows; |
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using System.Windows.Controls; |
using System.Windows.Controls; |
||||
using System.Windows.Data; |
|
||||
using System.Windows.Documents; |
|
||||
using System.Windows.Input; |
|
||||
using System.Windows.Media; |
|
||||
using System.Windows.Media.Imaging; |
|
||||
using System.Windows.Navigation; |
|
||||
using System.Windows.Shapes; |
|
||||
|
|
||||
namespace Samples.Modules.Wizard.Views |
namespace Samples.Modules.Wizard.Views |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Interaction logic for NavigationView.xaml
|
/// Interaction logic for NavigationView.xaml
|
||||
/// </summary>
|
/// </summary>
|
||||
public partial class NavigationView : TreeViewItem |
public partial class NavigationView : TreeViewItem |
||||
|
{ |
||||
|
public NavigationView() |
||||
{ |
{ |
||||
public NavigationView() |
InitializeComponent(); |
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,25 +1,44 @@ |
|||||
using System; |
/************************************************************************ |
||||
using Samples.Infrastructure; |
|
||||
using Samples.Infrastructure.Extensions; |
Extended WPF Toolkit |
||||
|
|
||||
|
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
|
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
using Microsoft.Practices.Prism.Regions; |
using Microsoft.Practices.Prism.Regions; |
||||
using Microsoft.Practices.Unity; |
using Microsoft.Practices.Unity; |
||||
|
using Samples.Infrastructure; |
||||
|
using Samples.Infrastructure.Extensions; |
||||
using Samples.Modules.Wizard.Views; |
using Samples.Modules.Wizard.Views; |
||||
|
|
||||
namespace Samples.Modules.Wizard |
namespace Samples.Modules.Wizard |
||||
{ |
{ |
||||
public class WizardModule : ModuleBase |
public class WizardModule : ModuleBase |
||||
|
{ |
||||
|
public WizardModule( IUnityContainer container, IRegionManager regionManager ) |
||||
|
: base( container, regionManager ) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
protected override void InitializeModule() |
||||
|
{ |
||||
|
RegionManager.RegisterViewWithRegion( RegionNames.NavigationRegion, typeof( NavigationView ) ); |
||||
|
} |
||||
|
|
||||
|
protected override void RegisterViewsAndTypes() |
||||
{ |
{ |
||||
public WizardModule(IUnityContainer container, IRegionManager regionManager) |
Container.RegisterNavigationType( typeof( HomeView ) ); |
||||
: base(container, regionManager) { } |
|
||||
|
|
||||
protected override void InitializeModule() |
|
||||
{ |
|
||||
RegionManager.RegisterViewWithRegion(RegionNames.NavigationRegion, typeof(NavigationView)); |
|
||||
} |
|
||||
|
|
||||
protected override void RegisterViewsAndTypes() |
|
||||
{ |
|
||||
Container.RegisterNavigationType(typeof(HomeView)); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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; |
||||
|
using System.Windows.Controls; |
||||
|
using Microsoft.Practices.Prism.Commands; |
||||
|
|
||||
namespace Samples.Infrastructure.Commands |
namespace Samples.Infrastructure.Commands |
||||
{ |
{ |
||||
public class TreeViewCommandBehavior : CommandBehaviorBase<TreeView> |
public class TreeViewCommandBehavior : CommandBehaviorBase<TreeView> |
||||
|
{ |
||||
|
public TreeViewCommandBehavior( TreeView treeView ) |
||||
|
: base( treeView ) |
||||
|
{ |
||||
|
treeView.SelectedItemChanged += SelectedItemChanged; |
||||
|
} |
||||
|
|
||||
|
void SelectedItemChanged( object sender, RoutedPropertyChangedEventArgs<object> e ) |
||||
{ |
{ |
||||
public TreeViewCommandBehavior(TreeView treeView) |
//This treeview command is specfic to the navigation region,
|
||||
: base(treeView) |
//so I always want to pass the tag of the selected treeviewitem
|
||||
{ |
//because it will conatin the Type of view to navigate to.
|
||||
treeView.SelectedItemChanged += SelectedItemChanged; |
var type = ( e.NewValue as FrameworkElement ).Tag as Type; |
||||
} |
CommandParameter = type != null ? type.FullName : null; |
||||
|
ExecuteCommand(); |
||||
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(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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; |
||||
using System.Windows.Controls; |
using System.Windows.Controls; |
||||
using System.Windows.Input; |
using System.Windows.Input; |
||||
|
|
||||
namespace Samples.Infrastructure.Commands |
namespace Samples.Infrastructure.Commands |
||||
{ |
{ |
||||
public class TreeViewSelected |
public class TreeViewSelected |
||||
{ |
{ |
||||
private static readonly DependencyProperty SelectedCommandBehaviorProperty = DependencyProperty.RegisterAttached("SelectedCommandBehavior", typeof(TreeViewCommandBehavior), typeof(TreeViewSelected), null); |
private static readonly DependencyProperty SelectedCommandBehaviorProperty = DependencyProperty.RegisterAttached( "SelectedCommandBehavior", typeof( TreeViewCommandBehavior ), typeof( TreeViewSelected ), null ); |
||||
|
|
||||
public static readonly DependencyProperty CommandProperty = DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(TreeViewSelected), new PropertyMetadata(OnSetCommandCallback)); |
public static readonly DependencyProperty CommandProperty = DependencyProperty.RegisterAttached( "Command", typeof( ICommand ), typeof( TreeViewSelected ), new PropertyMetadata( OnSetCommandCallback ) ); |
||||
public static void SetCommand(TreeView menuItem, ICommand command) |
public static void SetCommand( TreeView menuItem, ICommand command ) |
||||
{ |
{ |
||||
menuItem.SetValue(CommandProperty, command); |
menuItem.SetValue( CommandProperty, command ); |
||||
} |
} |
||||
public static ICommand GetCommand(TreeView menuItem) |
public static ICommand GetCommand( TreeView menuItem ) |
||||
{ |
{ |
||||
return menuItem.GetValue(CommandProperty) as ICommand; |
return menuItem.GetValue( CommandProperty ) as ICommand; |
||||
} |
} |
||||
|
|
||||
public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.RegisterAttached("CommandParameter", typeof(object), typeof(TreeViewSelected), new PropertyMetadata(OnSetCommandParameterCallback)); |
public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.RegisterAttached( "CommandParameter", typeof( object ), typeof( TreeViewSelected ), new PropertyMetadata( OnSetCommandParameterCallback ) ); |
||||
public static void SetCommandParameter(TreeView menuItem, object parameter) |
public static void SetCommandParameter( TreeView menuItem, object parameter ) |
||||
{ |
{ |
||||
menuItem.SetValue(CommandParameterProperty, parameter); |
menuItem.SetValue( CommandParameterProperty, parameter ); |
||||
} |
} |
||||
public static object GetCommandParameter(TreeView menuItem) |
public static object GetCommandParameter( TreeView menuItem ) |
||||
{ |
{ |
||||
return menuItem.GetValue(CommandParameterProperty); |
return menuItem.GetValue( CommandParameterProperty ); |
||||
} |
} |
||||
|
|
||||
private static void OnSetCommandCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) |
private static void OnSetCommandCallback( DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e ) |
||||
{ |
{ |
||||
TreeView menuItem = dependencyObject as TreeView; |
TreeView menuItem = dependencyObject as TreeView; |
||||
if (menuItem != null) |
if( menuItem != null ) |
||||
{ |
{ |
||||
TreeViewCommandBehavior behavior = GetOrCreateBehavior(menuItem); |
TreeViewCommandBehavior behavior = GetOrCreateBehavior( menuItem ); |
||||
behavior.Command = e.NewValue as ICommand; |
behavior.Command = e.NewValue as ICommand; |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
private static void OnSetCommandParameterCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) |
private static void OnSetCommandParameterCallback( DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e ) |
||||
{ |
{ |
||||
TreeView menuItem = dependencyObject as TreeView; |
TreeView menuItem = dependencyObject as TreeView; |
||||
if (menuItem != null) |
if( menuItem != null ) |
||||
{ |
{ |
||||
TreeViewCommandBehavior behavior = GetOrCreateBehavior(menuItem); |
TreeViewCommandBehavior behavior = GetOrCreateBehavior( menuItem ); |
||||
behavior.CommandParameter = e.NewValue; |
behavior.CommandParameter = e.NewValue; |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
private static TreeViewCommandBehavior GetOrCreateBehavior(TreeView menuItem) |
private static TreeViewCommandBehavior GetOrCreateBehavior( TreeView menuItem ) |
||||
{ |
{ |
||||
TreeViewCommandBehavior behavior = menuItem.GetValue(SelectedCommandBehaviorProperty) as TreeViewCommandBehavior; |
TreeViewCommandBehavior behavior = menuItem.GetValue( SelectedCommandBehaviorProperty ) as TreeViewCommandBehavior; |
||||
if (behavior == null) |
if( behavior == null ) |
||||
{ |
{ |
||||
behavior = new TreeViewCommandBehavior(menuItem); |
behavior = new TreeViewCommandBehavior( menuItem ); |
||||
menuItem.SetValue(SelectedCommandBehaviorProperty, behavior); |
menuItem.SetValue( SelectedCommandBehaviorProperty, behavior ); |
||||
} |
} |
||||
|
|
||||
return behavior; |
return behavior; |
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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; |
||||
using System.Windows.Controls; |
using System.Windows.Controls; |
||||
using System.IO; |
|
||||
|
|
||||
namespace Samples.Infrastructure.Controls |
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
|
_applicationPath = Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location ); |
||||
|
|
||||
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
|
|
||||
} |
} |
||||
|
|
||||
|
#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
|
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,43 +1,58 @@ |
|||||
using System; |
/************************************************************************ |
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
Extended WPF Toolkit |
||||
using System.Text; |
|
||||
using System.Windows.Data; |
Copyright (C) 2010-2012 Xceed Software Inc. |
||||
using Samples.Infrastructure.Core.CodeFormatting; |
|
||||
|
This program is provided to you under the terms of the Microsoft Reciprocal |
||||
|
License (Ms-RL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
|
||||
|
This program can be provided to you by Xceed Software Inc. under a |
||||
|
proprietary commercial license agreement for use in non-Open Source |
||||
|
projects. The commercial version of Extended WPF Toolkit also includes |
||||
|
priority technical support, commercial updates, and many additional |
||||
|
useful WPF controls if you license Xceed Business Suite for WPF. |
||||
|
|
||||
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
||||
|
|
||||
|
**********************************************************************/ |
||||
|
using System; |
||||
using System.Windows.Controls; |
using System.Windows.Controls; |
||||
|
using System.Windows.Data; |
||||
using System.Windows.Documents; |
using System.Windows.Documents; |
||||
using System.Windows.Media; |
using System.Windows.Media; |
||||
|
using Samples.Infrastructure.Core.CodeFormatting; |
||||
|
|
||||
namespace Samples.Infrastructure.Converters |
namespace Samples.Infrastructure.Converters |
||||
{ |
{ |
||||
public class CSharpColorConverter : IValueConverter |
public class CSharpColorConverter : IValueConverter |
||||
|
{ |
||||
|
public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) |
||||
|
{ |
||||
|
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) |
throw new NotImplementedException(); |
||||
{ |
|
||||
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(); |
|
||||
} |
|
||||
} |
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -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.Collections.Generic; |
||||
|
using System.Windows.Controls; |
||||
using System.Windows.Data; |
using System.Windows.Data; |
||||
using System.Windows.Media; |
|
||||
using System.Windows.Documents; |
using System.Windows.Documents; |
||||
using System.Windows.Controls; |
using System.Windows.Media; |
||||
using Samples.Infrastructure.Core.CodeFormatting; |
using Samples.Infrastructure.Core.CodeFormatting; |
||||
|
|
||||
namespace Samples.Infrastructure.Converters |
namespace Samples.Infrastructure.Converters |
||||
{ |
{ |
||||
public class XamlColorConverter : IValueConverter |
public class XamlColorConverter : IValueConverter |
||||
|
{ |
||||
|
public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) |
||||
|
{ |
||||
|
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) |
Color color = Color.FromRgb( 0, 0, 0 ); |
||||
{ |
switch( token.Kind ) |
||||
if (value == null) |
{ |
||||
return value; |
case XmlTokenKind.Open: |
||||
|
case XmlTokenKind.OpenClose: |
||||
string xaml = value as string; |
case XmlTokenKind.Close: |
||||
|
case XmlTokenKind.SelfClose: |
||||
FlowDocument doc = new FlowDocument(); |
case XmlTokenKind.CommentBegin: |
||||
ColorizeXAML(xaml, doc); |
case XmlTokenKind.CommentEnd: |
||||
|
case XmlTokenKind.CDataBegin: |
||||
RichTextBox rtb = new RichTextBox(); |
case XmlTokenKind.CDataEnd: |
||||
rtb.IsReadOnly = true; |
case XmlTokenKind.Equals: |
||||
rtb.Document = doc; |
case XmlTokenKind.OpenProcessingInstruction: |
||||
rtb.Document.PageWidth = 2500.0; |
case XmlTokenKind.CloseProcessingInstruction: |
||||
rtb.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; |
case XmlTokenKind.AttributeValue: |
||||
rtb.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; |
color = Color.FromRgb( 0, 0, 255 ); |
||||
rtb.FontFamily = new FontFamily("Courier New"); |
// color = "blue";
|
||||
return rtb; |
break; |
||||
} |
case XmlTokenKind.ElementName: |
||||
|
color = Color.FromRgb( 163, 21, 21 ); |
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
// color = "brown";
|
||||
{ |
break; |
||||
throw new NotImplementedException(); |
case XmlTokenKind.TextContent: |
||||
} |
// color = "black";
|
||||
|
break; |
||||
#region SyntaxColoring
|
case XmlTokenKind.AttributeName: |
||||
|
case XmlTokenKind.Entity: |
||||
#region ColorizeXAML
|
color = Color.FromRgb( 255, 0, 0 ); |
||||
|
// color = "red";
|
||||
public void ColorizeXAML(string xamlText, FlowDocument targetDoc) |
break; |
||||
{ |
case XmlTokenKind.CommentText: |
||||
XmlTokenizer tokenizer = new XmlTokenizer(); |
color = Color.FromRgb( 0, 128, 0 ); |
||||
XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement; |
// color = "green";
|
||||
|
break; |
||||
List<XmlToken> tokens = tokenizer.Tokenize(xamlText, ref mode); |
} |
||||
List<string> tokenTexts = new List<string>(tokens.Count); |
if( token.Kind == XmlTokenKind.ElementWhitespace |
||||
List<Color> colors = new List<Color>(tokens.Count); |
|| ( token.Kind == XmlTokenKind.TextContent && tokenText.Trim() == "" ) ) |
||||
int position = 0; |
{ |
||||
foreach (XmlToken token in tokens) |
// color = null;
|
||||
{ |
} |
||||
string tokenText = xamlText.Substring(position, token.Length); |
return color; |
||||
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
|
|
||||
} |
} |
||||
|
#endregion SyntaxColoring
|
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,351 +1,350 @@ |
|||||
//Author: Nick Kramer [MSFT]
|
//Author: Nick Kramer [MSFT]
|
||||
//Source: http://blogs.msdn.com/b/nickkramer/archive/2006/09/22/766934.aspx
|
//Source: http://blogs.msdn.com/b/nickkramer/archive/2006/09/22/766934.aspx
|
||||
|
|
||||
using System; |
|
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using System.Diagnostics; |
using System.Diagnostics; |
||||
|
|
||||
namespace Samples.Infrastructure.Core.CodeFormatting |
namespace Samples.Infrastructure.Core.CodeFormatting |
||||
{ |
{ |
||||
// XML tokenizer, tokens are designed to match Visual Studio syntax highlighting
|
// XML tokenizer, tokens are designed to match Visual Studio syntax highlighting
|
||||
class XmlTokenizer |
class XmlTokenizer |
||||
|
{ |
||||
|
private string input; |
||||
|
private int position = 0; |
||||
|
private XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement; |
||||
|
public static List<XmlToken> Tokenize( string input ) |
||||
{ |
{ |
||||
private string input; |
XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement; |
||||
private int position = 0; |
XmlTokenizer tokenizer = new XmlTokenizer(); |
||||
private XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement; |
return tokenizer.Tokenize( input, ref mode ); |
||||
public static List<XmlToken> Tokenize(string input) |
} |
||||
{ |
public List<XmlToken> Tokenize( string input, ref XmlTokenizerMode _mode ) |
||||
XmlTokenizerMode mode = XmlTokenizerMode.OutsideElement; |
{ |
||||
XmlTokenizer tokenizer = new XmlTokenizer(); |
this.input = input; |
||||
return tokenizer.Tokenize(input, ref mode); |
this.mode = _mode; |
||||
} |
this.position = 0; |
||||
public List<XmlToken> Tokenize(string input, ref XmlTokenizerMode _mode) |
List<XmlToken> result = Tokenize(); |
||||
{ |
_mode = this.mode; |
||||
this.input = input; |
return result; |
||||
this.mode = _mode; |
} |
||||
this.position = 0; |
private List<XmlToken> Tokenize() |
||||
List<XmlToken> result = Tokenize(); |
{ |
||||
_mode = this.mode; |
List<XmlToken> list = new List<XmlToken>(); |
||||
return result; |
XmlToken token; |
||||
} |
do |
||||
private List<XmlToken> Tokenize() |
{ |
||||
{ |
int previousPosition = position; |
||||
List<XmlToken> list = new List<XmlToken>(); |
token = NextToken(); |
||||
XmlToken token; |
string tokenText = input.Substring( previousPosition, token.Length ); |
||||
do |
list.Add( token ); |
||||
{ |
} |
||||
int previousPosition = position; |
while( token.Kind != XmlTokenKind.EOF ); |
||||
token = NextToken(); |
List<string> strings = TokensToStrings( list, input ); |
||||
string tokenText = input.Substring(previousPosition, token.Length); |
return list; |
||||
list.Add(token); |
} |
||||
} |
private List<string> TokensToStrings( List<XmlToken> list, string input ) |
||||
while (token.Kind != XmlTokenKind.EOF); |
{ |
||||
List<string> strings = TokensToStrings(list, input); |
List<string> output = new List<string>(); |
||||
return list; |
int position = 0; |
||||
} |
foreach( XmlToken token in list ) |
||||
private List<string> TokensToStrings(List<XmlToken> list, string input) |
{ |
||||
{ |
output.Add( input.Substring( position, token.Length ) ); |
||||
List<string> output = new List<string>(); |
position += token.Length; |
||||
int position = 0; |
} |
||||
foreach (XmlToken token in list) |
return output; |
||||
{ |
} |
||||
output.Add(input.Substring(position, token.Length)); |
// debugging function
|
||||
position += token.Length; |
public string RemainingText |
||||
} |
{ |
||||
return output; |
get |
||||
} |
{ |
||||
// debugging function
|
return input.Substring( position ); |
||||
public string RemainingText |
} |
||||
{ |
} |
||||
get |
private XmlToken NextToken() |
||||
{ |
{ |
||||
return input.Substring(position); |
if( position >= input.Length ) |
||||
} |
return new XmlToken( XmlTokenKind.EOF, 0 ); |
||||
} |
XmlToken token; |
||||
private XmlToken NextToken() |
switch( mode ) |
||||
{ |
{ |
||||
if (position >= input.Length) |
case XmlTokenizerMode.AfterAttributeEquals: |
||||
return new XmlToken(XmlTokenKind.EOF, 0); |
token = TokenizeAttributeValue(); |
||||
XmlToken token; |
break; |
||||
switch (mode) |
case XmlTokenizerMode.AfterAttributeName: |
||||
{ |
token = TokenizeSimple( "=", XmlTokenKind.Equals, XmlTokenizerMode.AfterAttributeEquals ); |
||||
case XmlTokenizerMode.AfterAttributeEquals: |
break; |
||||
token = TokenizeAttributeValue(); |
case XmlTokenizerMode.AfterOpen: |
||||
break; |
token = TokenizeName( XmlTokenKind.ElementName, XmlTokenizerMode.InsideElement ); |
||||
case XmlTokenizerMode.AfterAttributeName: |
break; |
||||
token = TokenizeSimple("=", XmlTokenKind.Equals, XmlTokenizerMode.AfterAttributeEquals); |
case XmlTokenizerMode.InsideCData: |
||||
break; |
token = TokenizeInsideCData(); |
||||
case XmlTokenizerMode.AfterOpen: |
break; |
||||
token = TokenizeName(XmlTokenKind.ElementName, XmlTokenizerMode.InsideElement); |
case XmlTokenizerMode.InsideComment: |
||||
break; |
token = TokenizeInsideComment(); |
||||
case XmlTokenizerMode.InsideCData: |
break; |
||||
token = TokenizeInsideCData(); |
case XmlTokenizerMode.InsideElement: |
||||
break; |
token = TokenizeInsideElement(); |
||||
case XmlTokenizerMode.InsideComment: |
break; |
||||
token = TokenizeInsideComment(); |
case XmlTokenizerMode.InsideProcessingInstruction: |
||||
break; |
token = TokenizeInsideProcessingInstruction(); |
||||
case XmlTokenizerMode.InsideElement: |
break; |
||||
token = TokenizeInsideElement(); |
case XmlTokenizerMode.OutsideElement: |
||||
break; |
token = TokenizeOutsideElement(); |
||||
case XmlTokenizerMode.InsideProcessingInstruction: |
break; |
||||
token = TokenizeInsideProcessingInstruction(); |
default: |
||||
break; |
token = new XmlToken( XmlTokenKind.EOF, 0 ); |
||||
case XmlTokenizerMode.OutsideElement: |
Debug.Fail( "missing case" ); |
||||
token = TokenizeOutsideElement(); |
break; |
||||
break; |
} |
||||
default: |
return token; |
||||
token = new XmlToken(XmlTokenKind.EOF, 0); |
} |
||||
Debug.Fail("missing case"); |
private bool IsNameCharacter( char character ) |
||||
break; |
{ |
||||
} |
// XML rule: Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
|
||||
return token; |
bool result = char.IsLetterOrDigit( character ) || character == '.' | character == '-' | character == '_' | character == ':'; |
||||
} |
return result; |
||||
private bool IsNameCharacter(char character) |
} |
||||
{ |
private XmlToken TokenizeAttributeValue() |
||||
// XML rule: Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
|
{ |
||||
bool result = char.IsLetterOrDigit(character) || character == '.' | character == '-' | character == '_' | character == ':'; |
Debug.Assert( mode == XmlTokenizerMode.AfterAttributeEquals ); |
||||
return result; |
int closePosition = input.IndexOf( input[ position ], position + 1 ); |
||||
} |
XmlToken token = new XmlToken( XmlTokenKind.AttributeValue, closePosition + 1 - position ); |
||||
private XmlToken TokenizeAttributeValue() |
position = closePosition + 1; |
||||
{ |
mode = XmlTokenizerMode.InsideElement; |
||||
Debug.Assert(mode == XmlTokenizerMode.AfterAttributeEquals); |
return token; |
||||
int closePosition = input.IndexOf(input[position], position + 1); |
} |
||||
XmlToken token = new XmlToken(XmlTokenKind.AttributeValue, closePosition + 1 - position); |
private XmlToken TokenizeName( XmlTokenKind kind, XmlTokenizerMode nextMode ) |
||||
position = closePosition + 1; |
{ |
||||
mode = XmlTokenizerMode.InsideElement; |
Debug.Assert( mode == XmlTokenizerMode.AfterOpen || mode == XmlTokenizerMode.InsideElement ); |
||||
return token; |
int i; |
||||
} |
for( i = position; i < input.Length; i++ ) |
||||
private XmlToken TokenizeName(XmlTokenKind kind, XmlTokenizerMode nextMode) |
if( !IsNameCharacter( input[ i ] ) ) |
||||
{ |
break; |
||||
Debug.Assert(mode == XmlTokenizerMode.AfterOpen || mode == XmlTokenizerMode.InsideElement); |
XmlToken token = new XmlToken( kind, i - position ); |
||||
int i; |
mode = nextMode; |
||||
for (i = position; i < input.Length; i++) |
position = i; |
||||
if (!IsNameCharacter(input[i])) |
return token; |
||||
break; |
} |
||||
XmlToken token = new XmlToken(kind, i - position); |
private XmlToken TokenizeElementWhitespace() |
||||
mode = nextMode; |
{ |
||||
position = i; |
int i; |
||||
return token; |
for( i = position; i < input.Length; i++ ) |
||||
} |
if( !char.IsWhiteSpace( input[ i ] ) ) |
||||
private XmlToken TokenizeElementWhitespace() |
break; |
||||
{ |
XmlToken token = new XmlToken( XmlTokenKind.ElementWhitespace, i - position ); |
||||
int i; |
position = i; |
||||
for (i = position; i < input.Length; i++) |
return token; |
||||
if (!char.IsWhiteSpace(input[i])) |
} |
||||
break; |
private bool StartsWith( string text ) |
||||
XmlToken token = new XmlToken(XmlTokenKind.ElementWhitespace, i - position); |
{ |
||||
position = i; |
if( position + text.Length > input.Length ) |
||||
return token; |
return false; |
||||
} |
else |
||||
private bool StartsWith(string text) |
return input.Substring( position, text.Length ) == text; |
||||
{ |
} |
||||
if (position + text.Length > input.Length) |
private XmlToken TokenizeInsideElement() |
||||
return false; |
{ |
||||
else |
if( char.IsWhiteSpace( input[ position ] ) ) |
||||
return input.Substring(position, text.Length) == text; |
return TokenizeElementWhitespace(); |
||||
} |
else |
||||
private XmlToken TokenizeInsideElement() |
if( StartsWith( "/>" ) ) |
||||
{ |
return TokenizeSimple( "/>", XmlTokenKind.SelfClose, XmlTokenizerMode.OutsideElement ); |
||||
if (char.IsWhiteSpace(input[position])) |
else |
||||
return TokenizeElementWhitespace(); |
if( StartsWith( ">" ) ) |
||||
else |
return TokenizeSimple( ">", XmlTokenKind.Close, XmlTokenizerMode.OutsideElement ); |
||||
if (StartsWith("/>")) |
else |
||||
return TokenizeSimple("/>", XmlTokenKind.SelfClose, XmlTokenizerMode.OutsideElement); |
return TokenizeName( XmlTokenKind.AttributeName, XmlTokenizerMode.AfterAttributeName ); |
||||
else |
} |
||||
if (StartsWith(">")) |
private XmlToken TokenizeText() |
||||
return TokenizeSimple(">", XmlTokenKind.Close, XmlTokenizerMode.OutsideElement); |
{ |
||||
else |
Debug.Assert( input[ position ] != '<' ); |
||||
return TokenizeName(XmlTokenKind.AttributeName, XmlTokenizerMode.AfterAttributeName); |
Debug.Assert( input[ position ] != '&' ); |
||||
} |
Debug.Assert( mode == XmlTokenizerMode.OutsideElement ); |
||||
private XmlToken TokenizeText() |
int i; |
||||
{ |
for( i = position; i < input.Length; i++ ) |
||||
Debug.Assert(input[position] != '<'); |
if( input[ i ] == '<' || input[ i ] == '&' ) |
||||
Debug.Assert(input[position] != '&'); |
break; |
||||
Debug.Assert(mode == XmlTokenizerMode.OutsideElement); |
XmlToken token = new XmlToken( XmlTokenKind.TextContent, i - position ); |
||||
int i; |
position = i; |
||||
for (i = position; i < input.Length; i++) |
return token; |
||||
if (input[i] == '<' || input[i] == '&') |
} |
||||
break; |
private XmlToken TokenizeOutsideElement() |
||||
XmlToken token = new XmlToken(XmlTokenKind.TextContent, i - position); |
{ |
||||
position = i; |
Debug.Assert( mode == XmlTokenizerMode.OutsideElement ); |
||||
return token; |
if( position >= input.Length ) |
||||
} |
return new XmlToken( XmlTokenKind.EOF, 0 ); |
||||
private XmlToken TokenizeOutsideElement() |
switch( input[ position ] ) |
||||
{ |
{ |
||||
Debug.Assert(mode == XmlTokenizerMode.OutsideElement); |
case '<': |
||||
if (position >= input.Length) |
return TokenizeOpen(); |
||||
return new XmlToken(XmlTokenKind.EOF, 0); |
case '&': |
||||
switch (input[position]) |
return TokenizeEntity(); |
||||
{ |
default: |
||||
case '<': |
return TokenizeText(); |
||||
return TokenizeOpen(); |
} |
||||
case '&': |
} |
||||
return TokenizeEntity(); |
private XmlToken TokenizeSimple( string text, XmlTokenKind kind, XmlTokenizerMode nextMode ) |
||||
default: |
{ |
||||
return TokenizeText(); |
XmlToken token = new XmlToken( kind, text.Length ); |
||||
} |
position += text.Length; |
||||
} |
mode = nextMode; |
||||
private XmlToken TokenizeSimple(string text, XmlTokenKind kind, XmlTokenizerMode nextMode) |
return token; |
||||
{ |
} |
||||
XmlToken token = new XmlToken(kind, text.Length); |
private XmlToken TokenizeOpen() |
||||
position += text.Length; |
{ |
||||
mode = nextMode; |
Debug.Assert( input[ position ] == '<' ); |
||||
return token; |
if( StartsWith( "<!--" ) ) |
||||
} |
return TokenizeSimple( "<!--", XmlTokenKind.CommentBegin, XmlTokenizerMode.InsideComment ); |
||||
private XmlToken TokenizeOpen() |
else |
||||
{ |
if( StartsWith( "<![CDATA[" ) ) |
||||
Debug.Assert(input[position] == '<'); |
return TokenizeSimple( "<![CDATA[", XmlTokenKind.CDataBegin, XmlTokenizerMode.InsideCData ); |
||||
if (StartsWith("<!--")) |
else |
||||
return TokenizeSimple("<!--", XmlTokenKind.CommentBegin, XmlTokenizerMode.InsideComment); |
if( StartsWith( "<?" ) ) |
||||
else |
return TokenizeSimple( "<?", XmlTokenKind.OpenProcessingInstruction, XmlTokenizerMode.InsideProcessingInstruction ); |
||||
if (StartsWith("<![CDATA[")) |
else |
||||
return TokenizeSimple("<![CDATA[", XmlTokenKind.CDataBegin, XmlTokenizerMode.InsideCData); |
if( StartsWith( "</" ) ) |
||||
else |
return TokenizeSimple( "</", XmlTokenKind.OpenClose, XmlTokenizerMode.AfterOpen ); |
||||
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); |
|
||||
} |
|
||||
else |
else |
||||
{ |
return TokenizeSimple( "<", XmlTokenKind.Open, XmlTokenizerMode.AfterOpen ); |
||||
XmlToken token = new XmlToken(XmlTokenKind.CommentText, tokenend - position); |
|
||||
position = tokenend; |
|
||||
return token; |
|
||||
} |
|
||||
} |
|
||||
} |
} |
||||
|
private XmlToken TokenizeEntity() |
||||
// Used so you can restart the tokenizer for the next line of XML
|
|
||||
enum XmlTokenizerMode |
|
||||
{ |
{ |
||||
InsideComment, |
Debug.Assert( mode == XmlTokenizerMode.OutsideElement ); |
||||
InsideProcessingInstruction, |
Debug.Assert( input[ position ] == '&' ); |
||||
AfterOpen, |
XmlToken token = new XmlToken( XmlTokenKind.Entity, input.IndexOf( ';', position ) - position ); |
||||
AfterAttributeName, |
position += token.Length; |
||||
AfterAttributeEquals, |
return token; |
||||
InsideElement, |
|
||||
// after element name, before attribute or />
|
|
||||
OutsideElement, |
|
||||
InsideCData |
|
||||
} |
} |
||||
|
private XmlToken TokenizeInsideProcessingInstruction() |
||||
struct XmlToken |
{ |
||||
|
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; |
Debug.Assert( mode == XmlTokenizerMode.InsideComment ); |
||||
public short Length; |
int tokenend = input.IndexOf( "-->", position ); |
||||
public XmlToken(XmlTokenKind kind, int length) |
if( position == tokenend ) |
||||
{ |
{ |
||||
Kind = kind; |
position += "-->".Length; |
||||
Length = (short)length; |
mode = XmlTokenizerMode.OutsideElement; |
||||
} |
return new XmlToken( XmlTokenKind.CommentEnd, "-->".Length ); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
XmlToken token = new XmlToken( XmlTokenKind.CommentText, tokenend - position ); |
||||
|
position = tokenend; |
||||
|
return token; |
||||
|
} |
||||
} |
} |
||||
|
} |
||||
|
|
||||
/* |
// Used so you can restart the tokenizer for the next line of XML
|
||||
* this file implements a mostly correct XML tokenizer. The token boundaries |
enum XmlTokenizerMode |
||||
* have been chosen to match Visual Studio syntax highlighting, so a few of |
{ |
||||
* the boundaries are little weird. (Especially comments) known issues: |
InsideComment, |
||||
* |
InsideProcessingInstruction, |
||||
* Doesn't handle DTD's |
AfterOpen, |
||||
* mediocre handling of processing instructions <? ?> -- it won't crash, |
AfterAttributeName, |
||||
* but the token boundaries are wrong |
AfterAttributeEquals, |
||||
* Doesn't enforce correct XML |
InsideElement, |
||||
* there's probably a few cases where it will die if given in valid XML |
// after element name, before attribute or />
|
||||
* |
OutsideElement, |
||||
* |
InsideCData |
||||
* This tokenizer has been designed to be restartable, so you can tokenize |
} |
||||
* one line of XML at a time. |
|
||||
*/ |
struct XmlToken |
||||
enum XmlTokenKind |
{ |
||||
|
public XmlTokenKind Kind; |
||||
|
public short Length; |
||||
|
public XmlToken( XmlTokenKind kind, int length ) |
||||
{ |
{ |
||||
Open, |
Kind = kind; |
||||
// <
|
Length = ( short )length; |
||||
Close, |
|
||||
//>
|
|
||||
SelfClose, |
|
||||
// />
|
|
||||
OpenClose, |
|
||||
// </
|
|
||||
ElementName, |
|
||||
ElementWhitespace, |
|
||||
//whitespace between attributes
|
|
||||
AttributeName, |
|
||||
Equals, |
|
||||
// inside attribute
|
|
||||
AttributeValue, |
|
||||
// attribute value
|
|
||||
CommentBegin, |
|
||||
// <!--
|
|
||||
CommentText, |
|
||||
CommentEnd, |
|
||||
// -->
|
|
||||
Entity, |
|
||||
// >
|
|
||||
OpenProcessingInstruction, |
|
||||
// <?
|
|
||||
CloseProcessingInstruction, |
|
||||
// ?>
|
|
||||
CDataBegin, |
|
||||
// <![CDATA[
|
|
||||
CDataEnd, |
|
||||
// ]]>
|
|
||||
TextContent, |
|
||||
//WhitespaceContent, // text content that's whitespace. Space is embedded inside
|
|
||||
EOF, |
|
||||
// end of file
|
|
||||
} |
} |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* 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, |
||||
|
// >
|
||||
|
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…
Reference in new issue