Browse Source

Wizard: implemented default style

pull/1645/head
brianlagunas_cp 15 years ago
parent
commit
3a8c84bff5
  1. 12
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Wizard/Implementation/Wizard.cs
  2. 31
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Wizard/Implementation/WizardPage.cs
  3. 72
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Wizard/Themes/Generic.xaml

12
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Wizard/Implementation/Wizard.cs

@ -9,7 +9,7 @@ namespace Microsoft.Windows.Controls
{
#region Properties
public static readonly DependencyProperty BackButtonContentProperty = DependencyProperty.Register("BackButtonContent", typeof(object), typeof(Wizard), new UIPropertyMetadata("Back"));
public static readonly DependencyProperty BackButtonContentProperty = DependencyProperty.Register("BackButtonContent", typeof(object), typeof(Wizard), new UIPropertyMetadata("< Back"));
public object BackButtonContent
{
get { return (object)GetValue(BackButtonContentProperty); }
@ -102,6 +102,14 @@ namespace Microsoft.Windows.Controls
#endregion //CurrentPage
public static readonly DependencyProperty ExteriorPanelMinWidthProperty = DependencyProperty.Register("ExteriorPanelMinWidth", typeof(double), typeof(Wizard), new UIPropertyMetadata(165.0));
public double ExteriorPanelMinWidth
{
get { return (double)GetValue(ExteriorPanelMinWidthProperty); }
set { SetValue(ExteriorPanelMinWidthProperty, value); }
}
public static readonly DependencyProperty FinishButtonClosesWindowProperty = DependencyProperty.Register("FinishButtonClosesWindow", typeof(bool), typeof(Wizard), new UIPropertyMetadata(true));
public bool FinishButtonClosesWindow
{
@ -137,7 +145,7 @@ namespace Microsoft.Windows.Controls
set { SetValue(HelpButtonVisibilityProperty, value); }
}
public static readonly DependencyProperty NextButtonContentProperty = DependencyProperty.Register("NextButtonContent", typeof(object), typeof(Wizard), new UIPropertyMetadata("Next"));
public static readonly DependencyProperty NextButtonContentProperty = DependencyProperty.Register("NextButtonContent", typeof(object), typeof(Wizard), new UIPropertyMetadata("Next >"));
public object NextButtonContent
{
get { return (object)GetValue(NextButtonContentProperty); }

31
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Wizard/Implementation/WizardPage.cs

@ -1,6 +1,7 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace Microsoft.Windows.Controls
{
@ -64,6 +65,20 @@ namespace Microsoft.Windows.Controls
set { base.SetValue(DescriptionProperty, value); }
}
public static readonly DependencyProperty ExteriorPanelBackgroundProperty = DependencyProperty.Register("ExteriorPanelBackground", typeof(Brush), typeof(WizardPage), new UIPropertyMetadata(null));
public Brush ExteriorPanelBackground
{
get { return (Brush)GetValue(ExteriorPanelBackgroundProperty); }
set { SetValue(ExteriorPanelBackgroundProperty, value); }
}
public static readonly DependencyProperty ExteriorPanelContentProperty = DependencyProperty.Register("ExteriorPanelContent", typeof(object), typeof(WizardPage), new UIPropertyMetadata(null));
public object ExteriorPanelContent
{
get { return (object)GetValue(ExteriorPanelContentProperty); }
set { SetValue(ExteriorPanelContentProperty, value); }
}
public static readonly DependencyProperty FinishButtonVisibilityProperty = DependencyProperty.Register("FinishButtonVisibility", typeof(WizardPageButtonVisibility), typeof(WizardPage), new UIPropertyMetadata(WizardPageButtonVisibility.Inherit));
public WizardPageButtonVisibility FinishButtonVisibility
{
@ -71,6 +86,20 @@ namespace Microsoft.Windows.Controls
set { SetValue(FinishButtonVisibilityProperty, value); }
}
public static readonly DependencyProperty HeaderBackgroundProperty = DependencyProperty.Register("HeaderBackground", typeof(Brush), typeof(WizardPage), new UIPropertyMetadata(Brushes.White));
public Brush HeaderBackground
{
get { return (Brush)GetValue(HeaderBackgroundProperty); }
set { SetValue(HeaderBackgroundProperty, value); }
}
public static readonly DependencyProperty HeaderImageProperty = DependencyProperty.Register("HeaderImage", typeof(ImageSource), typeof(WizardPage), new UIPropertyMetadata(null));
public ImageSource HeaderImage
{
get { return (ImageSource)GetValue(HeaderImageProperty); }
set { SetValue(HeaderImageProperty, value); }
}
public static readonly DependencyProperty HelpButtonVisibilityProperty = DependencyProperty.Register("HelpButtonVisibility", typeof(WizardPageButtonVisibility), typeof(WizardPage), new UIPropertyMetadata(WizardPageButtonVisibility.Inherit));
public WizardPageButtonVisibility HelpButtonVisibility
{
@ -97,7 +126,7 @@ namespace Microsoft.Windows.Controls
{
get { return (WizardPageType)GetValue(PageTypeProperty); }
set { SetValue(PageTypeProperty, value); }
}
}
public static readonly DependencyProperty PreviousPageProperty = DependencyProperty.Register("PreviousPage", typeof(WizardPage), typeof(WizardPage), new UIPropertyMetadata(null));
public WizardPage PreviousPage

72
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Wizard/Themes/Generic.xaml

@ -106,46 +106,74 @@
</ControlTemplate>
<ControlTemplate x:Key="ExteriorWizardPageTemplate" TargetType="{x:Type local:WizardPage}">
<Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter Margin="14" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
</Grid>
</Border>
</ControlTemplate>
<ControlTemplate x:Key="InteriorWizardPageTemplate" TargetType="{x:Type local:WizardPage}">
<Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<Grid>
<Grid Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<Grid Grid.Column="0" Background="{TemplateBinding ExteriorPanelBackground}" MinWidth="{Binding ExteriorPanelMinWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Wizard}}" >
<ContentControl Content="{TemplateBinding ExteriorPanelContent}" />
</Grid>
</Border>
<Grid Column="1" Margin="14">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" TextWrapping="Wrap" Margin="0,0,0,14" FontSize="16" FontWeight="Bold" Text="{TemplateBinding Title}" />
<TextBlock Grid.Row="1" TextWrapping="Wrap" Margin="0,0,0,14" Text="{TemplateBinding Description}" />
<ContentPresenter Grid.Row="2" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
</Grid>
</Grid>
</ControlTemplate>
<Grid Name="PART_Header">
<StackPanel Grid.Column="0">
<TextBlock Margin="16,9,0,1" TextWrapping="Wrap" FontWeight="Bold" Text="{TemplateBinding Title}" />
<TextBlock Margin="32,0,0,3" TextWrapping="Wrap" Text="{TemplateBinding Description}" />
</StackPanel>
</Grid>
<ControlTemplate x:Key="InteriorWizardPageTemplate" TargetType="{x:Type local:WizardPage}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Grid.Row="1" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter Margin="14" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
</Grid>
</Border>
<Grid Background="{TemplateBinding HeaderBackground}" MinHeight="56" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Margin="16,9,0,1" TextWrapping="Wrap" FontWeight="Bold" Text="{TemplateBinding Title}" />
<TextBlock Margin="32,0,0,3" TextWrapping="Wrap" Text="{TemplateBinding Description}" />
</StackPanel>
<Image Grid.Column="1" Margin="4" Source="{TemplateBinding HeaderImage}" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</Border>
<Border Grid.Row="1" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter Margin="14" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
</Grid>
</Border>
</Grid>
</ControlTemplate>
<Style TargetType="{x:Type local:WizardPage}">
<Style.Triggers>
<Trigger Property="PageType" Value="Blank">
<Setter Property="Background" Value="#FFF0F0F0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template" Value="{StaticResource BlankWizardPageTemplate}" />
</Trigger>
<Trigger Property="PageType" Value="Exterior">
<Setter Property="Background" Value="#FFFFFF" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="ExteriorPanelBackground" Value="#E3EFFF" />
<Setter Property="Template" Value="{StaticResource ExteriorWizardPageTemplate}" />
</Trigger>
<Trigger Property="PageType" Value="Interior">
<Setter Property="Background" Value="#FFF0F0F0" />
<Setter Property="BorderBrush" Value="{x:Static SystemColors.ActiveBorderBrush}" />
<Setter Property="BorderThickness" Value="0,1,0,0" />
<Setter Property="HeaderBackground" Value="#FFFFFF" />
<Setter Property="Template" Value="{StaticResource InteriorWizardPageTemplate}" />
</Trigger>
</Style.Triggers>

Loading…
Cancel
Save