42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using DI_Electrical.ViewModels;
|
|
|
|
namespace DI_Electrical.Style
|
|
{
|
|
internal class SignalNoticeStyleSelector:StyleSelector
|
|
{
|
|
public override System.Windows.Style SelectStyle(object item, DependencyObject container)
|
|
{
|
|
SignalNotice conditionValue = item as SignalNotice;
|
|
string value = conditionValue.CheckFLG.ToString();
|
|
foreach (ConditionalStyleRule rule in this.Rules)
|
|
{
|
|
//值相同则返回当前样式
|
|
if (Equals(rule.Value, value))
|
|
{
|
|
return rule.Style;
|
|
}
|
|
}
|
|
|
|
|
|
return base.SelectStyle(item, container);
|
|
}
|
|
|
|
List<ConditionalStyleRule> _Rules;
|
|
public List<ConditionalStyleRule> Rules
|
|
{
|
|
get
|
|
{
|
|
if (this._Rules == null)
|
|
{
|
|
this._Rules = new List<ConditionalStyleRule>();
|
|
}
|
|
|
|
return this._Rules;
|
|
}
|
|
}
|
|
}
|
|
}
|