显示错误:
名称" StoreLocation "在命名空间"clr-namespace:System.Security.Cryptography.X509Certificates;assembly=mscorlib"中不存在
on line:
<x:Type TypeName="crypto:StoreLocation" />
我做错了什么?
<UserControl x:Class="Admin.Certificates"
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:local="clr-namespace:Admin"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:crypto="clr-namespace:System.Security.Cryptography.X509Certificates;assembly=mscorlib">
<UserControl.DataContext>
<local:CertificatesViewModel />
</UserControl.DataContext>
<UserControl.Resources>
<ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="GetEnumValues">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="crypto:StoreLocation" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</UserControl.Resources>
<Grid>
<DataGrid ItemsSource="{Binding Certificates}" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridComboBoxColumn Header="StoreLocation"
ItemsSource="{Binding Source={StaticResource GetEnumValues}}"
SelectedValueBinding="{Binding StoreLocationValue}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>
try:
xmlns:crypto="clr-namespace:System.Security.Cryptography.X509Certificates;assembly=System"
我知道这可能有点晚了,但是对于那些想知道快捷方式的人来说,在输入
之后xmlns:crypto="
开始输入
using
然后从类所在的位置粘贴命名空间(在VS中按F12类名并复制命名空间),然后按
ctrl +空格
Visual Studio将为您输入正确的clr类型。