Adding a button to the button container

Wizard for WPF Forum

Posted 15 years ago by Bob Fera
Version: 4.5.0485

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"

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

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!



Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
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 15 years ago by Bob Fera
Thanks for the suggestions. I'll dig into it and give it a try.



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

Add Comment

Please log in to a validated account to post comments.