i前缀 wpf_c#-WPF“本地”是未声明的前缀

在进行SofiaCarRental WPF教程时,遇到'本地'别名未声明的问题,导致XML无效和多个类型找不到。错误涉及'local:BaseDialogWindow'、'local:NullableBooleanConverter'等。问题可能源于缺失的程序集引用或未正确导入'clr-namespace'。
摘要由CSDN通过智能技术生成

我从WPF开始.我在做SofiaCarRental教程,而“本地”别名有问题.有人可以帮我这个别名吗?

我没有找到所有这些类.

错误清单

Error 3 ''local' is an undeclared prefix. Line 1, position 2.' XML is not valid. c:\..\SofiaCarRental.WPF\Views\AddEditWindow.xaml 1 2 SofiaCarRental.WPF

Error 5 The attachable property 'Resources' was not found in type 'Window'. c:\..\SofiaCarRental.WPF\Views\AddEditWindow.xaml 8 6 SofiaCarRental.WPF

Error 2 The name "NullableBooleanConverter" does not exist in the namespace "clr-namespace:SofiaCarRental.WPF.Views". c:\..\SofiaCarRental.WPF\Views\MainWindow.xaml 10 9 SofiaCarRental.WPF

Error 1 The namespace prefix "local" is not defined. c:\..\SofiaCarRental.WPF\Views\AddEditWindow.xaml 1 1 SofiaCarRental.WPF

Error 4 The type 'local:BaseDialogWindow' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. c:\..\SofiaCarRental.WPF\Views\AddEditWindow.xaml 1 2 SofiaCarRental.WPF

Error 8 The type 'local:EmptyStringConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. c:\..\SofiaCarRental.WPF\Views\AddEditWindow.xaml 11 10 SofiaCarRental.WPF

Error 6 The type 'local:NullableBooleanConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. c:\..\SofiaCarRental.WPF\Views\AddEditWindow.xaml 9 10 SofiaCarRental.WPF

Error 7 The type 'local:YearConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. c:\..\SofiaCarRental.WPF\Views\AddEditWindow.xaml 10 10 SofiaCarRental.WPF

主窗口(在此我指定了“本地”)

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"

xmlns:local ="clr-namespace:SofiaCarRental.WPF.Views"

Title="Sofia Car Rental"

Height="720" Width="1280"

MinHeight="720" MinWidth="1280">

...

添加编辑窗口

xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Title="AddEditWindow"

Height="417" Width="383"

Title="{Binding Path=Title}">

...

BaseDialogWindow类:

namespace SofiaCarRental.WPF.Views

{

public class BaseDialogWindow : Window

{

public BaseDialogWindow()

{

this.Owner = App.Current.MainWindow;

this.ShowInTaskbar = false;

this.ResizeMode = System.Windows.ResizeMode.NoResize;

this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;

}

}}

NullableBooleanConverter

namespace SofiaCarRental.WPF.Views{

public class NullableBooleanConverter : IValueConverter

{

public object Convert(object value, Type targetType,

object parameter, CultureInfo culture)

{

object result = this.NullableBooleanToFalse(value);

return result;

}

public object ConvertBack(object value, Type targetType,

object parameter, CultureInfo culture)

{

object result = this.NullableBooleanToFalse(value);

return result;

}

private object NullableBooleanToFalse(object value)

{

if (value == null)

{

return false;

}

else

{

return value;

}

}

}}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值