This project has moved. For the latest updates, please go here.

Wizard Control template

Oct 13, 2012 at 11:32 PM

I tried to extend Wizard custom control and so that there are three wizard type available now

  • NormalWizard (default template
  • WithStepsOnLeft (modified to show list on the left style of the wizard with active page highlighted
  • Mixed (Combines both default and listed mode but keeps header and page types from default WizardPage

My problem here is that Now I want to modify Wizard style so it changes its main template based on WizardType DependencyProperty of type Enum.

I tried to do something like the one below but Visual Studio does not see resource.

<Style TargetType="{x:Type local:Wizard}">
    <Style.Triggers>
        <Trigger Property="WizardType" Value="Normal">
            <Setter Property="Style" Value="{StaticResource StandartWizardTemplate}" />
        </Trigger>
    </Style.Triggers>
</Style>

<Style x:Key="StandartWizardTemplate" TargetType="{x:Type local:Wizard}">
    <Setter Property="Background" Value="#F0F0F0" />
    <Setter Property="BorderBrush" Value="#A0A0A0" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="ItemsPanel">
        <Setter.Value>
            <ItemsPanelTemplate>
                <Grid />
            </ItemsPanelTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="Template">
    //Content of default template before modification
    </Setter>
</Style>

I have also tried to set not a style but Template so Extracted Control template as a resource with key from
default style and on trigger tried to set template value but still was not able to see resource in intelligence
and resource was not recognized.

please someone point me to the right directon what should I do to implement this scenario

 

Oct 13, 2012 at 11:45 PM
Edited Oct 13, 2012 at 11:45 PM

Ok The Only way Resource dictionary can see template is in this way

 

 

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:Wizard}">
                    <ControlTemplate.Triggers>
                        <Trigger Property="WizardType" Value="Normal">
                            <Setter Value="{DynamicResource NormalModeWizard}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

 

 

But is this correct and why should I use DynamicResource instead of StaticResource?