Wizard Add a button (WPF)

Wizard for WPF Forum

Posted 8 years ago by Rick Maldonado
Version: 15.1.0624
Avatar

I want to add a button to the wizard. If this possible? If so, could you guide in the right direction in xaml.

Comments (1)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

You would probably need to clone the default template for the WizardButtonContainer control and put an implicit Style with that template in your Wizard's Resources.  The cloned template would need to be altered to have your additional button, and you would attach a routed command to it that you'd handle up at the Wizard or higher level.

Here is the default style:

<Style x:Key="{x:Type wizard:WizardButtonContainer}" TargetType="wizard:WizardButtonContainer">
	<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ContainerMediumBackgroundNormalBrushKey}}" />
	<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ContainerBorderNormalBrushKey}}" />
	<Setter Property="BorderThickness" Value="0,1,0,0" />
	<Setter Property="Padding" Value="7" />
	<Setter Property="Template">
		<Setter.Value>
			<ControlTemplate TargetType="wizard:WizardButtonContainer">
				<Border Background="{TemplateBinding Background}"
						BorderBrush="{TemplateBinding BorderBrush}"
						BorderThickness="{TemplateBinding BorderThickness}"
						Padding="{TemplateBinding Padding}"
						SnapsToDevicePixels="True">
					<DockPanel>
						<Button x:Name="PART_HelpButton" DockPanel.Dock="Left" MinWidth="75" Command="wizard:WizardCommands.Help"
							Content="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=wizard:Wizard}, Path=HelpButtonText}" 
							Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=wizard:Wizard}, Path=(wizard:Wizard.SelectedPage).(wizard:WizardPage.HelpButtonVisibility)}" />
						<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
							<Button x:Name="PART_CancelButton" Margin="0,0,7,0" MinWidth="75" Command="wizard:WizardCommands.Cancel" 
								Content="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=wizard:Wizard}, Path=CancelButtonText}" 
								Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=wizard:Wizard}, Path=(wizard:Wizard.SelectedPage).(wizard:WizardPage.CancelButtonVisibility)}" />
							<Button x:Name="PART_BackButton" MinWidth="75" Command="wizard:WizardCommands.PreviousPage" 
								Content="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=wizard:Wizard}, Path=BackButtonText}" 
								Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=wizard:Wizard}, Path=(wizard:Wizard.SelectedPage).(wizard:WizardPage.BackButtonVisibility)}" />
							<Button x:Name="PART_NextButton" MinWidth="75" Command="wizard:WizardCommands.NextPage"
								Content="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=wizard:Wizard}, Path=NextButtonText}" 
								Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=wizard:Wizard}, Path=(wizard:Wizard.SelectedPage).(wizard:WizardPage.NextButtonVisibility)}" />
							<Button x:Name="PART_FinishButton" Margin="7,0,0,0" MinWidth="75" Command="wizard:WizardCommands.Finish" 
								Content="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=wizard:Wizard}, Path=FinishButtonText}" 
								Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=wizard:Wizard}, Path=(wizard:Wizard.SelectedPage).(wizard:WizardPage.FinishButtonVisibility)}" />
						</StackPanel>
					</DockPanel>
				</Border>
			</ControlTemplate>
		</Setter.Value>
	</Setter>
</Style>


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.