private void InitializeTheme()
{
Theme = new Theme(this) {FontFamily = TextElement.GetFontFamily(this)};
var solidColorBrush = TextElement.GetForeground(this) as SolidColorBrush;
if (solidColorBrush != null)
Theme.ForegroundColor = solidColorBrush.Color;
var colorBrush = Application.Current.Resources["BackgroundBrush"] as SolidColorBrush;
if (colorBrush != null)
Theme.BackgroundColor = colorBrush.Color;
var gridBrush = Application.Current.Resources["GridBrush"] as SolidColorBrush;
if (gridBrush != null)
Theme.GridColor = gridBrush.Color;
var connectorBrush = Application.Current.Resources["ConnectorBrush"] as SolidColorBrush;
if (connectorBrush != null)
Theme.ConnectorColor = connectorBrush.Color;
Theme.ConnectorThickness =
Application.Current.Resources["ConnectorThickness"] is double
? (double) Application.Current.Resources["ConnectorThickness"]
: 0;
var toolTipBackgroundBrush = Application.Current.Resources["TooltipBackgroundBrush"] as SolidColorBrush;
if (toolTipBackgroundBrush != null)
{
Theme.TooltipBackgroundColor =
toolTipBackgroundBrush.Color;
}
var tooltipBorderBrush = Application.Current.Resources["TooltipBorderBrush"] as SolidColorBrush;
if (tooltipBorderBrush != null)
Theme.TooltipBorderColor = tooltipBorderBrush.Color;
var portFillBrush = Application.Current.Resources["PortFillBrush"] as SolidColorBrush;
if (portFillBrush != null)
Theme.PortFillColor = portFillBrush.Color;
var portStrokeBrush = Application.Current.Resources["PortStrokeBrush"] as SolidColorBrush;
if (portStrokeBrush != null)
Theme.PortStrokeColor = portStrokeBrush.Color;
Theme.PortSize =
Application.Current.Resources["PortSize"] is double
? (double) Application.Current.Resources["PortSize"]
: 0;
Theme.PortStrokeThickness =
Application.Current.Resources["PortStrokeThickness"] is double
? (double) Application.Current.Resources["PortStrokeThickness"]
: 0;
Theme.ButtonBorderColor = (Application.Current.Resources["ButtonBorderBrush"] as SolidColorBrush).Color;
Theme.ButtonFillColor = (Application.Current.Resources["ButtonFillBrush"] as SolidColorBrush).Color;
Theme.HighlightingColor = (Application.Current.Resources["BrushHighlighting"] as SolidColorBrush).Color;
Theme.NodeBorderColor = (Application.Current.Resources["NodeBorderBrush"] as SolidColorBrush).Color;
//NodeBorderThickness = Application.Current.Resources["NodeBorderThickness"] is Thickness ? (Thickness) Application.Current.Resources["NodeBorderThickness"] : new Thickness(),
Theme.NodeBorderCornerRadius =
Application.Current.Resources["NodeBorderCornerRadius"] is double
? (double) Application.Current.Resources["NodeBorderCornerRadius"]
: 0;
Theme.NodeBorderColorOnMouseOver =
(Application.Current.Resources["NodeBorderBrushMouseOver"] as SolidColorBrush).Color;
Theme.NodeBorderColorOnSelection =
(Application.Current.Resources["NodeBorderBrushSelection"] as SolidColorBrush).Color;
Theme.LineColor = (Application.Current.Resources["LineStrokeBrush"] as SolidColorBrush).Color;
Theme.LineThickness =
Application.Current.Resources["LineStrokeThickness"] is double
? (double) Application.Current.Resources["LineStrokeThickness"]
: 0;
Theme.ConnEllipseFillColor =
(Application.Current.Resources["ConnEllipseFillBrush"] as SolidColorBrush).Color;
Theme.ConnEllipseSize =
Application.Current.Resources["ConnEllipseSize"] is double
? (double) Application.Current.Resources["ConnEllipseSize"]
: 0;
}