blob: 5487832b9efed833d1be1a405aae5a6ce4b1e49c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:surfaces="clr-namespace:RealTimeGraphX.WPF.Surfaces"
xmlns:components="clr-namespace:RealTimeGraphX.WPF.Components"
xmlns:converters="clr-namespace:RealTimeGraphX.WPF.Converters"
xmlns:local="clr-namespace:RealTimeGraphX.WPF">
<converters:IGraphDataPointToStringConverter x:Key="IGraphDataPointToStringConverter" />
<Style TargetType="{x:Type surfaces:WpfGraphSurface}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type surfaces:WpfGraphSurface}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid x:Name="PART_Grid" Margin="{TemplateBinding Padding}">
<Image Source="{TemplateBinding Image}" Stretch="None"></Image>
<Canvas x:Name="PART_SelectionCanvas" Background="Transparent">
<Rectangle x:Name="PART_SelectionRectangle" Fill="#7BFFFFFF" Canvas.Top="0" Canvas.Left="0" Width="0" Height="0" Visibility="Hidden"></Rectangle>
</Canvas>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type components:GraphAxisControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type components:GraphAxisControl}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ItemsControl x:Name="PART_ItemsControl" ItemsSource="{TemplateBinding Items}" ItemTemplate="{TemplateBinding ItemTemplate}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<components:GraphAxisPanel Orientation="{Binding RelativeSource={RelativeSource AncestorType=components:GraphAxisControl},Path=Orientation}"></components:GraphAxisPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate DataType="{x:Type components:GraphAxisTickData}">
<DockPanel VerticalAlignment="Top">
<Rectangle DockPanel.Dock="Right" VerticalAlignment="Center" Stroke="{Binding RelativeSource={RelativeSource AncestorType=components:GraphAxisControl},Path=Foreground}" StrokeThickness="1">
<Rectangle.Style>
<Style TargetType="Rectangle">
<Setter Property="Width" Value="4"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding IsEven}" Value="True">
<Setter Property="Width" Value="6"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource IGraphDataPointToStringConverter}">
<Binding Path="Data" />
<Binding RelativeSource="{RelativeSource AncestorType=components:GraphAxisControl}" Path="StringFormat" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DockPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate DataType="{x:Type components:GraphAxisTickData}">
<DockPanel HorizontalAlignment="Left">
<Rectangle DockPanel.Dock="Top" HorizontalAlignment="Center" Stroke="{Binding RelativeSource={RelativeSource AncestorType=components:GraphAxisControl},Path=Foreground}" StrokeThickness="1">
<Rectangle.Style>
<Style TargetType="Rectangle">
<Setter Property="Height" Value="4"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding IsEven}" Value="True">
<Setter Property="Height" Value="6"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
<TextBlock VerticalAlignment="Bottom" RenderTransformOrigin="0.5,0.5">
<TextBlock.RenderTransform>
<RotateTransform Angle="-30" />
</TextBlock.RenderTransform>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource IGraphDataPointToStringConverter}">
<Binding Path="Data" />
<Binding RelativeSource="{RelativeSource AncestorType=components:GraphAxisControl}" Path="StringFormat" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DockPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type components:GraphGridLines}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type components:GraphGridLines}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<ItemsControl ItemsSource="{TemplateBinding HorizontalItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="{Binding RelativeSource={RelativeSource AncestorType=components:GraphGridLines},Path=Columns}"></UniformGrid>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Rectangle Stroke="{Binding RelativeSource={RelativeSource AncestorType=components:GraphGridLines},Path=Foreground}" StrokeThickness="1" HorizontalAlignment="Left" VerticalAlignment="Stretch"></Rectangle>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ItemsControl ItemsSource="{TemplateBinding VerticalItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="{Binding RelativeSource={RelativeSource AncestorType=components:GraphGridLines},Path=Rows}"></UniformGrid>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Rectangle Stroke="{Binding RelativeSource={RelativeSource AncestorType=components:GraphGridLines},Path=Foreground}" StrokeThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Top"></Rectangle>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
|