简体   繁体   English

将System.Diagnostics.ProcessPriorityClass枚举绑定到WPF组合框

[英]Bind System.Diagnostics.ProcessPriorityClass enums to a WPF combobox

I have my ResourceDictionary declared as: 我的ResourceDictionary声明为:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:AutoStart.View"
                    xmlns:system="clr-namespace:System;assembly=mscorlib"
                    xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=mscorlib">


    <ObjectDataProvider x:Key="processPrioritiesList" MethodName="GetValues" ObjectType="{x:Type system:Enum}">
        <ObjectDataProvider.MethodParameters>
            <x:Type TypeName="diagnostics:ProcessPriorityClass"/>
        </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>
</ResourceDictionary>

And it throws an error saying: 它抛出一个错误,说:

The name "ProcessPriorityClass" does not exist in the namespace "clr-namespace:System.Diagnostics;assembly=mscorlib". 名称空间“ clr-namespace:System.Diagnostics; assembly = mscorlib”中不存在名称“ ProcessPriorityClass”。

I checked that ProcessPriorityClass is a public member of the System.Diagnostics namespace, but for some reason it's not letting me use the Enum value to be binded to a combobox 我检查了ProcessPriorityClass是System.Diagnostics命名空间的公共成员,但是由于某种原因,它不允许我使用Enum值绑定到组合框

How could i accomplish this? 我怎么能做到这一点?

程序集名称错误:

xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=System"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM