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

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

@ -1,6 +1,7 @@
using System; using System;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media;
namespace Microsoft.Windows.Controls namespace Microsoft.Windows.Controls
{ {
@ -64,6 +65,20 @@ namespace Microsoft.Windows.Controls
set { base.SetValue(DescriptionProperty, value); } 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 static readonly DependencyProperty FinishButtonVisibilityProperty = DependencyProperty.Register("FinishButtonVisibility", typeof(WizardPageButtonVisibility), typeof(WizardPage), new UIPropertyMetadata(WizardPageButtonVisibility.Inherit));
public WizardPageButtonVisibility FinishButtonVisibility public WizardPageButtonVisibility FinishButtonVisibility
{ {
@ -71,6 +86,20 @@ namespace Microsoft.Windows.Controls
set { SetValue(FinishButtonVisibilityProperty, value); } 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 static readonly DependencyProperty HelpButtonVisibilityProperty = DependencyProperty.Register("HelpButtonVisibility", typeof(WizardPageButtonVisibility), typeof(WizardPage), new UIPropertyMetadata(WizardPageButtonVisibility.Inherit));
public WizardPageButtonVisibility HelpButtonVisibility public WizardPageButtonVisibility HelpButtonVisibility
{ {
@ -97,7 +126,7 @@ namespace Microsoft.Windows.Controls
{ {
get { return (WizardPageType)GetValue(PageTypeProperty); } get { return (WizardPageType)GetValue(PageTypeProperty); }
set { SetValue(PageTypeProperty, value); } set { SetValue(PageTypeProperty, value); }
} }
public static readonly DependencyProperty PreviousPageProperty = DependencyProperty.Register("PreviousPage", typeof(WizardPage), typeof(WizardPage), new UIPropertyMetadata(null)); public static readonly DependencyProperty PreviousPageProperty = DependencyProperty.Register("PreviousPage", typeof(WizardPage), typeof(WizardPage), new UIPropertyMetadata(null));
public WizardPage PreviousPage public WizardPage PreviousPage

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

@ -106,46 +106,74 @@
</ControlTemplate> </ControlTemplate>
<ControlTemplate x:Key="ExteriorWizardPageTemplate" TargetType="{x:Type local:WizardPage}"> <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}">
<Grid Background="{TemplateBinding Background}"> <Grid.ColumnDefinitions>
<ContentPresenter Margin="14" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" /> <ColumnDefinition Width="Auto" />
</Grid> <ColumnDefinition Width="*" />
</Border> </Grid.ColumnDefinitions>
</ControlTemplate> <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}}" >
<ControlTemplate x:Key="InteriorWizardPageTemplate" TargetType="{x:Type local:WizardPage}"> <ContentControl Content="{TemplateBinding ExteriorPanelContent}" />
<Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"> </Grid>
<Grid> </Border>
<Grid Column="1" Margin="14">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </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"> <ControlTemplate x:Key="InteriorWizardPageTemplate" TargetType="{x:Type local:WizardPage}">
<StackPanel Grid.Column="0"> <Grid>
<TextBlock Margin="16,9,0,1" TextWrapping="Wrap" FontWeight="Bold" Text="{TemplateBinding Title}" /> <Grid.RowDefinitions>
<TextBlock Margin="32,0,0,3" TextWrapping="Wrap" Text="{TemplateBinding Description}" /> <RowDefinition Height="Auto" />
</StackPanel> <RowDefinition Height="*" />
</Grid> </Grid.RowDefinitions>
<Border Grid.Row="1" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"> <Grid Background="{TemplateBinding HeaderBackground}" MinHeight="56" >
<Grid Background="{TemplateBinding Background}"> <Grid.ColumnDefinitions>
<ContentPresenter Margin="14" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" /> <ColumnDefinition Width="*" />
</Grid> <ColumnDefinition Width="Auto" />
</Border> </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> </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> </ControlTemplate>
<Style TargetType="{x:Type local:WizardPage}"> <Style TargetType="{x:Type local:WizardPage}">
<Style.Triggers> <Style.Triggers>
<Trigger Property="PageType" Value="Blank"> <Trigger Property="PageType" Value="Blank">
<Setter Property="Background" Value="#FFF0F0F0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template" Value="{StaticResource BlankWizardPageTemplate}" /> <Setter Property="Template" Value="{StaticResource BlankWizardPageTemplate}" />
</Trigger> </Trigger>
<Trigger Property="PageType" Value="Exterior"> <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}" /> <Setter Property="Template" Value="{StaticResource ExteriorWizardPageTemplate}" />
</Trigger> </Trigger>
<Trigger Property="PageType" Value="Interior"> <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}" /> <Setter Property="Template" Value="{StaticResource InteriorWizardPageTemplate}" />
</Trigger> </Trigger>
</Style.Triggers> </Style.Triggers>

Loading…
Cancel
Save