Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This can be approached in XAML using datatemplates and/or triggers. For example, if each page in your wizard were represented in an underlying model as a separate class or object, you could use one of the following two options... Both use a ContentControl, which is the perfect control for when the content will vary greatly between different views of the same data.</p> <p><em>Please note that the bindings are intended as pseudocode examples, just to convey intent!</em></p> <p><strong>DataTemplate-based</strong>, using different classes for each page:</p> <pre><code>&lt;Grid&gt; &lt;Grid.Resources&gt; &lt;DataTemplate DataType="{x:Type WizardPageOne}"&gt; &lt;!-- page 1 layout here --&gt; &lt;/DataTemplate&gt; &lt;DataTemplate DataType="{x:Type WizardPageTwo}"&gt; &lt;!-- page 2 layout here --&gt; &lt;/DataTemplate&gt; &lt;!-- ... etc --&gt; &lt;/Grid.Resources&gt; &lt;ContentControl Content="{Binding CurrentPageModel, Source=Wizardmodel}" /&gt; &lt;/Grid&gt; </code></pre> <p>Or <strong>Trigger based</strong>, using a property that indicates the current page:</p> <pre><code>&lt;ContentControl Content="{Binding WizardModel}"&gt; &lt;ContentControl.Style&gt; &lt;Style&gt; &lt;Style.Triggers&gt; &lt;DataTrigger Binding="{Binding CurrentPageIndex} Value="1"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate&gt; &lt;!-- page 1 layout here --&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/DataTrigger&gt; &lt;DataTrigger Binding="{Binding CurrentPageIndex} Value="2"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate&gt; &lt;!-- page 2 layout here --&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/DataTrigger&gt; &lt;!-- .... etc --&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/ContentControl.Style&gt; &lt;/ContentControl&gt; </code></pre> <p>Both options will only load the control for each page as it's required, so you don't have all of the controls "loaded but hidden" in the window.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload