Skip to content

Commit 0cf9350

Browse files
committed
perfomance optimization
1 parent e88c4af commit 0cf9350

24 files changed

+111
-92
lines changed

SimpleStateMachineNodeEditor/App.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
<ResourceDictionary Source="Styles/Colors.xaml"/>
1111
<ResourceDictionary Source="Styles/ErrorList/ExpanderTemplate.xaml"/>
1212
<ResourceDictionary Source="Styles/ErrorList/TextBoxTemplate.xaml"/>
13-
<ResourceDictionary Source="Styles/ErrorList/ScrollViewerTemplate.xaml"/>
1413
<ResourceDictionary Source="Styles/ErrorList/ScrollBarTemplate.xaml"/>
14+
<ResourceDictionary Source="Styles/ErrorList/ScrollViewerTemplate.xaml"/>
15+
1516
<ResourceDictionary Source="Styles/ErrorList/ListBoxTemplate.xaml"/>
1617
<ResourceDictionary Source="Styles/ErrorList/LabelTemplate.xaml"/>
1718
<ResourceDictionary Source="Styles/ErrorList/ListBoxItemTemplate.xaml"/>

SimpleStateMachineNodeEditor/Styles/ContextMenu/ContextMenuItemStyle.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</Grid>
3636

3737
<!-- Next level menu -->
38-
<Popup AllowsTransparency="True" IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" x:Name="SubMenuPopup" Focusable="false" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
38+
<Popup AllowsTransparency="True" IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" x:Name="SubMenuPopup" Focusable="false" PopupAnimation="{StaticResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
3939
<Border x:Name="SubMenuBorder" Margin="0,0,5,5" Background="{Binding Path=Background, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" BorderBrush="{Binding Path=BorderBrush, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" BorderThickness="{Binding Path=BorderThickness, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}">
4040
<Border.Effect>
4141
<DropShadowEffect BlurRadius="5" Opacity="0.4"/>

SimpleStateMachineNodeEditor/Styles/ErrorList/ExpanderTemplate.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
</Setter>
7171
</Style>
7272
<Style x:Key="ExpanderTemplate" TargetType="{x:Type Expander}">
73-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
73+
<Setter Property="Foreground" Value="{StaticResource {x:Static SystemColors.ControlTextBrushKey}}"/>
7474
<Setter Property="Background" Value="Transparent"/>
7575
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
7676
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
@@ -105,7 +105,7 @@
105105
<Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderLeftHeaderStyle}"/>
106106
</Trigger>
107107
<Trigger Property="IsEnabled" Value="false">
108-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
108+
<Setter Property="Foreground" Value="{StaticResource {x:Static SystemColors.GrayTextBrushKey}}"/>
109109
</Trigger>
110110
</ControlTemplate.Triggers>
111111
</ControlTemplate>

SimpleStateMachineNodeEditor/Styles/ErrorList/LabelTemplate.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</Border>
1717
<ControlTemplate.Triggers>
1818
<Trigger Property="IsMouseOver" Value="true">
19-
<Setter Property="Foreground" Value="{DynamicResource ColorHeaderButtonIsPressed}"/>
19+
<Setter Property="Foreground" Value="{StaticResource ColorHeaderButtonIsPressed}"/>
2020
</Trigger>
2121
</ControlTemplate.Triggers>
2222
</ControlTemplate>

SimpleStateMachineNodeEditor/Styles/ErrorList/ListBoxItemTemplate.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</Border>
1111
<ControlTemplate.Triggers>
1212
<Trigger Property="IsSelected" Value="true">
13-
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ColorHeaderButtonIsPressed}"/>
13+
<Setter TargetName="Border" Property="Background" Value="{StaticResource ColorHeaderButtonIsPressed}"/>
1414
</Trigger>
1515
</ControlTemplate.Triggers>
1616
</ControlTemplate>

SimpleStateMachineNodeEditor/Styles/ErrorList/ListBoxTemplate.xaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:local="clr-namespace:SimpleStateMachineNodeEditor.Styles.ErrorList">
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
43

54
<ControlTemplate x:Key="ListBoxTemplate" TargetType="{x:Type ListBox}">
65
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Padding="1" SnapsToDevicePixels="true">
7-
<ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Style="{DynamicResource ScrollViewerTemplate}" >
6+
<ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Style="{StaticResource ScrollViewerTemplate}" >
87
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
98
</ScrollViewer>
109
</Border>

SimpleStateMachineNodeEditor/Styles/ErrorList/ScrollBarTemplate.xaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:local="clr-namespace:SimpleStateMachineNodeEditor.Styles.ErrorList">
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
43

54
<Style x:Key="FocusVisual">
65
<Setter Property="Control.Template">
76
<Setter.Value>
87
<ControlTemplate>
9-
<Rectangle Margin="2" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
8+
<Rectangle Margin="2" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1" Stroke="{StaticResource {x:Static SystemColors.ControlTextBrushKey}}"/>
109
</ControlTemplate>
1110
</Setter.Value>
1211
</Setter>
@@ -115,10 +114,10 @@
115114
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
116115
<Setter Property="Background" Value="{StaticResource ScrollBar.Static.Background}"/>
117116
<Setter Property="BorderBrush" Value="{StaticResource ScrollBar.Static.Border}"/>
118-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
117+
<Setter Property="Foreground" Value="{StaticResource {x:Static SystemColors.ControlTextBrushKey}}"/>
119118
<Setter Property="BorderThickness" Value="1,0"/>
120-
<!--<Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>-->
121-
<!--<Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>-->
119+
<!--<Setter Property="Width" Value="{StaticResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>-->
120+
<!--<Setter Property="MinWidth" Value="{StaticResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>-->
122121
<Setter Property="Template">
123122
<Setter.Value>
124123
<ControlTemplate TargetType="{x:Type ScrollBar}">
@@ -186,8 +185,8 @@
186185
<Trigger Property="Orientation" Value="Horizontal">
187186
<Setter Property="Width" Value="Auto"/>
188187
<Setter Property="MinWidth" Value="0"/>
189-
<!--<Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>-->
190-
<!--<Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>-->
188+
<!--<Setter Property="Height" Value="{StaticResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>-->
189+
<!--<Setter Property="MinHeight" Value="{StaticResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>-->
191190
<Setter Property="BorderThickness" Value="0,1"/>
192191
<Setter Property="Template">
193192
<Setter.Value>

SimpleStateMachineNodeEditor/Styles/ErrorList/ScrollViewerTemplate.xaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:local="clr-namespace:SimpleStateMachineNodeEditor.Styles.ErrorList">
3+
xmlns:local="clr-namespace:SimpleStateMachineNodeEditor.Styles">
44

55
<Style x:Key="ScrollViewerTemplate" TargetType="{x:Type ScrollViewer}">
66
<Setter Property="OverridesDefaultStyle" Value="True" />
@@ -17,17 +17,17 @@
1717
<RowDefinition Height="Auto" />
1818
</Grid.RowDefinitions>
1919
<Border Grid.Column="0" Grid.Row="0" BorderThickness="0,1,1,1">
20-
<Border.BorderBrush>
21-
<SolidColorBrush Color="{DynamicResource BorderMediumColor}" />
22-
</Border.BorderBrush>
20+
<!--<Border.BorderBrush>
21+
<SolidColorBrush Color="{StaticResource BorderMediumColor}" />
22+
</Border.BorderBrush>-->
2323
<ScrollContentPresenter />
2424
</Border>
25-
<ScrollBar x:Name="PART_VerticalScrollBar" Style="{DynamicResource ScrollBarTemplate}" Orientation="Vertical" Grid.Column="1" Grid.Row="0" Width="7"
25+
<ScrollBar x:Name="PART_VerticalScrollBar" Style="{StaticResource ScrollBarTemplate}" Orientation="Vertical" Grid.Column="1" Grid.Row="0" Width="7"
2626
Value="{TemplateBinding VerticalOffset}"
2727
Maximum="{TemplateBinding ScrollableHeight}"
2828
ViewportSize="{TemplateBinding ViewportHeight}"
2929
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
30-
<ScrollBar x:Name="PART_HorizontalScrollBar" Style="{DynamicResource ScrollBarTemplate}" Orientation="Horizontal" Grid.Column="0" Grid.Row="1" Height="7"
30+
<ScrollBar x:Name="PART_HorizontalScrollBar" Style="{StaticResource ScrollBarTemplate}" Orientation="Horizontal" Grid.Column="0" Grid.Row="1" Height="7"
3131
Value="{TemplateBinding HorizontalOffset}"
3232
Maximum="{TemplateBinding ScrollableWidth}"
3333
ViewportSize="{TemplateBinding ViewportWidth}"

SimpleStateMachineNodeEditor/Styles/ErrorList/TextBoxTemplate.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
<SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA"/>
77
<SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5"/>
88
<Style x:Key="TextBoxTemplate" TargetType="{x:Type TextBox}">
9-
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
9+
<Setter Property="Background" Value="{StaticResource {x:Static SystemColors.WindowBrushKey}}"/>
1010
<Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}"/>
11-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
11+
<Setter Property="Foreground" Value="{StaticResource {x:Static SystemColors.ControlTextBrushKey}}"/>
1212
<!--<Setter Property="BorderThickness" Value="1"/>-->
1313
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
1414
<Setter Property="HorizontalContentAlignment" Value="Left"/>
@@ -20,7 +20,7 @@
2020
<Setter.Value>
2121
<ControlTemplate TargetType="{x:Type TextBox}">
2222
<Border x:Name="border" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="True">
23-
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Style="{DynamicResource ScrollViewerTemplate}" />
23+
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Style="{StaticResource ScrollViewerTemplate}" />
2424
</Border>
2525
<ControlTemplate.Triggers>
2626
<Trigger Property="IsEnabled" Value="false">
@@ -42,7 +42,7 @@
4242
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true"/>
4343
<Condition Property="IsSelectionActive" Value="false"/>
4444
</MultiTrigger.Conditions>
45-
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
45+
<Setter Property="SelectionBrush" Value="{StaticResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
4646
</MultiTrigger>
4747
</Style.Triggers>
4848
</Style>

SimpleStateMachineNodeEditor/Styles/MainWindow/CustomWindowTemplate.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
</ControlTemplate.Triggers>
3939
</ControlTemplate>
4040
<Style x:Key="CustomWindowStyle" TargetType="{x:Type Window}">
41-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
42-
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
41+
<Setter Property="Foreground" Value="{StaticResource {x:Static SystemColors.WindowTextBrushKey}}"/>
42+
<Setter Property="Background" Value="{StaticResource {x:Static SystemColors.WindowBrushKey}}"/>
4343
<Setter Property="Template">
4444
<Setter.Value>
4545
<ControlTemplate TargetType="{x:Type Window}">

0 commit comments

Comments
 (0)