mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-04 08:06:36 +08:00
覆盖默认定义
This commit is contained in:
@@ -22,6 +22,36 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
public DiagramControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (ResourceDictionary != null)
|
||||
{
|
||||
this.Resources.MergedDictionaries.Add(ResourceDictionary);
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ResourceDictionaryProperty = DependencyProperty.Register(nameof(ResourceDictionary), typeof(ResourceDictionary), typeof(DiagramControl), new UIPropertyMetadata(null, OnResourceDictionaryChanged));
|
||||
|
||||
private static void OnResourceDictionaryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is DiagramControl diagram)
|
||||
{
|
||||
if (e.NewValue is ResourceDictionary dictionary)
|
||||
{
|
||||
diagram.Resources.MergedDictionaries.Add(dictionary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ResourceDictionary ResourceDictionary
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ResourceDictionary)GetValue(ResourceDictionaryProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(ResourceDictionaryProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ZoomValueProperty = DependencyProperty.Register(nameof(ZoomValue), typeof(double), typeof(DiagramControl), new UIPropertyMetadata(1d));
|
||||
@@ -42,6 +72,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
//DesignerCanvas myDesignerCanvas = sender as DesignerCanvas;
|
||||
//zoomBox.DesignerCanvas = myDesignerCanvas;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private async void ScaleTransform_Changed(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user