0

申し訳ありませんが、C#とWPFを初めて使用します。http://www.codeproject.com/Articles/75847/Virtualizing-WrapPanelからダウンロードした*.csファイルからサードパーティのコントロールを使用しようとしました

コントロールを使用するために説明された記事:

<ListBox ItemsSource="{StaticResource boundCollection}">
   <ListBox.ItemsPanel>
       <ItemsPanelTemplate>
            <VirtualizingWrapPanel Orientation="Vertical" /> 
       </ItemsPanelTemplate>
    </ListBox.ItemsPanel> 
</ListBox>

csファイルをプロジェクトのフォルダーにコピーし、ソリューションエクスプローラーにドラッグアンドドロップして追加し、名前空間をプロジェクトの名前空間に変更しました。ただし、次のエラーが表示されます。

Error   1   The tag 'VirtualizingWrapPanel' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'. Line 30 Position 22.   C:\Users\mbp2011\Documents\Visual Studio 2010\Projects\@Experiment\ThumbnailsView\ThumbnailsView\MainWindow.xaml    30  22  ThumbnailsView

前もって感謝します

4

1 に答える 1

2

Xamlに参照を追加する必要があります。これは、csファイルに参照を追加する(使用する)のと同じ種類です。

例:

<Window x:Class="WpfApplication8.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        // Add a reference to the namespace that contains VirtualizingWrapPanel 
        xmlns:controls="clr-namespace:the namespace of the VirtualizingWrapPanel"

        Title="MainWindow" Height="233" Width="405" Name="UI" WindowStyle="ToolWindow">
    <ListBox ItemsSource="{StaticResource boundCollection}">
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>

                // then use the namespace to access the VirtualizingWrapPanel 
                <controls:VirtualizingWrapPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
    </ListBox>
</Window>
于 2013-01-31T02:28:05.910 に答える