Unable to find enum type for static reference in WPF

三世轮回 提交于 2019-11-29 13:13:48

Use "+" instead of "." to get to a nested type in XAML:

{x:Static models:Enums+MySelections.one}

You could declare it outside of your class:

namespace Application.Models
{
    public enum MySelections { one, two, three };

    public  class Enums
    {
        public MySelections CurrentSelection;

And then this xaml will work:

.... ConverterParameter={x:Static models:MySelections.one}

The x:Static markup has the fixed syntax:

{x:Static prefix:typeName.staticMemberName}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!