简体   繁体   中英

Bug in visualstudio2010/wpf designer when using enum in xaml

So I've just been completely ignoring the problem for a while now and just not using the designer, but it's been getting more frustrating if I just want to see some margins quick before compiling.

The error I get from the designer is "Type 'local:MainWindow+TireSeasonFilterEnum' was not found."

And the corresponding xaml is

<Style...
<Style.Triggers...

<DataTrigger Binding="{Binding Path=TireSeasonFilter}" 
             Value="{x:Static local:MainWindow+TireSeasonFilterEnum.All}">
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="TextDecorations" Value="Underline" />
</DataTrigger>

the enum is simply a public enum sitting in the code-behind of the window.

The designer refuses to load until the error is fixed, but there is no error. the code compiles and runs exactly how it should.

Is there any way in which I can modify my code to achieve the same result, but avoid the error?

The WPF Designer does not support nested classes. This is a known bug.

I suggest that you move the enum outside of the parent class.

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.

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