I'm getting a error:
The name 'StoreLocation' does not exist in the namespace "clr-namespace:System.Security.Cryptography.X509Certificates;assembly=mscorlib"
on line:
<x:Type TypeName="crypto:StoreLocation" />
What I'm doing wrong?
<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>
尝试:
xmlns:crypto="clr-namespace:System.Security.Cryptography.X509Certificates;assembly=System"
I know this might be a little late, but for those wondering a shortcut for this, after typing
xmlns:crypto="
start typing
using
then paste the namespace(pressing F12 on the class name in VS and copy the namespace) from where the class is located and press
ctrl + spacebar
Visual Studio will enter the correct clr type for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.