代码之家  ›  专栏  ›  技术社区  ›  Syntax Error ine

如何在向导页中放置控件?

  •  0
  • Syntax Error ine  · 技术社区  · 6 年前

    WPF Toolkit from xceed The documentation 是非常有限的,只真正显示了如何更改向导的表示,而不是行为。

    当我将.xaml文件中的控件定义移动到向导中时,它会说 Wizard should only contain WizardPages

    <Window xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:myApp"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" 
        x:Class="myApp.MainWindow"
        mc:Ignorable="d"
        Title="MainWindow" Height="800" Width="1000" MinWidth="5">
    <Window.BorderBrush>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="LightGray" Offset="0"/>
            <GradientStop Color="White" Offset="1"/>
        </LinearGradientBrush>
    </Window.BorderBrush>
    <Grid Margin="10">
    
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="767*"/>
            <ColumnDefinition Width="199*"/>
            <ColumnDefinition Width="6*"/>
        </Grid.ColumnDefinitions>
        <xctk:Wizard FinishButtonClosesWindow="True">
            <xctk:WizardPage x:Name="IntroPage" 
                                   Title="Welcome to my Wizard"
                                   Description="This Wizard will walk you though how to do something." />
            <xctk:WizardPage x:Name="Page1" PageType="Interior"
                                   Title="Page 1"
                                   Description="This is the first page in the process."
                                   NextPage="{Binding ElementName=Page2}"
                                   PreviousPage="{Binding ElementName=IntroPage}"/>
    
            <xctk:WizardPage x:Name="Page2" PageType="Interior"
                                   Title="Page 2"
                                   Description="This is the second page in the process"/>
            <xctk:WizardPage x:Name="LastPage" PageType="Interior"
                                   Title="Last Page"
                                   Description="This is the last page in the process"
                                   CanFinish="True"/>
        </xctk:Wizard> 
        <Border Background="GhostWhite" BorderBrush="Silver" BorderThickness="1" CornerRadius="3,3,3,3" Grid.Column="1">
            <StackPanel Margin="10">
                <Button Content="Button 1"/>                
                <Button Content="Button 2"/>
                <TextBox Controls:TextBoxHelper.Watermark="This is a textbox" />
                <Controls:ToggleSwitch Header="Click me" />
            </StackPanel>
        </Border>  
    </Grid>   
    

    1 回复  |  直到 6 年前
        1
  •  0
  •   mm8    6 年前

    你可以把 Border 元素内部 <xctk:WizardPage

    <xctk:WizardPage x:Name="LastPage" PageType="Interior"
                    Title="Last Page"
                    Description="This is the last page in the process"
                    CanFinish="True">
    
        <Border Background="GhostWhite" BorderBrush="Silver" BorderThickness="1" CornerRadius="3,3,3,3" Grid.Column="1">
            <StackPanel Margin="10">
                <Button Content="Button 1"/>
                <Button Content="Button 2"/>
                <TextBox />
            </StackPanel>
        </Border>
    
    </xctk:WizardPage>
    
    推荐文章