0

我试图创建一个 WPF 绑定导航器控件,我想将其放置在我的自定义库项目中。它给了我以下错误:

Error   1   The type name 'WPFBindingNavigatorControl' does not exist in the type 'WPFBindingNavigatorControl.WPFBindingNavigatorControl'

现在这里是 xaml 代码:

<UserControl x:Class="WPFBindingNavigatorControl.WPFBindingNavigatorControl"
         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" 
         mc:Ignorable="d" 
         d:DesignHeight="45" d:DesignWidth="375" xmlns:my="clr-namespace:ImageButton;assembly=ImageButton" Loaded="UserControl_Loaded">
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="47*" />
        <ColumnDefinition Width="50*" />
        <ColumnDefinition Width="87*" />
        <ColumnDefinition Width="32*" />
        <ColumnDefinition Width="54*" />
        <ColumnDefinition Width="51*" />
        <ColumnDefinition Width="54*" />
    </Grid.ColumnDefinitions>
    <my:ImageButton Name="btnFirst" Image="/images/Go-first.png" ImageHeight="NaN" ImageWidth="NaN" />
    <my:ImageButton  Grid.Column="1" Name="btnPrevious" Image="/images/Go-previous-view.png" Margin="6,0,0,0" />
    <TextBox Grid.Column="2" Margin="6,10,8,12" Name="txtGoTo" />
    <Label Content="Of" Grid.Column="3" Margin="0,8,3,9" Name="label1" />
    <Label Content="Label" Grid.Column="4" Margin="0,8,0,9" Name="lblTotalRowCount" />
    <my:ImageButton Grid.Column="5" Name="btnNext" Image="/images/Go-next.png" Margin="0,0,9,0" />
    <my:ImageButton Grid.Column="6" Name="btnLast" Image="/images/Go-last.png" />
</Grid>

现在,这也使用了我创建的另一个用户控件:ImageButton。此类在我的测试解决方案中的另一个项目中。我已将所有项目的目标框架重置为相同的东西:.NET Framework 4。我仍然收到相同的 xaml 错误。我知道我在这里做错了什么。提前致谢。

埃德科恩

4

1 回答 1

2

尝试将类的名称更改为与当前命名空间不同的名称,如下所示:

namespace = WPFBindingNavigatorControl
class = WPFBindingNavigatorControl
于 2012-11-14T14:10:12.297 回答