Wizard with Listbox

Wizard for WPF Forum

Posted 14 years ago by Mina
Version: 9.2.0510
Avatar
Hi-- I am just learning to use the Wizard control. I was able to create a wizard page with a listbox in it. This is what I want to be able to do... depends on what item the user picks in the listbox, the wizard will go to different page when the user clicks Next. I saw that there is an exmaple similar to this with the radio buttons. But I can't get it to work with a listbox. Do you have any example to show me how to do this, preferably in XAML? Thanks!

Comments (6)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Maggie,

Actually the sample you describe is using a ListBox, we just template the items to look like radio buttons. If you open our main Features demo for Wizard, look in the MainControl.xaml for the "demoPathPage" page definition. You'll see the ListBox in it with how we bind the SelectedValue to switch up the page's NextPage property.


Actipro Software Support

Posted 14 years ago by Mina
Avatar
Thanks! That works! One more question... I set the IsSelected="True" for the first ListBoxItem. But none of the item is being selected when I go to the page. Any idea? Thanks!
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Maggie,

Usually we recommend setting ListBox's SelectedIndex="0" instead.


Actipro Software Support

Posted 14 years ago by Mina
Avatar
I set the SelectIndex="0" like you suggested. However, after I reload the XAML Designer, that number got changed back to -1. Here is the code for the ListBox...

<ListBox Margin="14,23,0,0" BorderBrush="Transparent" Background="Transparent" SelectedIndex="0" SelectedValuePath="Tag" SelectedValue="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type wizard:WizardPage}}, Path=NextPage}" >

If I remove the binding part for the SelectedValue, then the first listbox item is being selected. But the wizard doesn't go to the correct page if other listbox item is selected and click Next.

I am very new to WPF. So any help would be really appreciate. Thanks!
-Maggie.
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Oh, you probably would have to pull out SelectedIndex then. Maybe set the WizardPage's NextPage property in XAML to whatever the value is in your first listbox item. That way this ListBox's selected value should sync up.


Actipro Software Support

Posted 14 years ago by Mina
Avatar
It works! Thanks!!
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.