簡體   English   中英

有沒有一種方法可以在VS Designer中顯示WPF Extended Toolkit的控件?

[英]Is there a way to display WPF Extended Toolkit's control in VS Designer?

我習慣於與設計器一起創建表單,並僅在需要時手動修改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>

我知道這個答案來晚了,但是昨天我在這個問題上絆了個腳,也許對那些來這里的人有用。

我通過創建一個派生自WizardPage的控件來解決它。 只需創建一個新的UserControl ,包括Xceed.Wpf.Toolkit命名空間,然后在xaml文件以及代碼隱藏文件中將Type從UserControl更改為xctk:WizardPage

<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設計器創建UI。 要將頁面放置在向導中,只需將派生頁面的對象放入其項目中:

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

您可以使用Bindungs在costum頁面開箱因為DataContext的的MyWizardPage對象被自動設置為向導DataContext (從窗口繼承DataContext如果沒有明確給出)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM