42 lines
1.1 KiB
C#
Raw Normal View History

2025-08-15 15:25:44 +08:00
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;
}
}
}
}