---
title: "Accessing system enums in WPF datatemplates"  
description: "Accessing system enums in WPF datatemplates"  
author: "Anonymous User"  
published: 2013-08-16  
updated: 2013-08-17  
canonical: https://www.mindstick.com/forum/1376/accessing-system-enums-in-wpf-datatemplates  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# Accessing system enums in WPF datatemplates

Hi [Developer](https://www.mindstick.com/articles/157260/variation-between-web-designer-and-web-developer)!

I'm trying to add a data [trigger](https://www.mindstick.com/blog/167/triggers-in-wpf) for a [property](https://www.mindstick.com/blog/205/property-notification-in-c-sharp) called '[Status](https://www.mindstick.com/articles/157184/check-lic-policy-status-online-by-policy-number)' in my own class of type ServiceControllerStatus (an enum found in [System](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business).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](https://www.mindstick.com/interview/1284/what-characters-are-allowed-in-an-xml-namespace-prefix) 'clr-namespace:System.ServiceProcess;[assembly](https://www.mindstick.com/articles/25/global-assembly-cache)=System.ServiceProcess.dll"

Is it possible to use enums defined in system [namespaces](https://www.mindstick.com/forum/155583/what-are-namespaces-in-c-sharp), or must you only [reference](https://www.mindstick.com/forum/774/reference-what-does-this-error-mean-in-php) enums defined in your own classes?

Thank you!

## Replies

### Reply by shreesh chandra shukla

Hi!

You can use enum with the {x:Static} form.

```
<DataTrigger Binding="{Binding Path=Status}"             
Value="{x:Static System:ServiceControllerStatus.Running}">    <Setter TargetName="border"
Property="BorderBrush" Value="Green"/></DataTrigger>
```

thanks


---

Original Source: https://www.mindstick.com/forum/1376/accessing-system-enums-in-wpf-datatemplates

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
