mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
整理一下项目文件
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
public class DesignerItemsControlItemStyleSelector : StyleSelector
|
||||
{
|
||||
static DesignerItemsControlItemStyleSelector()
|
||||
{
|
||||
Instance = new DesignerItemsControlItemStyleSelector();
|
||||
}
|
||||
|
||||
public static DesignerItemsControlItemStyleSelector Instance
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
|
||||
public override Style SelectStyle(object item, DependencyObject container)
|
||||
{
|
||||
ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(container);
|
||||
if (itemsControl == null)
|
||||
throw new InvalidOperationException("DesignerItemsControlItemStyleSelector : Could not find ItemsControl");
|
||||
|
||||
if (item is GifImageItemViewModel)
|
||||
{
|
||||
return (Style)itemsControl.FindResource("gifimageItemStyle");
|
||||
}
|
||||
|
||||
if (item is LinkPointDesignerItemViewModel)
|
||||
{
|
||||
return (Style)itemsControl.FindResource("linkpointItemStyle");
|
||||
}
|
||||
|
||||
if (item is PointDesignerItemViewModel)
|
||||
{
|
||||
return (Style)itemsControl.FindResource("pointItemStyle");
|
||||
}
|
||||
|
||||
if (item is LogicalGateItemViewModelBase)
|
||||
{
|
||||
return (Style)itemsControl.FindResource("logicalItemStyle");
|
||||
}
|
||||
|
||||
if (item is DesignerItemViewModelBase)
|
||||
{
|
||||
|
||||
return (Style)itemsControl.FindResource("designerItemStyle");
|
||||
}
|
||||
|
||||
if (item is ConnectorViewModel)
|
||||
{
|
||||
return (Style)itemsControl.FindResource("connectorItemStyle");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user