1
我想在我自己的類ServiceControllerStatus(在System.ServiceProcess中找到的枚舉)的類中添加名爲'狀態'的屬性的數據觸發器。訪問WPF數據類型中的系統枚舉
我已將此添加到XAML:
xmlns:System="clr-namespace:System.ServiceProcess;assembly=System.ServiceProcess.dll"
,我試圖用數據觸發基礎上的「狀態」的價值做這個:
<DataTrigger Binding="{Binding Path=Status}" >
<DataTrigger.Value>
<System:ServiceControllerStatus>Running</System:ServiceControllerStatus>
</DataTrigger.Value>
<Setter TargetName="border" Property="BorderBrush" Value="Green"/>
</DataTrigger>
,但我收到錯誤「 XML名稱空間'clr-namespace:System.ServiceProcess;程序集= System.ServiceProcess.dll'中不存在標記'ServiceControllerStatus'
是否可以使用系統名稱中定義的枚舉p ace,還是隻能引用你自己的類中定義的枚舉?
謝謝!
感謝您的迴應,儘管使用您的代碼,我仍然得到相同的錯誤... – Shaun
@Shaun刪除'.dll'。那麼你可以編譯。 – ohyecloudy