refactor: 将Framework库和RT、UI放在同一个解决方案中。
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
|
||||
|
||||
public class DisplayValueTemplateSelector : DataTemplateSelector
|
||||
{
|
||||
public DataTemplate ColorDisplayTemplate { get; set; }
|
||||
public DataTemplate TextDisplayTemplate { get; set; }
|
||||
|
||||
public override DataTemplate SelectTemplate(object item, DependencyObject container)
|
||||
{
|
||||
if (item is not ConfigItem cfgItem)
|
||||
return null;
|
||||
|
||||
|
||||
DataTemplate curTemplate = null;
|
||||
switch (cfgItem.Type)
|
||||
{
|
||||
case DataType.Color:
|
||||
curTemplate = ColorDisplayTemplate;
|
||||
break;
|
||||
|
||||
default:
|
||||
curTemplate = TextDisplayTemplate;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return curTemplate;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user