无法在Silverlight XAML中实例化简单BCL对象
如果我声明了正确的XML名称空间,我就可以使用Silverlight XAML无法在Silverlight XAML中实例化简单BCL对象,silverlight,xaml,types,resourcedictionary,base-class-library,Silverlight,Xaml,Types,Resourcedictionary,Base Class Library,如果我声明了正确的XML名称空间,我就可以使用Silverlight XAMLResourceDictionary中的公共和默认构造函数创建/实例化我自己的任何类 但是,如果我在系统。*名称空间中的基类库的任何(非UI)类中尝试此操作,我会得到一个错误,即找不到该类型 例如: <UserControl x:Class="BclObjectsInXamlDemo.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml
ResourceDictionary
中的公共和默认构造函数创建/实例化我自己的任何类
但是,如果我在系统。*
名称空间中的基类库的任何(非UI)类中尝试此操作,我会得到一个错误,即找不到该类型
例如:
<UserControl x:Class="BclObjectsInXamlDemo.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:crypt="clr-namespace:System.Security.Cryptography;assembly=System.Core"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.Resources>
<crypt:AesManaged x:Key="AesManaged" />
</Grid.Resources>
</Grid>
</UserControl>
提供错误未找到类型“AESSOMETED”,因为“clr命名空间:System.Security.Cryptography;assembly=System.Core'是未知的命名空间。[行:12位置:37]
我感到困惑,因为我认为这很容易实现。我正在使用Visual Studio 2012和Silverlight 5。System.Core
程序集在我的项目中链接正确(默认情况下)。我可以在XAML中以不同的方式声明名称空间以使其工作吗?如果是,怎么做