1

我习惯于使用设计器创建表单,并且仅在需要时手动修改 XAML。

尽管扩展工具包是一个很棒的库,但它仍然缺乏与 Visual Studio 设计器的集成。无论如何,工具包的控件是否可以像标准控件一样显示在设计器(而不是工具箱)中?如果没有,是否有解释?

目前,该工具包的控件只是空白且无法通过简单的点击进行选择。

注意:问题似乎只发生在容器组件(如 BusyIndi​​cator 和 Wizard/WizardPage)上。

编辑:这是我的一些 XAML。有了这个,我可以看到向导的第一页,但看不到其他页面。如果我将我的向导放在 BusyIndi​​cator 中,则根本看不到任何东西。

<Window x:Class="MyProgram.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:MyProgram"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        Title="My Program" Height="477" Width="688" MinWidth="688" MinHeight="478">
    <xctk:Wizard x:Name="wizard" FinishButtonClosesWindow="True" Next="wizard_Next">
        <xctk:WizardPage Name="Intro_Page"  Title="ABC" Description="abc" NextPage="{Binding ElementName=Second_Page}" Enter="disallowNext">
            <xctk:WizardPage.Content>
                <Grid>
                    <Label Content="abc" HorizontalAlignment="Center" Margin="0,54,0,87" Name="intro_lbl" VerticalAlignment="Center" Grid.Column="1" Padding="5" HorizontalContentAlignment="Center" Height="28" IsEnabled="False" />
                 </Grid>
            </xctk:WizardPage.Content>
        </xctk:WizardPage>
        <xctk:WizardPage Name="Second_Page" Title="DFG" Description="dfg" NextPage="{Binding ElementName=Last_Page}">
            <xctk:WizardPage.Content>
                <Grid Name="grid">
                    <TextBox Grid.Column="1" Height="23" HorizontalAlignment="Stretch" Name="txt_second" VerticalAlignment="Center" />
                </Grid>
            </xctk:WizardPage.Content>
        </xctk:WizardPage>
        <xctk:WizardPage Name="Last_Page" PageType="Interior"
                         Title="Last Page"
                         Description="This is the last page in the process"
                         CanFinish="True" />
    </xctk:Wizard>
</Window>
4

1 回答 1

1

我知道这个答案来晚了,但是昨天我在这个问题上绊倒了自己,也许它对其他登陆这里的人有用。

我通过创建一个从WizardPage. 只需创建一个新的UserControl,包括 Xceed.Wpf.Toolkit 命名空间并将类型从更改UserControlxctk:WizardPagexaml 文件以及代码隐藏文件中。

<xctk:WizardPage x:Class="WizardTest.MyWizardPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:xctk="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
             xmlns:local="clr-namespace:WizardTest"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
  <Grid>
    <TextBlock>Hello World!</TextBlock>
  </Grid>
</xctk:WizardPage>

现在您可以使用 VisualStudio Designer 创建您的 UI。要将页面放置在向导中,只需将派生页面的对象放入其项目中:

<xctk:Wizard>
  <local:MyWizardPage Title="My Wizard Page"/>
</xctk:Wizard>

您可以Bindungs在开箱即用的服装页面中使用,因为DataContextMyWizardPage对象自动设置为向导(如果未明确给出DataContext,则从 Window 继承)DataContext

于 2016-01-21T08:08:15.853 回答