用户控件错误:WPFBindingNavigaorControl.WPFBindingNavigator控件中找不到类

时间:2012-11-14 14:00:45

标签: wpf user-controls wpf-controls

我尝试创建一个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。这个类在我的测试解决方案的另一个项目中。我已经将我的所有项目的Target Framework重置为同样的东西:.NET Framework 4.我仍然得到相同的xaml错误。我知道我在这里做错了什么。提前谢谢。

爱德科恩

1 个答案:

答案 0 :(得分:2)

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

namespace = WPFBindingNavigatorControl
class = WPFBindingNavigatorControl
相关问题