forum

Home / DeveloperSection / Forums / Accessing system enums in WPF datatemplates

Accessing system enums in WPF datatemplates

Anonymous User 5548 16-Aug-2013
Hi Developer!

I'm trying to add a data trigger for a property called 'Status' in my own class of type ServiceControllerStatus (an enum found in System.ServiceProcess).

I added this to the XAML:

xmlns:System="clr-namespace:System.ServiceProcess;assembly=System.ServiceProcess.dll"
And am trying to use data triggers based on the value of 'Status' by doing this:
<DataTrigger Binding="{Binding Path=Status}" >
    <DataTrigger.Value>                            
        <System:ServiceControllerStatus>Running</System:ServiceControllerStatus>
    </DataTrigger.Value>
    <Setter TargetName="border" Property="BorderBrush" Value="Green"/>
</DataTrigger>

But am receiving an error "The tag 'ServiceControllerStatus' does not exist in XML namespace 'clr-namespace:System.ServiceProcess;assembly=System.ServiceProcess.dll"

Is it possible to use enums defined in system namespaces, or must you only reference enums defined in your own classes?

Thank you!


wpf wpf 
Updated on 17-Aug-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By