Controlling the default button

Wizard for WPF Forum

Posted 10 years ago by Bob Fera
Version: 4.5.0486
Avatar
Greetings,

I have a case where I've added a button to my Wizard's button container. Is there a way to make that button the default button? Ideally, I'd *love* to do something like "my-new-button then Next". :-)

Sound possible?

Thanks,

Bob

Comments (4)

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

You'd probably have to make sure the Wizard option for setting default buttons is off and then manually set the IsDefault property on your button instead. Then programmatically change the Next button to be defaulted in certain scenarios where appropriate.


Actipro Software Support

Posted 10 years ago by Bob Fera
Avatar
Thanks for the quick answer.

I've turned off the Wizard's option for setting the default button and manually set the IsDefault property on my button. That works perfectly. Now, I'm sure I'm missing something obvious, but I'm not seeing a way to get to the Next button programmatically so I can access its IsDefault property. The wizard.ButtonContainer.NextButton returns a ButtonBase, which doesn't have IsDefault. Can you please enlighten me on where I should be looking? :-)

Thanks,

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

You could cast it to a Button or better yet, use the C# 'as' keyword to try and cast it. If it is a Button then set the property. It should generally be since our default templates use Button.


Actipro Software Support

Posted 10 years ago by Bob Fera
Avatar
Of course, thanks. Just wanted to make sure doing something like that was safe... :-)

Thanks for your help!

Bob
The latest build of this product (v2018.1 build 0675) 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.