Sidebar Wizard with External Pages

Wizard for WPF Forum

Posted 8 years ago by Doug Beck
Avatar
I am looking to create a sidebar wizard with welcome and completion pages. I don't want either of these pages to show up in the sidebar. I tried making them of type "External" but they are still included. How do I exclude them?

Comments (1)

Posted 8 years ago by Doug Beck
Avatar
I managed to figure it out based upon another post. I used a ListBox like this;

<ListBox Style="{StaticResource SidebarListBoxStyle}"
ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Items}"
SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedPage}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Visibility">
<Setter.Value>
<MultiBinding Converter="{x:Static local:CustomValueConverter.Instance}">
<Binding />
<Binding Path="Wizard.SelectedPage" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>

And a converter like this;

public class CustomValueConverter : IMultiValueConverter
{

public readonly static CustomValueConverter Instance = new CustomValueConverter();

public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values == null || values.Length < 1)
throw new ArgumentException("values");

WizardPage page = values[0] as WizardPage;
if (page != null && page.Wizard != null)
{
int index = page.Wizard.Items.IndexOf(page);

if (index == 0) return (Visibility.Collapsed);
if (index + 1 == page.Wizard.Items.Count) return (Visibility.Collapsed);
}

return Visibility.Visible;
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
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.