Adding a button to the button container

Wizard for WPF Forum

Posted 16 years ago by Bob Fera
Version: 4.5.0485
Avatar
Greetings,

I'm evaluating WPF Studio and just learning my way around these controls (and WPF in general), so I apologize if this is an elementary question...

In a Wizard I've created I have a page that contains a "Start Over" button in the "content" part of the page. The button appears on only the one page and its Visibility is also tied to a property with a DataTrigger. Here's what I'm doing now:

<Button Name="startOverButton" Margin="10,10,2,10" Padding="3"
Content="Start Over"
Command="wizard:WizardCommands.BacktrackToPage"
CommandParameter="searchPage">

<Button.Style>
<Style BasedOn="{StaticResource {x:Type Button}}"
TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=ApproveByBatch}" Value="true">
<Setter Property="Control.Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=ApproveByBatch}" Value="false">
<Setter Property="Control.Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>

Functionally, this works fine. However, the button really belongs in the Wizard's Button Container with the other navigation buttons. What's the best way to approach doing that, especially given the requirements I outlined above? The sample app shows how to rearrange the container, but not how to add something to it.

Any tidbits of wisdom you can send my way would be greatly appreciated!

Thanks!

Bob

Comments (2)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bob,

I assume you were looking at the AlternateLayoutButtonContainerTheme.xaml theme file, right? In there all you'd do is add your custom button. Control templates can contain anything you want, which is the power of WPF.

For visibility, perhaps do a binding for Button.Visibility with a relative source that looks for an ancestor of type Wizard. Maybe write a value converter that looks at the SelectedPage and returns a Visibility based on if the page is the one you want the button on or not. That's one way to do this.


Actipro Software Support

Posted 16 years ago by Bob Fera
Avatar
Thanks for the suggestions. I'll dig into it and give it a try.

Regards,

Bob

[Modified at 02/20/2009 03:12 PM]
The latest build of this product (v24.1.3) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.